feat(pipeline): add PDF as a first-class InDesign input#101
Merged
PAMulligan merged 1 commit intoJun 20, 2026
Conversation
Parse InDesign-exported PDFs into the same IR as the IDML parser, so the token mapper and component generator are source-agnostic (#64, part of #62). - Extract text runs, fill/stroke colors, and embedded images via pdfjs-dist - Cluster runs into text frames; infer heading/body/caption buckets from font sizes; detect columns; derive a swatch palette from fills and image colors - Extract embedded images to PNG (pngjs), addressable from the IR - Emit fidelity warnings (no embedded fonts, text-from-glyphs, vector-only page, multi-column, image-not-extracted) surfaced by the CLI - CLI accepts .pdf as a primary input with --source-priority and --assets; runCli is now async; parseSourceFile auto-detects .idml vs .pdf - Add meta.source ("idml" | "pdf") to the IR - 24 new tests (117 total) across the five PDF shapes plus PDF->IR->tokens and IDML/PDF parity; pdf-lib generates hermetic fixtures - Document fidelity in docs/pipeline/indesign-pdf-fidelity.md Refs #64, #62 Co-Authored-By: Claude Opus 4.8 (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.
Summary
Makes PDF a first-class input to the InDesign-to-React pipeline (#64, part of #62). InDesign-exported PDFs are what designers actually hand engineering, so the parser ingests them into the same IR the IDML parser emits — keeping the token mapper (#65) and the upcoming component generator (#66) source-agnostic.
New
packages/pipeline/src/pdf/subsystem (viapdfjs-dist) plus a source-agnosticparseSourceFileentry and CLI integration.What it does
ParagraphStyles the mapper clusters exactly as IDML styles.pngjs), and writes them to an--assetsdir, addressable from the IR.TEXT_FROM_GLYPHS,NO_EMBEDDED_FONTS,VECTOR_ONLY_PAGE,MULTI_COLUMN_DETECTED,IMAGE_NOT_EXTRACTEDwarnings, surfaced by the CLI and documented indocs/pipeline/indesign-pdf-fidelity.md.CLI & API
# Auto-detects .pdf vs .idml; --source-priority forces a path. aurelius-indesign brochure.pdf --emit-tokens ./src/tokens --assets ./public/assetsrunCliis now async;meta.source("idml" | "pdf") was added to the IR.Acceptance criteria (#64)
.pdfas a primary input and runs PDF → IR → tokens end-to-enddocs/pipeline/indesign-pdf-fidelity.mdTesting
pnpm --filter @aurelius/pipeline typecheck/test/build✅ — 117 tests (24 new)eslint .(0 errors) andprettier --check .✅;check-doc-counts✅; lockfile in sync (pnpm 9 compatible)image-1.png) all work;config/font-map.jsonresolves fromdist/Notes
--source-priority pdfto verify parity.pdfjs-distruns in Node with no worker/canvas (data-extraction only). New deps:pdfjs-dist,pngjs(runtime),pdf-lib,@types/pngjs(dev, fixtures).Closes #64
Part of #62
🤖 Generated with Claude Code