Pdf Js Config 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
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
loader | () => Promise<module> | () => import('pdfjs-dist') | No | Returns the pdfjs-dist module, e.g. () => import('pdfjs-dist/legacy/build/pdf.mjs') for older browsers. |
workerSrc | string | the jsDelivr worker for the installed version | No | Worker script URL. A worker you set on GlobalWorkerOptions yourself is respected. |
workerPort | Worker | — | No | A ready Worker running the PDF.js worker; takes precedence over workerSrc. |
cMapUrl | string | jsDelivr cmaps/ for the installed version | No | CMap files, trailing slash. |
cMapPacked | boolean | true | No | Whether the CMaps are packed. |
standardFontDataUrl | string | jsDelivr standard_fonts/ for the installed version | No | Standard font data, trailing slash. |
wasmUrl | string | jsDelivr wasm/ for the installed version | No | WebAssembly image decoders, trailing slash. |
iccUrl | string | jsDelivr iccs/ for the installed version | No | ICC color profiles, trailing slash. |
isEvalSupported | boolean | false | No | Forwarded 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.