Files
Michael Higgins d851c9b2e3 craft-pdf: a rebuilt xref keeps the generation-0 object the page draws (cos) (#2240)
When the cross-reference data is rebuilt from object headers, the index
was keyed by object number alone, so a later `N 1 obj` replaced
`N 0 obj` while the renderer still drew `N 0 obj` under `N 0 R`. cos
read the page's object as null and a full save wrote null
(storytold/pdfcraft#6759).

Each number now keeps its object by the renderer's rule: the last real
`N 0 obj`, else the last header as a generation-0 stand-in. Where a
number has headers of several generations, a bounded walk from the
trailer gives the slot to the one generation the document reaches,
when it reaches one only, so a reused number such as PDFBOX-3785's
`202097.pdf` keeps its page. A trailer /Root is ranked by its own
generation's header, and a slot whose object stream supplies indexed
members stays. What one slot cannot hold goes to the repair log, and
Document::rebuilt_with_unsettled_generations() says when a save could
differ from what the renderer drew.

Port of storytold/pdfcraft#6767, which can't land in pdfcraft since cos
moved here.
2026-11-18 15:30:17 -05:00
..
2026-10-20 03:25:47 +00:00
2026-10-20 03:25:47 +00:00