Class: PDFJS

PDFJS

new PDFJS()

PDFJS scope object that contains all functions, objects and variables related to the PDF.js.
Source:

Classes

PageViewport

Members

(static) cMapPacked :boolean

Specifies if CMaps are binary packed.
Type:
  • boolean
Source:

(static) cMapUrl :string

The url of where the predefined Adobe CMaps are located. Include trailing slash.
Type:
  • string
Source:

(static) disableAutoFetch :boolean

Disable pre-fetching of PDF file data. When range requests are enabled PDF.js will automatically keep fetching more data even if it isn't needed to display the current page. This default behavior can be disabled. NOTE: It is also necessary to disable streaming, see above, in order for disabling of pre-fetching to work correctly.
Type:
  • boolean
Source:

(static) disableCreateObjectURL :boolean

Disables URL.createObjectURL usage.
Type:
  • boolean
Source:

(static) disableFontFace :boolean

By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands.
Type:
  • boolean
Source:

(static) disableFullscreen :boolean

Disables fullscreen support, and by extension Presentation Mode, in browsers which support the fullscreen API.
Type:
  • boolean
Source:

(static) disableRange :boolean

Disable range request loading of PDF files. When enabled and if the server supports partial content requests then the PDF will be fetched in chunks. Enabled (false) by default.
Type:
  • boolean
Source:

(static) disableStream :boolean

Disable streaming of PDF file data. By default PDF.js attempts to load PDF in chunks. This default behavior can be disabled.
Type:
  • boolean
Source:

(static) disableWebGL :boolean

Disables WebGL usage.
Type:
  • boolean
Source:

(static) disableWorker :boolean

Disable the web worker and run all code on the main thread. This will happen automatically if the browser doesn't support workers or sending typed arrays to workers.
Type:
  • boolean
Source:

(static) imageResourcesPath :string

Path for image resources, mainly for annotation icons. Include trailing slash.
Type:
  • string
Source:

(static) isEvalSupported :boolean

Determines if we can eval strings as JS. Primarily used to improve performance for font rendering.
Type:
  • boolean
Source:

(static) maxCanvasPixels :number

The maximum supported canvas size in total pixels e.g. width * height. The default value is 4096 * 4096. Use -1 for no limit.
Type:
  • number
Source:

(static) maxImageSize :number

The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit.
Type:
  • number
Source:

(static) openExternalLinksInNewWindow :boolean

Opens external links in a new window if enabled. The default behavior opens external links in the PDF.js window.
Type:
  • boolean
Source:

(static) pdfBug :boolean

Enables special hooks for debugging PDF.js.
Type:
  • boolean
Source:

(static) postMessageTransfers :boolean

Enables transfer usage in postMessage for ArrayBuffers.
Type:
  • boolean
Source:

(static) useOnlyCssZoom :boolean

Enables CSS only zooming.
Type:
  • boolean
Source:

(static) verbosity :number

Controls the logging level. The constants from PDFJS.VERBOSITY_LEVELS should be used: - errors - warnings [default] - infos
Type:
  • number
Source:

(static) workerSrc :string

Path and filename of the worker file. Required when the worker is enabled in development mode. If unspecified in the production build, the worker will be loaded based on the location of the pdf.js file.
Type:
  • string
Source:

Methods

(static) createPromiseCapability() → {PromiseCapability}

Creates a promise capability object.
Source:
Returns:
A capability object contains: - a Promise, resolve and reject methods.
Type
PromiseCapability

(static) getDocument(src, pdfDataRangeTransport, passwordCallback, progressCallback) → {PDFDocumentLoadingTask}

This is the main entry point for loading a PDF and interacting with it. NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) is used, which means it must follow the same origin rules that any XHR does e.g. No cross domain requests without CORS.
Parameters:
Name Type Description
src string | TypedArray | DocumentInitParameters | PDFDataRangeTransport Can be a url to where a PDF is located, a typed array (Uint8Array) already populated with data or parameter object.
pdfDataRangeTransport PDFDataRangeTransport (deprecated) It is used if you want to manually serve range requests for data in the PDF.
passwordCallback function (deprecated) It is used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and reason (see {PasswordResponses}).
progressCallback function (deprecated) It is used to be able to monitor the loading progress of the PDF file (necessary to implement e.g. a loading bar). The callback receives an {Object} with the properties: {number} loaded and {number} total.
Source:
Returns:
Type
PDFDocumentLoadingTask