mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Polyfill Path2D
in Node.js environments
Until just recently the only existing `Path2D` polyfill didn't have support for Node.js and/or the `node-canvas` package. Given that this was just fixed, in the latest version, we can now finally remove our inline-checks at the relevant call-sites; please also see https://github.com/nilzona/path2d-polyfill#usage-with-node-canvas
This commit is contained in:
parent
cb5a28ceca
commit
cf0369d622
6 changed files with 237 additions and 2462 deletions
|
@ -38,7 +38,6 @@ import {
|
|||
TilingPattern,
|
||||
} from "./pattern_helper.js";
|
||||
import { applyMaskImageData } from "../shared/image_utils.js";
|
||||
import { isNodeJS } from "../shared/is_node.js";
|
||||
|
||||
// <canvas> contexts store most of the state we need natively.
|
||||
// However, PDF needs a bit more state, which we store here.
|
||||
|
@ -55,13 +54,7 @@ const EXECUTION_TIME = 15; // ms
|
|||
const EXECUTION_STEPS = 10;
|
||||
|
||||
// To disable Type3 compilation, set the value to `-1`.
|
||||
const MAX_SIZE_TO_COMPILE =
|
||||
typeof PDFJSDev !== "undefined" &&
|
||||
PDFJSDev.test("GENERIC") &&
|
||||
isNodeJS &&
|
||||
typeof Path2D === "undefined"
|
||||
? -1
|
||||
: 1000;
|
||||
const MAX_SIZE_TO_COMPILE = 1000;
|
||||
|
||||
const FULL_CHUNK_HEIGHT = 16;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue