@chialab/pdfjs-lib 1.0.0-alpha.10 → 1.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11418,7 +11418,7 @@ function getDocument(src = {}) {
11418
11418
  const standardFontDataUrl = getFactoryUrlProp(src.standardFontDataUrl);
11419
11419
  const StandardFontDataFactory2 = src.StandardFontDataFactory || (isNodeJS ? NodeStandardFontDataFactory : DOMStandardFontDataFactory);
11420
11420
  const wasmUrl = getFactoryUrlProp(src.wasmUrl);
11421
- const WasmFactory = src.WasmFactory || (isNodeJS ? NodeWasmFactory : DOMWasmFactory);
11421
+ const WasmFactory2 = src.WasmFactory || (isNodeJS ? NodeWasmFactory : DOMWasmFactory);
11422
11422
  const ignoreErrors = src.stopAtErrors !== true;
11423
11423
  const maxImageSize = Number.isInteger(src.maxImageSize) && src.maxImageSize > -1 ? src.maxImageSize : -1;
11424
11424
  const isEvalSupported = src.isEvalSupported !== false;
@@ -11445,7 +11445,7 @@ function getDocument(src = {}) {
11445
11445
  const useWasm = src.useWasm !== false;
11446
11446
  const length = rangeTransport ? rangeTransport.length : src.length ?? NaN;
11447
11447
  const useSystemFonts = typeof src.useSystemFonts === "boolean" ? src.useSystemFonts : !isNodeJS && !disableFontFace;
11448
- const useWorkerFetch = typeof src.useWorkerFetch === "boolean" ? src.useWorkerFetch : !!(CMapReaderFactory === DOMCMapReaderFactory && StandardFontDataFactory2 === DOMStandardFontDataFactory && WasmFactory === DOMWasmFactory && cMapUrl && standardFontDataUrl && wasmUrl && isValidFetchUrl(cMapUrl, document.baseURI) && isValidFetchUrl(standardFontDataUrl, document.baseURI) && isValidFetchUrl(wasmUrl, document.baseURI));
11448
+ const useWorkerFetch = typeof src.useWorkerFetch === "boolean" ? src.useWorkerFetch : !!(CMapReaderFactory === DOMCMapReaderFactory && StandardFontDataFactory2 === DOMStandardFontDataFactory && WasmFactory2 === DOMWasmFactory && cMapUrl && standardFontDataUrl && wasmUrl && isValidFetchUrl(cMapUrl, document.baseURI) && isValidFetchUrl(standardFontDataUrl, document.baseURI) && isValidFetchUrl(wasmUrl, document.baseURI));
11449
11449
  const styleElement = false ? src.styleElement : null;
11450
11450
  setVerbosityLevel(verbosity);
11451
11451
  const transportFactory = {
@@ -11453,7 +11453,7 @@ function getDocument(src = {}) {
11453
11453
  filterFactory: new FilterFactory({ docId, ownerDocument }),
11454
11454
  cMapReaderFactory: useWorkerFetch ? null : new CMapReaderFactory({ baseUrl: cMapUrl, isCompressed: cMapPacked }),
11455
11455
  standardFontDataFactory: useWorkerFetch ? null : new StandardFontDataFactory2({ baseUrl: standardFontDataUrl }),
11456
- wasmFactory: useWorkerFetch ? null : new WasmFactory({ baseUrl: wasmUrl })
11456
+ wasmFactory: useWorkerFetch ? null : new WasmFactory2({ baseUrl: wasmUrl })
11457
11457
  };
11458
11458
  if (!worker) {
11459
11459
  const workerParams = {
@@ -25523,6 +25523,23 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
25523
25523
  return makeSerializable(annotations);
25524
25524
  };
25525
25525
 
25526
+ // src/lib/WasmFactory.ts
25527
+ var WasmFactory = class {
25528
+ async fetch({ filename }) {
25529
+ switch (filename) {
25530
+ case "openjpeg.wasm":
25531
+ return import("./openjpeg-NLAGCGEG.js").then(
25532
+ (module) => module.default
25533
+ );
25534
+ case "qcms_bg":
25535
+ return import("./qcms_bg-EPYCMBVV.js").then(
25536
+ (module) => module.default
25537
+ );
25538
+ }
25539
+ return Uint8Array.from([]);
25540
+ }
25541
+ };
25542
+
25526
25543
  // src/lib/StandardFontDataFactory.ts
25527
25544
  var StandardFontDataFactory = class extends BaseStandardFontDataFactory {
25528
25545
  constructor() {
@@ -25714,7 +25731,11 @@ async function createTextLayer(page, {
25714
25731
  let canvasContext = null;
25715
25732
  let container = rootContainer;
25716
25733
  const getObject = (data) => {
25717
- return data.startsWith("g_") ? commonObjs.get(data) : objs.get(data);
25734
+ try {
25735
+ return data.startsWith("g_") ? commonObjs.get(data) : objs.get(data);
25736
+ } catch {
25737
+ return null;
25738
+ }
25718
25739
  };
25719
25740
  const processItems = async (items, lang) => {
25720
25741
  if (disableProcessItems) {
@@ -26024,7 +26045,7 @@ async function createTextLayer(page, {
26024
26045
  return;
26025
26046
  }
26026
26047
  const imgData = getObject(imageId);
26027
- if (!imgData.bitmap && !imgData.data) {
26048
+ if (!imgData?.bitmap && !imgData?.data) {
26028
26049
  return;
26029
26050
  }
26030
26051
  const { context } = await canvasFactory.create(
@@ -26173,6 +26194,7 @@ export {
26173
26194
  TouchManager,
26174
26195
  Util,
26175
26196
  VerbosityLevel,
26197
+ WasmFactory,
26176
26198
  XfaLayer,
26177
26199
  build,
26178
26200
  canvasToData,