Repository navigation
Retagging keeps the xref stream, so Preview opens the output - #14
Merged
Merged
Conversation
…ref stream After a full save, mupdf wrote the incremental update as an xref table carrying the xref stream's trailer, which macOS Preview cannot open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
No blocking issues. All checks pass. The second openPdf(pdf, opts) uses the same options, including any password, so the baseline is built exactly as before. The new test checks the trailing xref type of both updates.
Non-blocking notes
src/tag.ts:37:save(openPdf(pdf, opts).doc, true)opens and repairs/untags a second full copy of the document and never destroys it. When retagging a large PDF, two mupdf documents now sit in WASM memory until GC finalizes the copy. Calling.destroy()on the copy right aftersavewould release it at once. This is latent: it only matters for big inputs near the memory limit.test/document.test.ts:89-93:lastXrefonly reads the finalstartxref. That is enough for this regression. It does not check that the update's trailer has no/Type/XRefon a table, but the existing table-path test covers that case only indirectly.
Accessibility impact: none on the tag tree; retagged output now opens in macOS Preview/PDFKit, so users of those readers can reach the tagged document at all.
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.
Retagging our own output did a full in-memory save to make the text-check baseline. After that, mupdf wrote the incremental update as a classic xref table carrying the xref stream's trailer (
/Type/XRef /W ... /Filter). macOS Preview and PDFKit cannot open that ("failed to find start of cross-reference section"). qpdf and poppler accept it. A user hit it in production.The baseline is now saved from a second copy of the document. A test retags a file that uses an xref stream and checks that both updates are xref streams. It fails without the fix. On the reported file, the output now opens in PDFKit.
🤖 Generated with Claude Code