Repository navigation
Count only defined objects in an incremental save's /Size - #117
Open
KleiKodesh wants to merge 1 commit into
Open
KleiKodesh wants to merge 1 commit into
KleiKodesh wants to merge 1 commit into
Conversation
An incremental save wrote /Size from the document's last object number, which includes numbers an editing session reserved with EPDFLayer_RaiseLastObjectNumber() and never used. qpdf reports such a /Size as larger than the highest object number plus one. The /Size and the cross-reference stream's number now follow the highest object number the file defines: the input's objects and /Size, and the objects the save wrote.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An incremental save wrote
/Sizefrom the document's last object number. That number includes object numbers an editing session reserved withEPDFLayer_RaiseLastObjectNumber()and never used, so a save that only touched a few objects could claim a/Sizedozens of numbers past the highest object in the file. qpdf reports that as an error (/Sizelarger than the highest object number + 1).Now an incremental save (plain or a layer delta) takes its
/Size, and the cross-reference stream's object number, from the highest object number the file actually defines:/Size, so/Sizenever shrinks below the input's;A layer delta is cumulative from its base, so it writes every object the base lacks and the rule holds there too. Full saves are unchanged: their single cross-reference subsection still lists reserved numbers as free entries (complete-xref).
The change sits under the existing
save-traversalrule; the ledger entry says so.Tests
EPDFLayerEmbedderTest.SaveLayerDeltaSizeIgnoresUnusedReservedNumbers: a layer reserves 64 numbers, creates one annotation at the first, and the delta's/Sizeis that annotation's number + 1.