Skip to content

Commit

Permalink
BUG: Adobe Acrobat 'Would you like to save this file?' (#970)
Browse files Browse the repository at this point in the history
Issue: When creating files with the current PpdfWriter,
Adobe Acrobat asks 'would you like to save this file'
when attempting to close it - although no changes were made.

Fix: Remove 'self.set_need_appearances_writer()' from writers
     __init__ function

Caused-by: #412 (see #355)

Closes #963

Co-authored-by: pubpub-zz <[email protected]>
  • Loading branch information
MartinThoma and pubpub-zz authored Jun 11, 2022
1 parent 336d659 commit df8f121
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PyPDF2/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def __init__(self) -> None:
)
self._root: Optional[IndirectObject] = None
self._root_object = root
self.set_need_appearances_writer()

def _add_object(self, obj: Optional[PdfObject]) -> IndirectObject:
self._objects.append(obj)
Expand Down Expand Up @@ -539,6 +538,7 @@ def update_page_form_field_values(
second bit sets Required, the third bit sets NoExport. See
PDF Reference Table 8.70 for details.
"""
self.set_need_appearances_writer()
# Iterate through pages, update field values
for j in range(len(page[PG.ANNOTS])): # type: ignore
writer_annot = page[PG.ANNOTS][j].get_object() # type: ignore
Expand Down

0 comments on commit df8f121

Please sign in to comment.