@pixldocs/canvas-renderer 0.5.205 → 0.5.207

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.
@@ -1,7 +1,7 @@
1
1
  import { jsPDF, ShadingPattern } from "jspdf";
2
2
  import { svg2pdf } from "svg2pdf.js";
3
3
  import * as fabric from "fabric";
4
- import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, d as bakeEdgeFade, i as isElement, e as isGroup, j as buildRoundedTrianglePath, A as API_URL, k as getImageProxyFetchOptions, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-DBuMPh9u.js";
4
+ import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, d as bakeEdgeFade, i as isElement, e as isGroup, j as buildRoundedTrianglePath, A as API_URL, k as getImageProxyFetchOptions, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-D4Dis-kD.js";
5
5
  import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-DhEaMTZl.js";
6
6
  async function embedFontsForSvg(pdf, svgStr) {
7
7
  var _a;
@@ -1285,7 +1285,7 @@ async function convertTextDecorationsToLines(svg) {
1285
1285
  return _convertTextDecorationsToLines_impl(svg);
1286
1286
  }
1287
1287
  async function bakeTextAnchorPositionsFromLiveSvg(svg) {
1288
- var _a;
1288
+ var _a, _b;
1289
1289
  if (typeof document === "undefined" || typeof window === "undefined") return;
1290
1290
  if (!svg) return;
1291
1291
  const _resolveAnchor = (el) => {
@@ -1402,6 +1402,8 @@ async function bakeTextAnchorPositionsFromLiveSvg(svg) {
1402
1402
  const srcText = srcTexts[i];
1403
1403
  const liveText = liveTexts[i];
1404
1404
  if (!liveText) continue;
1405
+ if (srcText.getAttribute("data-pixldocs-warp-shadow") === "true" && !!((_b = srcText.closest) == null ? void 0 : _b.call(srcText, "g.__pdShadowRaster"))) continue;
1406
+ if (srcText.getAttribute("data-pixldocs-warp-glyph") === "true" || srcText.getAttribute("data-pixldocs-warp-shadow") === "true") continue;
1405
1407
  const srcTspans = Array.from(srcText.querySelectorAll("tspan"));
1406
1408
  const liveTspans = Array.from(liveText.querySelectorAll("tspan"));
1407
1409
  const stripTextAnchorStyle = (node) => {
@@ -2678,7 +2680,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2678
2680
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2679
2681
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2680
2682
  try {
2681
- const { getNormalizedSvgUrl } = await import("./index-DBuMPh9u.js").then((n) => n.a6);
2683
+ const { getNormalizedSvgUrl } = await import("./index-D4Dis-kD.js").then((n) => n.a6);
2682
2684
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2683
2685
  } catch {
2684
2686
  return null;
@@ -3469,7 +3471,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3469
3471
  }
3470
3472
  let fetchUrl = imageUrl;
3471
3473
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3472
- const { isPrivateUrl } = await import("./index-DBuMPh9u.js").then((n) => n.a6);
3474
+ const { isPrivateUrl } = await import("./index-D4Dis-kD.js").then((n) => n.a6);
3473
3475
  if (isPrivateUrl(imageUrl)) return null;
3474
3476
  const proxyUrl = new URL(`${API_URL}/image-proxy`);
3475
3477
  proxyUrl.searchParams.set("url", imageUrl);
@@ -5086,7 +5088,7 @@ function getExpectedRasterImageIdsForPdfPage(page) {
5086
5088
  return [...new Set(ids)];
5087
5089
  }
5088
5090
  async function exportMultiPagePdf(pages, options) {
5089
- var _a, _b, _c, _d, _e;
5091
+ var _a, _b, _c, _d, _e, _f, _g;
5090
5092
  const { filename = "document.pdf", title, watermark = false, returnBlob = false, pdfTextMode = "selectable", skipLiveCanvasSvgFastPath = false, useLiveCanvasObjectPdfPath = false } = options;
5091
5093
  resetPdfFontRegistry();
5092
5094
  if (pages.length === 0) {
@@ -5249,7 +5251,7 @@ async function exportMultiPagePdf(pages, options) {
5249
5251
  }
5250
5252
  let preppedSvgString = liveSvgString;
5251
5253
  try {
5252
- const { prepareSvgTextForPdfMode } = await import("./svgTextToPath-BoT6H7Lz.js");
5254
+ const { prepareSvgTextForPdfMode } = await import("./svgTextToPath-Bw974R9h.js");
5253
5255
  preppedSvgString = await prepareSvgTextForPdfMode(liveSvgString, pdfTextMode);
5254
5256
  console.log("[client-pdf-export] gradient text mode", {
5255
5257
  pdfTextMode,
@@ -5280,6 +5282,33 @@ async function exportMultiPagePdf(pages, options) {
5280
5282
  );
5281
5283
  debugLog(`live canvas svg2pdf DONE #${seq} page=${pageIndex + 1}`);
5282
5284
  resetPdfColorState(pdf, `after live canvas svg2pdf page ${pageIndex + 1}`);
5285
+ try {
5286
+ for (const item of page.elements) {
5287
+ if (isGroupBackgroundDrawable(item)) continue;
5288
+ const el = item;
5289
+ const url = (_c = el.linkConfig) == null ? void 0 : _c.url;
5290
+ if (!url) continue;
5291
+ let bx = el.left ?? 0;
5292
+ let by = el.top ?? 0;
5293
+ let bw = el.width ?? 0;
5294
+ let bh = el.height ?? 0;
5295
+ if ((_d = page.pageChildren) == null ? void 0 : _d.length) {
5296
+ const node = findNodeById(page.pageChildren, el.id);
5297
+ if (node) {
5298
+ const abs = getAbsoluteBounds(node, page.pageChildren);
5299
+ bx = abs.left;
5300
+ by = abs.top;
5301
+ bw = abs.width;
5302
+ bh = abs.height;
5303
+ }
5304
+ }
5305
+ if (bw > 0 && bh > 0) {
5306
+ addLinkAnnotation(pdf, url, bx, by, bw, bh, page.height);
5307
+ }
5308
+ }
5309
+ } catch (linkErr) {
5310
+ console.warn(`[client-pdf-export] link annotation pass failed for page ${pageIndex + 1}`, linkErr);
5311
+ }
5283
5312
  await yieldToUI();
5284
5313
  continue;
5285
5314
  }
@@ -5341,7 +5370,7 @@ async function exportMultiPagePdf(pages, options) {
5341
5370
  liveTextByElementId.set(memberId, memberObj);
5342
5371
  }
5343
5372
  try {
5344
- const memberLocalMatrix = ((_c = memberObj.calcOwnMatrix) == null ? void 0 : _c.call(memberObj)) ?? ((_d = memberObj.calcTransformMatrix) == null ? void 0 : _d.call(memberObj));
5373
+ const memberLocalMatrix = ((_e = memberObj.calcOwnMatrix) == null ? void 0 : _e.call(memberObj)) ?? ((_f = memberObj.calcTransformMatrix) == null ? void 0 : _f.call(memberObj));
5345
5374
  if (memberLocalMatrix && memberLocalMatrix.length === 6) {
5346
5375
  const [a1, b1, c1, d1, e1, f1] = groupMatrix;
5347
5376
  const [a2, b2, c2, d2, e2, f2] = memberLocalMatrix;
@@ -5398,7 +5427,7 @@ async function exportMultiPagePdf(pages, options) {
5398
5427
  if (el.type !== "text") continue;
5399
5428
  const n = normalizeElement(el);
5400
5429
  let absX = n.x, absY = n.y, absW = n.w, absH = n.h;
5401
- if ((_e = page.pageChildren) == null ? void 0 : _e.length) {
5430
+ if ((_g = page.pageChildren) == null ? void 0 : _g.length) {
5402
5431
  const node = findNodeById(page.pageChildren, el.id);
5403
5432
  if (node) {
5404
5433
  const abs = getAbsoluteBounds(node, page.pageChildren);
@@ -5478,4 +5507,4 @@ export {
5478
5507
  preparePagesForExport,
5479
5508
  rewriteSvgFontsForJsPDFWithSourceMeta
5480
5509
  };
5481
- //# sourceMappingURL=vectorPdfExport-CZyBCnFF.js.map
5510
+ //# sourceMappingURL=vectorPdfExport-HZVoeZf3.js.map