Interface PDFJSStatic

Index

Properties

Methods

Properties

public 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.

public 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.

Methods

public getDocument(source: string, pdfDataRangeTransport?: any, passwordCallback?: (fn: (password: string) => void, reason: string) => string, progressCallback?: (progressData: PDFProgressData) => void): PDFPromise

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 corss domain requests without CORS.

Parameters

  • source: string
  • pdfDataRangeTransport?: any optional

    Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface.

  • passwordCallback?: (fn: (password: string) => void, reason: string) => string optional

    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 the reason.

  • progressCallback?: (progressData: PDFProgressData) => void optional

    Progress callback.

Returns

PDFPromise

A promise that is resolved with PDFDocumentProxy object.

public getDocument(source: Uint8Array, pdfDataRangeTransport?: any, passwordCallback?: (fn: (password: string) => void, reason: string) => string, progressCallback?: (progressData: PDFProgressData) => void): PDFPromise

Parameters

  • source: Uint8Array
  • pdfDataRangeTransport?: any optional
  • passwordCallback?: (fn: (password: string) => void, reason: string) => string optional
  • progressCallback?: (progressData: PDFProgressData) => void optional

Returns

PDFPromise

public getDocument(source: PDFSource, pdfDataRangeTransport?: any, passwordCallback?: (fn: (password: string) => void, reason: string) => string, progressCallback?: (progressData: PDFProgressData) => void): PDFPromise

Parameters

  • source: PDFSource
  • pdfDataRangeTransport?: any optional
  • passwordCallback?: (fn: (password: string) => void, reason: string) => string optional
  • progressCallback?: (progressData: PDFProgressData) => void optional

Returns

PDFPromise