@pixldocs/canvas-renderer 0.5.198 → 0.5.200

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jspdf = require("jspdf");
4
4
  const svg2pdf_js = require("svg2pdf.js");
5
5
  const fabric = require("fabric");
6
- const index = require("./index-CM6Bzcyx.cjs");
6
+ const index = require("./index-B0b3u83I.cjs");
7
7
  const pdfFonts = require("./pdfFonts-BTj2f465.cjs");
8
8
  function _interopNamespaceDefault(e) {
9
9
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -119,7 +119,9 @@ async function bakeEdgeFadeIntoDataUrl(dataUrl, element) {
119
119
  return await new Promise((resolve) => {
120
120
  try {
121
121
  const img = new Image();
122
- img.crossOrigin = "anonymous";
122
+ if (!dataUrl.startsWith("data:") && !dataUrl.startsWith("blob:")) {
123
+ img.crossOrigin = "anonymous";
124
+ }
123
125
  img.onload = () => {
124
126
  try {
125
127
  const c = index.bakeEdgeFade(img, fade);
@@ -2571,7 +2573,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2571
2573
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2572
2574
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2573
2575
  try {
2574
- const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-CM6Bzcyx.cjs")).then((n) => n.canvasImageLoader);
2576
+ const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-B0b3u83I.cjs")).then((n) => n.canvasImageLoader);
2575
2577
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2576
2578
  } catch {
2577
2579
  return null;
@@ -3362,7 +3364,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3362
3364
  }
3363
3365
  let fetchUrl = imageUrl;
3364
3366
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3365
- const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-CM6Bzcyx.cjs")).then((n) => n.canvasImageLoader);
3367
+ const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-B0b3u83I.cjs")).then((n) => n.canvasImageLoader);
3366
3368
  if (isPrivateUrl(imageUrl)) return null;
3367
3369
  const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
3368
3370
  proxyUrl.searchParams.set("url", imageUrl);
@@ -4980,7 +4982,7 @@ function getExpectedRasterImageIdsForPdfPage(page) {
4980
4982
  }
4981
4983
  async function exportMultiPagePdf(pages, options) {
4982
4984
  var _a, _b, _c, _d, _e;
4983
- const { filename = "document.pdf", title, watermark = false, returnBlob = false, pdfTextMode = "selectable", skipLiveCanvasSvgFastPath = false } = options;
4985
+ const { filename = "document.pdf", title, watermark = false, returnBlob = false, pdfTextMode = "selectable", skipLiveCanvasSvgFastPath = false, useLiveCanvasObjectPdfPath = false } = options;
4984
4986
  pdfFonts.resetPdfFontRegistry();
4985
4987
  if (pages.length === 0) {
4986
4988
  throw new Error("No pages to export");
@@ -5124,9 +5126,9 @@ async function exportMultiPagePdf(pages, options) {
5124
5126
  }
5125
5127
  }
5126
5128
  const liveCanvasForPage = page.pageId ? index.getCanvasForPage(page.pageId) : null;
5127
- let allowLiveCanvasFallback = !!liveCanvasForPage && !skipLiveCanvasSvgFastPath;
5129
+ let allowLiveCanvasFallback = !!liveCanvasForPage && (useLiveCanvasObjectPdfPath || !skipLiveCanvasSvgFastPath);
5128
5130
  const expectedRasterImageIds = getExpectedRasterImageIdsForPdfPage(page);
5129
- if (liveCanvasForPage && !skipLiveCanvasSvgFastPath) {
5131
+ if (liveCanvasForPage && !skipLiveCanvasSvgFastPath && !useLiveCanvasObjectPdfPath) {
5130
5132
  try {
5131
5133
  const liveSvgString = index.captureFabricCanvasSvgForPdf(
5132
5134
  liveCanvasForPage,
@@ -5369,4 +5371,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
5369
5371
  exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
5370
5372
  exports.preparePagesForExport = preparePagesForExport;
5371
5373
  exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
5372
- //# sourceMappingURL=vectorPdfExport-CBUSNaeP.cjs.map
5374
+ //# sourceMappingURL=vectorPdfExport-CV6GxECJ.cjs.map