If I understand correctly the pdf specs, `PDF-UA.pdf` is a "hybrid-reference" file because it contains a xref table with some deleted elements and a xref stream which references those deleted elements. When we're writing data in the pdf, we use a xref stream but its `Prev` entry makes a reference on the xref table but not on the previous xref stream: https://github.com/mozilla/pdf.js/blob/b1e0253f29176751c9762f88b5b9765fcf9fc07c/src/core/writer.js#L285 but in the specifications for xref stream we've: ``` The byte offset in the decoded stream from the beginning of the file to the beginning of the previous cross-reference stream. This entry has the same function as the Prev entry in the trailer dictionary (Table 15). ``` Consequently, the fix to reference the previous xref stream instead of the previous xref table.
Bug 1823296 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
If I understand correctly the pdf specs, `PDF-UA.pdf` is a "hybrid-reference" file because it contains a xref table with some deleted elements and a xref stream which references those deleted elements. When we're writing data in the pdf, we use a xref stream but its `Prev` entry makes a reference on the xref table but not on the previous xref stream: https://github.com/mozilla/pdf.js/blob/b1e0253f29176751c9762f88b5b9765fcf9fc07c/src/core/writer.js#L285 but in the specifications for xref stream we've: ``` The byte offset in the decoded stream from the beginning of the file to the beginning of the previous cross-reference stream. This entry has the same function as the Prev entry in the trailer dictionary (Table 15). ``` Consequently, the fix is to reference the previous xref stream instead of the previous xref table.