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

Use lazy loading for object-streams and their objects #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

packdat
Copy link

@packdat packdat commented Feb 1, 2024

This PR attempts to resolve the issues described in #73 and #46 in a more generic way.
It also supersedes #53 by removing the need to handle objects stored in object-streams in a special way.

The "lazy loading" aspect is handled by the new class PdfReferenceToCompressedObject, which is a sub-class of PdfReference.
While processing the document's xref-streams, references to objects stored in object-streams are collected in the form of the mentioned PdfReferenceToCompressedObject.
When accessing the Value of such a reference (which may occur while parsing another object which contains a reference to the compressed object), the object-stream is loaded and decrypted (if not already done) and the actual object is read from the object-stream.

Have not found any issue so far running automated tests with these changes against ~1000 PDF-files (testing page-import).

Note:
The PR also includes some minor tweaks not directly related to object-loading, which i think are helpful.
(like reporting the position within a document where an unexpected token was encountered during parsing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant