PDF: expose object structure as a browsable filesystem#557
Draft
andiwand wants to merge 1 commit into
Draft
Conversation
Add `pdf::PdfFilesystem`, a read-only `ReadableFilesystem` adapter over a
PDF's low-level object structure:
/trailer the trailer dictionary
/objects/<id>_<gen> each indirect object's value
/streams/<id>_<gen> each stream object's bytes (filter-decoded when
possible, raw otherwise)
The object set comes from the cross-reference table at construction;
content is serialized lazily on `open`. `create_object_filesystem` wraps
a PDF into an `odr::Filesystem` so it browses and renders through the
existing filesystem HTML viewer with no viewer changes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011jPrCgocCTnKhMi3k6VBjU
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.
🤖 Generated with Claude Code
What
Make a PDF's internal object structure browsable by exposing it through the filesystem API and wiring it to the existing filesystem HTML viewer.
New
pdf::PdfFilesystem— a read-onlyReadableFilesystemadapter over a PDF:create_object_filesystem(pdf)wraps a PDF into anodr::Filesystem, so it browses and renders through the existing filesystem HTML viewer (html::translate(filesystem, …)) — no viewer changes needed.How
open; the backingDocumentParseris held for the filesystem's lifetime, so an instance is transient — one per browse — matching the parser's usage contract.Tests
test/src/internal/pdf/pdf_filesystem.cppcovers the object/stream listing, serialized object and trailer content, decoded stream bytes, and end-to-end rendering through the filesystem viewer.