Skip to content
React PDF Viewer

Search

PdfJsConfig reference

Global PDF.js configuration shared by every viewer: how the module is loaded, the worker, and the URLs of its assets.

Every field is optional. Unset asset URLs default to the jsDelivr CDN copy of the exact installed pdfjs-dist version; self-host them for production, as described in PDF.js configuration.

Used by

Import

import type { PdfJsConfig } from '@kingtech/react-pdf-viewer';

Properties

NameTypeDefaultRequiredDescription
loader() => Promise<module>() => import('pdfjs-dist')NoReturns the pdfjs-dist module, e.g. () => import('pdfjs-dist/legacy/build/pdf.mjs') for older browsers.
workerSrcstringthe jsDelivr worker for the installed versionNoWorker script URL. A worker you set on GlobalWorkerOptions yourself is respected.
workerPortWorker—NoA ready Worker running the PDF.js worker; takes precedence over workerSrc.
cMapUrlstringjsDelivr cmaps/ for the installed versionNoCMap files, trailing slash.
cMapPackedbooleantrueNoWhether the CMaps are packed.
standardFontDataUrlstringjsDelivr standard_fonts/ for the installed versionNoStandard font data, trailing slash.
wasmUrlstringjsDelivr wasm/ for the installed versionNoWebAssembly image decoders, trailing slash.
iccUrlstringjsDelivr iccs/ for the installed versionNoICC color profiles, trailing slash.
isEvalSupportedbooleanfalseNoForwarded to getDocument; kept false as defense in depth (CVE-2024-4367).

Source

packages/react-pdf-viewer/src/core/pdfjs.ts

Generated from content/react-pdf-viewer/reference/pdf-js-config.schema.json. Do not edit by hand.