-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
PdfWriterThe PdfWriter component is affectedThe PdfWriter component is affectedis-robustness-issueFrom a users perspective, this is about robustnessFrom a users perspective, this is about robustnessworkflow-mergeFrom a users perspective, merging is the affected feature/workflowFrom a users perspective, merging is the affected feature/workflow
Description
Append a page to a PdfWriter might fail.
Environment
pypdf 5.4.0 with Python 3.11
Code + PDF
This is a minimal, complete example that shows the issue:
from pypdf import PdfWriter
writer = PdfWriter(clone_from='file1.pdf')
writer.append('file2.pdf')I still have to find/generate a corresponding PDF file which does not contain personal information.
Traceback
This is the complete traceback I see:
[...]
File "/home/user/tmp/run.py", line xxx, in xxx
writer.append('file2.pdf')
File "/home/user/tmp//lib/python3.11/site-packages/pypdf/_writer.py", line 2621, in append
self.merge(
File "/home/user/tmp//lib/python3.11/site-packages/pypdf/_writer.py", line 2753, in merge
_process_named_dests(dest)
File "/home/user/tmp//lib/python3.11/site-packages/pypdf/_writer.py", line 2724, in _process_named_dests
cast(DictionaryObject, self._root_object["/Names"])["/Dests"],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/home/user/tmp//lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 478, in __getitem__
return dict.__getitem__(self, key).get_object()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '/Dests'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
PdfWriterThe PdfWriter component is affectedThe PdfWriter component is affectedis-robustness-issueFrom a users perspective, this is about robustnessFrom a users perspective, this is about robustnessworkflow-mergeFrom a users perspective, merging is the affected feature/workflowFrom a users perspective, merging is the affected feature/workflow