configure Pdf Js reference
Configures PDF.js for every viewer instance. Call it once at startup, before the first viewer mounts. Calls merge with previous configuration.
Used by
Import
import { configurePdfJs } from '@kingtech/react-pdf-viewer';Signature: configurePdfJs(next: PdfJsConfig): void → void
Options
| 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/configure-pdf-js.schema.json. Do not edit by hand.