Skip to content

There are dozens of options in PDF.js, and they all belong to four kinds for now. You may wonder why there are so many options, and what they mean at the first time. This document will help you to understand them.

Let's crack on them one by one!

Option Kinds

  • VIEWER
  • API
  • WORKER
  • PREFERENCE

Important options

  • defaultUrl
  • locale
  • workerSrc

defaultUrl

  • Type URL | string | Uint8Array

The url of the PDF file. If you got CORS issue when loading a PDF file from a different origin, see details at origin match error section in common pitfalls page .

locale

  • Type string
  • Default en-US

The locale of the viewer, it easy to switch a different locale by setting this option. See all supported locales in folder l10n.

workerSrc

The url of the PDF.js web worker bundle.

The PDF.js project use web worker to speed up the rendering process, it means there must be some code creating and initializing the web worker using the workerSrc. It configured with default value, but it always depends on how you deploy it. Make sure you can download the worker bundle from the workerSrc url.

Worker Request

Other options

textLayerMode

The textLayerMode of text layer.

Last updated: