Originally created by: yablokolabs
os.fs.read_document can extract PDF text successfully while pdfjs-dist emits optional Canvas/DOM polyfill warnings in a runtime where optional canvas support is absent, including packaged/SEA-style deployments. The warnings look like extraction failures even though Atomic deliberately does not render fonts, images, or graphics.
This is finding §15 from Yabloko Labs' evaluation.
The extractor dynamically imports the pdfjs legacy build and deliberately uses text-only settings:
pdf-extractor.ts (github.com)pdf-extractor.ts (github.com)verbosity: 0 is passed to getDocument, but optional-dependency warnings are emitted during module import, before that per-document setting applies. With pdfjs-dist@4.10.38 and @napi-rs/canvas unavailable, the warning family is:
Warning: Cannot load "@napi-rs/canvas" package: ...
Warning: Cannot polyfill `DOMMatrix`, rendering may be broken.
Warning: Cannot polyfill `ImageData`, rendering may be broken.
Warning: Cannot polyfill `Path2D`, rendering may be broken.
A normal npm installation may include the optional canvas package and hide the symptom. The relevant regression environments are a fresh install with optional dependencies omitted and the packaged SEA/bundle where the native optional package is not shipped.
The tool already has a structured warnings field for genuine page-extraction problems:
pdf-extractor.ts (github.com)Provide a quiet text-only loading path that avoids these known, non-actionable rendering warnings when canvas support is absent. Do not require a native canvas package just to extract glyph text, and do not hide genuine parse or page-extraction errors.
The implementation must not intercept or replace process-global console methods; that is unsafe under concurrent reads and can hide unrelated diagnostics.
@napi-rs/canvas—for example npm ci --omit=optional or the actual SEA bundle—and fails on the current warning strings above.@napi-rs/canvas when only text is requested.details.warnings.console interception is prohibited.