[api-minor] Use the NodeCanvasFactory/NodeCMapReaderFactory classes as defaults in Node.js environments (issue 11900)

This moves, and slightly simplifies, code that's currently residing in the unit-test utils into the actual library, such that it's bundled with `GENERIC`-builds and used in e.g. the API-code.

As an added bonus, this also brings out-of-the-box support for CMaps in e.g. the Node.js examples.
This commit is contained in:
Jonas Jenwald 2020-06-29 13:18:51 +02:00
parent fe3df495cc
commit 4a7e29865d
10 changed files with 164 additions and 123 deletions

View file

@ -16,7 +16,6 @@
import {
buildGetDocumentParams,
DOMFileReaderFactory,
NodeCanvasFactory,
NodeFileReaderFactory,
TEST_PDFS_PATH,
} from "./test_utils.js";
@ -49,6 +48,7 @@ import { GlobalImageCache } from "../../src/core/image_utils.js";
import { GlobalWorkerOptions } from "../../src/display/worker_options.js";
import { isNodeJS } from "../../src/shared/is_node.js";
import { Metadata } from "../../src/display/metadata.js";
import { NodeCanvasFactory } from "../../src/display/node_utils.js";
describe("api", function () {
const basicApiFileName = "basicapi.pdf";