Skip to content
React PDF Viewer

Search

configurePdfJs 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

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/configure-pdf-js.schema.json. Do not edit by hand.