feat(pipeline): add PDF fallback parser and layout reconstruction (#63)#90
Merged
PAMulligan merged 1 commit intoMay 29, 2026
Conversation
Reconstruct an approximate version of the IDML parser's intermediate representation from a PDF exported from InDesign, for when IDML is unavailable or as a verification source. - parse-pdf.js orchestrator: parsePdf/parsePdfBuffer -> validated Document IR (same shape as the IDML parser; Spread-per-page, Frame/TextFrame/ImageFrame/ Story, warnings) - pdf/ modules: lazy pdfjs-dist loader, per-page extraction (text runs, font metrics, fill colors, image XObjects, vector flag), positional clustering with gutter-aware column detection, font-size -> heading/body/caption style synthesis, RGB/gray/CMYK -> hex with nearest-swatch matching against an IDML palette, and a zero-dependency PNG encoder for the asset cache - fidelity warnings for every approximation (10 codes), surfaced in CLI output and documented in docs/pipeline/indesign-pdf-fidelity.md - flavian-parse-pdf CLI (--dpi, --asset-dir, --quiet) - programmatic PDF fixtures (build-pdf.js); 57 tests incl. text-heavy, image-heavy, multi-column, brochure, asset extraction, and an IDML<->PDF round-trip within documented tolerances pdfjs-dist pinned to 4.x with a guarded Promise.withResolvers polyfill so the package keeps its Node >=20 support (5.x requires Node >=22). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
@-