Skip to content

PDFiumInitOptions

@scaryterry/pdfium


Defined in: src/core/types.ts:268

Options for initialising the PDFium library.

readonly optional forceWasm: boolean

Defined in: src/core/types.ts:309

Force WASM backend even when native addon is available.

When true, native addon loading is skipped entirely. Useful for:

  • Testing/debugging the WASM code path
  • Ensuring consistent behaviour across environments
  • Benchmarking WASM without native interference

Cannot be used with useNative: true (throws InitialisationError).

Default: false.


readonly optional limits: PDFiumLimits

Defined in: src/core/types.ts:311

Resource limits for security and stability


readonly optional logger: Logger

Defined in: src/core/types.ts:313

Custom logger instance.


readonly optional useNative: boolean

Defined in: src/core/types.ts:296

Try to use the native PDFium binding instead of WASM (Node.js only).

When true, PDFium.init() will attempt to load the platform-specific native addon. If unavailable, it falls back to WASM transparently.

Default: false (WASM is used unless explicitly opted in).


readonly optional useWorker: boolean

Defined in: src/core/types.ts:279

Enable high-level worker mode for off-main-thread processing.

When true, PDFium.init() returns a worker-backed instance that exposes ergonomic document/page APIs without manual worker protocol management.


readonly optional wasmBinary: ArrayBuffer

Defined in: src/core/types.ts:272

Pre-loaded WASM binary


readonly optional wasmUrl: string

Defined in: src/core/types.ts:270

Path or URL to the WASM binary


readonly optional workerDestroyTimeout: number

Defined in: src/core/types.ts:287

Worker destroy timeout in milliseconds (default: 5000).


readonly optional workerRenderTimeout: number

Defined in: src/core/types.ts:285

Worker render timeout in milliseconds (default: 120000).


readonly optional workerTimeout: number

Defined in: src/core/types.ts:283

Worker request timeout in milliseconds (default: 30000).


readonly optional workerUrl: string | URL

Defined in: src/core/types.ts:281

Custom worker script URL (only if useWorker is true).