#11427: fix(pdf): provide standardFontDataUrl to pdfjs-dist getDocument
stale
Cluster:
Media Handling Improvements
pdfjs-dist's NodeStandardFontDataFactory requires a standardFontDataUrl to locate bundled .pfb/.ttf font files when running in Node.js. Without it, PDFs using standard fonts (Helvetica, Times, Courier, etc.) throw:
UnknownErrorException: Ensure that the standardFontDataUrl API
parameter is provided.
Resolve the standard_fonts directory within the pdfjs-dist package at runtime and pass it to getDocument(). Also update the type declaration to include standardFontDataUrl and useSystemFonts parameters.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the PDF extraction path to pass `standardFontDataUrl` into `pdfjs-dist`’s `getDocument()` call, resolving the `standard_fonts` directory at runtime so Node.js can load bundled standard font files. It also extends the local `pdfjs-dist/legacy/build/pdf.mjs` type declaration to include `standardFontDataUrl` and `useSystemFonts` options.
The change lives in `src/media/input-files.ts`’s `extractPdfContent()` path and is intended to prevent runtime failures when parsing PDFs that rely on standard fonts (Helvetica/Times/Courier) under Node.js.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge once the Windows path/URL handling for `standardFontDataUrl` is corrected.
- The change is small and scoped, but the current construction of `standardFontDataUrl` can produce mixed path separators on Windows, which can break pdfjs’s standard font loading in Node environments.
- src/media/input-files.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#17286: fix(media): PDF attachments embedded as raw binary instead of extra...
by yinghaosang · 2026-02-15
70.1%
#8988: fix: resolve security vulnerabilities in dependencies
by fotorpics · 2026-02-04
66.9%
#13848: fix(test): normalize paths in source-display test for windows
by gengmao · 2026-02-11
66.7%
#11979: fix: Change rootDir to project root to allow UI compilation
by fastroc · 2026-02-08
66.7%
#11443: LINE: fix buffer guards in detectContentType + add tests
by MdRahmatUllah · 2026-02-07
65.9%
#6819: fix(tui): handle unstructured tool results and errors in tool execu...
by TreyDong · 2026-02-02
65.9%
#12804: fix(daemon): use wrapper script for pnpm global installs in service...
by odinho · 2026-02-09
65.6%
#11951: Prepending Windows Node to PATH didn’t help
by tranhoangtu-it · 2026-02-08
65.5%
#17686: fix(memory): support non-ASCII characters in FTS query tokenization
by Phineas1500 · 2026-02-16
64.9%
#3973: fix: enhance npm package integrity checks and include critical files
by YeSuX · 2026-01-29
64.8%