mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
[api-minor] Add an option to set the max canvas area
This commit is contained in:
parent
e0d934ac9d
commit
e9474f1c84
5 changed files with 35 additions and 3 deletions
|
@ -201,6 +201,9 @@ if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) {
|
|||
* `OffscreenCanvas` in the worker. Primarily used to improve performance of
|
||||
* image conversion/rendering.
|
||||
* The default value is `true` in web environments and `false` in Node.js.
|
||||
* @property {boolean} [canvasMaxAreaInBytes] - The integer value is used to
|
||||
* know when an image must be resized (uses `OffscreenCanvas` in the worker).
|
||||
* If it's -1 then a possibly slow algorithm is used to guess the max value.
|
||||
* @property {boolean} [disableFontFace] - By default fonts are converted to
|
||||
* OpenType fonts and loaded via the Font Loading API or `@font-face` rules.
|
||||
* If disabled, fonts will be rendered using a built-in font renderer that
|
||||
|
@ -306,6 +309,9 @@ function getDocument(src) {
|
|||
typeof src.isOffscreenCanvasSupported === "boolean"
|
||||
? src.isOffscreenCanvasSupported
|
||||
: !isNodeJS;
|
||||
const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes)
|
||||
? src.canvasMaxAreaInBytes
|
||||
: -1;
|
||||
const disableFontFace =
|
||||
typeof src.disableFontFace === "boolean" ? src.disableFontFace : isNodeJS;
|
||||
const fontExtraProperties = src.fontExtraProperties === true;
|
||||
|
@ -393,6 +399,7 @@ function getDocument(src) {
|
|||
ignoreErrors,
|
||||
isEvalSupported,
|
||||
isOffscreenCanvasSupported,
|
||||
canvasMaxAreaInBytes,
|
||||
fontExtraProperties,
|
||||
useSystemFonts,
|
||||
cMapUrl: useWorkerFetch ? cMapUrl : null,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue