-
Notifications
You must be signed in to change notification settings - Fork 3
Required Browser Features
The page describes the features that are required for a web browser to have to PDF.js function properly. Some of the features are critical and does not let PDF.js function properly if they are not supported or disabled. Some of them can be emulated if absent (e.g. in the compatibility.js file), however the PDF.js performance and memory usage will be worse than when the feature is present.
The required features tests can be run at http://mozilla.github.com/pdf.js/features/
Support of the CANVAS element and 2D context is required feature for PDF.js. No emulation of the CANVAS element is provided in browsers that do not support it.
The core library defines object properties using object 'get' literal:
var obj = {
get prop() { return 1; }
};
Browsers that don't understand this syntax will not be able to execute the code.
The addEventListener
method is used to bind event listeners for DOM elements.
No emulation of the addEventListener
method is provided in browsers that do not support it.
The Uint8Array
, Uint16Array
, Int32Array
, Float32Array
and Float64Array
will be replaced
by the artificial TypedArray object if those types are not implemented natively.
Only subarray
, buffer
, set
and byteLength
are similated. The subarray
just clones the array. The set
method is provided to emulate the Uint8Array
's set
method. The emulated typed arrays are slower, don't truncate the items to specific data types and they are memory inefficient.
If the Float32Array
native implementation exists and the Float64Array
is absent, then the Float32Array
will be used instead of Float64Array
.
The Object.create
method will be added to the Object
function if the native implementation is absent.
The Object.defineProperty
method will be added to the Object
function if the native implementation is absent. The __defineGetter__
/ __defineSetter__
will be used instead.
Some browsers do not allow using the Object.defineProperty
with DOM objects.
In this case, the Object.defineProperty
be replaced by the artificial one. See Object.defineProperty() is present.
Some browsers does not allow redefine properties defined with get literal by the Object.defineProperty
.
In this case, the Object.defineProperty
be replaced by the artificial one. See Object.defineProperty() is present.
The Object.keys
method will be added to the Object
function if the native implementation is absent.
The FileReader
allows PDF.js read the file data provided in the input[type=file] HTML element. The live PDF.js demo will not be able to read local file, if the FileReader
object is not supported.
Older browsers has no readAsArrayBuffer
method implementation: the readAsBinaryString
will be used to emulate its functionality.
The empty overrideMimeType
method will be added to the XMLHttpRequest.prototype
, if the browser does not support it.
The response
getter will be added to the XMLHttpRequest.prototype
, if the browser does not support it.
This is important for retrieving the binary PDF data using XHR.
The btoa
will be added to the window object, if the browser does not support it.
The bind
method will be added to the Function.prototype
, if the browser does not support it.
The dataset
property will be added to the HTMLElement.prototype
, if the browser does not support it.
This is important for specifying addition information (e.g. for text selection layer)
attached to specific HTML DOM element.
The classList
property will be added to the HTMLElement.prototype
, if the browser does not support it.
This is important to simplify the viewer implementation.
The console
object will be added to the window object with empty log
and error
methods,
if the browser does not support it. This is important for output of the error message and diagnostic information.
The console.log
and console.error
functions will be replaced, if the browser does not allow to use
the bind method with these functions.
The core code relies on the Function.prototype.apply
method to accept the typed array as the second argument.
No emulation is provided in browsers that do not support it.
The language getter will be added to the window.navigator object, if the browser does not support it.
Some PDF content is using "even-odd" fill rule/method. The content will not be displayed properly if this feature is not supported.
Some PDF content is using custom dash line styles. The content will not be displayed properly if this feature is not supported.
Most of PDF documents are using embedded fonts. If the browser does not support @font-face
style rule, the document will not be displayed property.
The PDF.js shall wait some time before using fonts with CANVAS,
if the browser cannot load custom fonts synchronously via @font-face
that are specified as data URLs.
The PDF.js will execute all code (even long running) on the main thread, if the browser does not support web workers.
The PDF.js will execute all code on the main thread, if the browser cannot send (large) typed arrays to web workers.