new PDFJS()
PDFJS scope object that contains all functions, objects and variables related
to the PDF.js.
- Source:
Classes
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.
Type:
- boolean
- Source:
-
(static) disableCreateObjectURL :boolean
-
Disables URL.createObjectURL usage.
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) 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) 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) 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(source, pdfDataRangeTransport, passwordCallback) → {Promise}
-
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 source
string | TypedArray | DocumentInitParameters Can be a url to where a PDF is located, a typed array (Uint8Array) already populated with data or parameter object. pdfDataRangeTransport
Object is optional. It is used if you want to manually serve range requests for data in the PDF. See viewer.js for an example of pdfDataRangeTransport's interface. passwordCallback
function is optional. 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}). - Source:
Returns:
A promise that is resolved with PDFDocumentProxy object.- Type
- Promise