diff --git a/Required-Browser-Features.md b/Required-Browser-Features.md new file mode 100644 index 0000000..5c86e4a --- /dev/null +++ b/Required-Browser-Features.md @@ -0,0 +1,153 @@ +# Required Browser Features + +## CANVAS element is present + +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. + + +## get-literal properties + +The core library defines property using 'get' literal. +Browsers that don't understand this syntax will not be able to execute the code. + + +## addEventListener is present + +The `addEventListener` method for DOM elements is used to bind event listeners. +No emulation of the `addEventListener` method is provided in browsers that do not support it. + + +## Typed arrays are present + +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` and `byteLength` are similated. The `subarray` just clones the array. +The Uint8Array also has the `set` method. + + +If the `Float32Array` native implementation exists, then it will be used instead of `Float64Array`. + + +## Object.create() is present + +The `Object.create` method will be added to the `Object` function if native implementation is absent. + + +## Object.defineProperty() is present + + +The `Object.defineProperty` method will be added to the `Object` function if native implementation is absent. The `__defineGetter__` / `__defineSetter__` will be used instead. + + +## Object.defineProperty() can be used with DOM objects + +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](#Object-defineProperty)". + + +## Defined via get-literal properties can be redefined + +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](#Object-defineProperty)". + + +## Object.keys() is present + +The `Object.keys` method will be added to the `Object` function if the native implementation is absent. + + +## FileReader is present + +The live PDF.js demo will not be able to read local file. + + +## FileReader.prototype.readAsArrayBuffer() is present + +Older browsers has no `readAsArrayBuffer` method implementation: the `readAsBinaryString` will be used instead. + + +## XMLHttpRequest.prototype.overrideMimeType() is present + +The empty `overrideMimeType` method will be added to the `XMLHttpRequest.prototype`, if the browser does not support it. + + +## XMLHttpRequest.prototype.response is present + +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. + + +## btoa() is present + +The `btoa` will be added to the window object, if the browser does not support it. + + +## Function.prototype.bind is present + +The `bind` method will be added to the `Function.prototype`, if the browser does not support it. + + +## dataset is present for HTML element + +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 test selection layer) +attached to specific HTML DOM element. + + +## classList is present for HTML 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. + + +## console object is present + +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. + + +## console.log is a bind-able function + +The `console.log` and `.error` functions will be replaced, if the browser does not allow to use +the bind method with these functions. + + +## navigator.language is present + +The language getter will be added to the window.navigator object, if the browser does not support it. + + +## evenodd fill rule is supported + +Some PDF content is using "even-odd" fill rule/method. The content will not be displayed +properly if this function is not supported. + +## dashed lined is supported + +Some PDF content is using custom dash line styles. The content will not be displayed +properly if this function is not supported. + + +## @font-face is supported/enabled + +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. + + +## @font-face data URLs are loaded synchronously + +The PDF.js shall wait some time before using fonts with CANVAS, +if the browser cannot load custom fonts via `@font-face`, that are specified as data URLs, synchronously. + + +## Worker is supported/enabled + +The PDF.js will execute all code (even long running) on the main thread, +if the browser does not support web workers. + +## Worker can receive/send typed arrays + +The PDF.js will execute all code on the main thread, +if the browser cannot send (large) typed arrayed to web workers. +