Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STY: File identifier generation restructuring #2362

Merged
merged 1 commit into from
Dec 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
STY: File identifier generation restructuring
#2003

Co-authored-by: exiledkingcc <[email protected]>
  • Loading branch information
MartinThoma and exiledkingcc committed Dec 23, 2023
commit 3d84ba8c157733b4ad45f43523d6d9abc4ec9d4c
7 changes: 4 additions & 3 deletions pypdf/_writer.py
Original file line number Diff line number Diff line change
@@ -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)
@@ -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(
Loading