@yudaocode/univer-pdfs 1.6.204 → 1.6.205

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.
package/lib/cjs/index.js CHANGED
@@ -8538,10 +8538,13 @@ async function tryExtractViaPdfjsFallback(pdfBytes, pageIds) {
8538
8538
  }
8539
8539
  if (!pdfjsLib || typeof pdfjsLib.getDocument !== "function") return null;
8540
8540
  try {
8541
+ const globalAssets = globalThis?.__YUDAO_UNIVER_PDFJS_ASSETS__;
8541
8542
  const loadingTask = pdfjsLib.getDocument({
8542
8543
  data: pdfBytes.slice(),
8543
8544
  disableWorker: true,
8544
- isEvalSupported: false
8545
+ isEvalSupported: false,
8546
+ ...globalAssets?.cMapUrl ? { cMapUrl: globalAssets.cMapUrl, cMapPacked: globalAssets.cMapPacked ?? true } : {},
8547
+ ...globalAssets?.standardFontDataUrl ? { standardFontDataUrl: globalAssets.standardFontDataUrl } : {}
8545
8548
  });
8546
8549
  const pdfDoc = await loadingTask.promise;
8547
8550
  const out = {};
@@ -20390,10 +20393,13 @@ async function renderPdfBytesToImages(pdfBytes, options) {
20390
20393
  const pdfjsLib = await import("pdfjs-dist");
20391
20394
  const getDoc = pdfjsLib?.getDocument ?? pdfjsLib?.default?.getDocument;
20392
20395
  if (typeof getDoc === "function") {
20396
+ const globalAssets = globalThis?.__YUDAO_UNIVER_PDFJS_ASSETS__;
20393
20397
  const loadingTask = getDoc({
20394
20398
  data: pdfBytes.slice(),
20395
20399
  disableWorker: true,
20396
- isEvalSupported: false
20400
+ isEvalSupported: false,
20401
+ ...globalAssets?.cMapUrl ? { cMapUrl: globalAssets.cMapUrl, cMapPacked: globalAssets.cMapPacked ?? true } : {},
20402
+ ...globalAssets?.standardFontDataUrl ? { standardFontDataUrl: globalAssets.standardFontDataUrl } : {}
20397
20403
  });
20398
20404
  const pdfJsDoc = await loadingTask.promise;
20399
20405
  try {
@@ -22398,11 +22404,14 @@ async function importPdfSource(source, options) {
22398
22404
  pdfjsLib = await import("pdfjs-dist").catch(() => null);
22399
22405
  }
22400
22406
  if (pdfjsLib && typeof pdfjsLib.getDocument === "function") {
22407
+ const globalAssets = globalThis?.__YUDAO_UNIVER_PDFJS_ASSETS__;
22401
22408
  const task = pdfjsLib.getDocument({
22402
22409
  data: bytes.slice(),
22403
22410
  password: options.password,
22404
22411
  disableWorker: true,
22405
- isEvalSupported: false
22412
+ isEvalSupported: false,
22413
+ ...globalAssets?.cMapUrl ? { cMapUrl: globalAssets.cMapUrl, cMapPacked: globalAssets.cMapPacked ?? true } : {},
22414
+ ...globalAssets?.standardFontDataUrl ? { standardFontDataUrl: globalAssets.standardFontDataUrl } : {}
22406
22415
  });
22407
22416
  const pdfDoc = await task.promise;
22408
22417
  try {