Skip to content

Commit

Permalink
STY: File identifier generation restructuring
Browse files Browse the repository at this point in the history
#2003

Co-authored-by: exiledkingcc <[email protected]>
  • Loading branch information
MartinThoma and exiledkingcc committed Dec 23, 2023
1 parent beca111 commit 3d84ba8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pypdf/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def cloneDocumentFromReader(
)
self.clone_document_from_reader(reader, after_page_append)

def _compute_document_identifier_from_content(self) -> ByteStringObject:
def _compute_document_identifier(self) -> ByteStringObject:
stream = BytesIO()
self._write_pdf_structure(stream)
stream.seek(0)
Expand All @@ -1238,9 +1238,10 @@ def generate_file_identifiers(self) -> None:
"""
if self._ID:
id1 = self._ID[0]
id2 = self._compute_document_identifier()
else:
id1 = self._compute_document_identifier_from_content()
id2 = self._compute_document_identifier_from_content()
id1 = self._compute_document_identifier()
id2 = id1
self._ID = ArrayObject((id1, id2))

def encrypt(
Expand Down

0 comments on commit 3d84ba8

Please sign in to comment.