@pixldocs/canvas-renderer 0.5.173 → 0.5.175

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.
@@ -16331,9 +16331,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
16331
16331
  }
16332
16332
  return svgString;
16333
16333
  }
16334
- const resolvedPackageVersion = "0.5.173";
16334
+ const resolvedPackageVersion = "0.5.175";
16335
16335
  const PACKAGE_VERSION = resolvedPackageVersion;
16336
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.173";
16336
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.175";
16337
16337
  const roundParityValue = (value) => {
16338
16338
  if (typeof value !== "number") return value;
16339
16339
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -16707,7 +16707,8 @@ class PixldocsRenderer {
16707
16707
  */
16708
16708
  async renderPdf(templateConfig, options) {
16709
16709
  return this.renderPdfViaClientExport(templateConfig, {
16710
- title: options == null ? void 0 : options.title
16710
+ title: options == null ? void 0 : options.title,
16711
+ textMode: options == null ? void 0 : options.textMode
16711
16712
  });
16712
16713
  }
16713
16714
  /**
@@ -16715,7 +16716,7 @@ class PixldocsRenderer {
16715
16716
  * This is the primary PDF export API — mirrors renderFromForm() but returns a PDF.
16716
16717
  */
16717
16718
  async renderPdfFromForm(options) {
16718
- const { templateId, formSchemaId, sectionState, themeId, watermark, watermarkOptions, prefetched, title, fontBaseUrl } = options;
16719
+ const { templateId, formSchemaId, sectionState, themeId, watermark, watermarkOptions, prefetched, title, fontBaseUrl, textMode } = options;
16719
16720
  const resolved = await resolveFromForm({
16720
16721
  templateId,
16721
16722
  formSchemaId,
@@ -16733,7 +16734,8 @@ class PixldocsRenderer {
16733
16734
  }
16734
16735
  return this.renderPdfViaClientExport(configToRender, {
16735
16736
  title: title ?? resolved.config.name,
16736
- watermark: shouldWatermark
16737
+ watermark: shouldWatermark,
16738
+ textMode
16737
16739
  });
16738
16740
  }
16739
16741
  async renderById(templateId, formData, options) {
@@ -16828,11 +16830,11 @@ class PixldocsRenderer {
16828
16830
  await this.waitForCanvasScene(container, cloned, i);
16829
16831
  const expected = this.getExpectedImageCount(cloned, i);
16830
16832
  await this.waitForCanvasImages(container, expected);
16831
- await this.waitForStableTextMetrics(container, cloned);
16833
+ await this.waitForStableTextMetrics(container, cloned, { clearGlobalCharCache: false });
16832
16834
  await this.waitForCanvasScene(container, cloned, i);
16833
16835
  }
16834
16836
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16835
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CyTa-D1p.js");
16837
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-COqBgUXt.js");
16836
16838
  const prepared = preparePagesForExport(
16837
16839
  cloned.pages,
16838
16840
  canvasWidth,
@@ -16842,7 +16844,7 @@ class PixldocsRenderer {
16842
16844
  title: options.title,
16843
16845
  watermark: !!options.watermark,
16844
16846
  returnBlob: true,
16845
- pdfTextMode: ((_a = cloned.canvas) == null ? void 0 : _a.n) ?? "selectable"
16847
+ pdfTextMode: options.textMode ?? (cloned == null ? void 0 : cloned.pdfTextMode) ?? ((_a = cloned.canvas) == null ? void 0 : _a.n) ?? "auto"
16846
16848
  });
16847
16849
  if (!result || typeof result === "undefined") {
16848
16850
  throw new Error("exportMultiPagePdf returned no blob (returnBlob path failed)");
@@ -17471,7 +17473,7 @@ class PixldocsRenderer {
17471
17473
  (_a = fabricInstance == null ? void 0 : fabricInstance.getObjects) == null ? void 0 : _a.call(fabricInstance).forEach((obj) => visit(obj));
17472
17474
  logJsonLine("[canvas-renderer][fabric-text-parity]", { stage, textboxes: sample.length, sample });
17473
17475
  }
17474
- async waitForStableTextMetrics(container, config) {
17476
+ async waitForStableTextMetrics(container, config, options = {}) {
17475
17477
  var _a, _b, _c;
17476
17478
  if (typeof document !== "undefined") {
17477
17479
  void ensureFontsForResolvedConfig(config);
@@ -17506,9 +17508,11 @@ class PixldocsRenderer {
17506
17508
  obj.dirty = true;
17507
17509
  }
17508
17510
  };
17509
- try {
17510
- clearFabricCharCache();
17511
- } catch {
17511
+ if (options.clearGlobalCharCache !== false) {
17512
+ try {
17513
+ clearFabricCharCache();
17514
+ } catch {
17515
+ }
17512
17516
  }
17513
17517
  fabricInstance.getObjects().forEach(primeCharBounds);
17514
17518
  (_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
@@ -18968,7 +18972,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18968
18972
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18969
18973
  sanitizeSvgTreeForPdf(svgToDraw);
18970
18974
  try {
18971
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CyTa-D1p.js");
18975
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-COqBgUXt.js");
18972
18976
  try {
18973
18977
  await logTextMeasurementDiagnostic(svgToDraw);
18974
18978
  } catch {
@@ -19091,7 +19095,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
19091
19095
  const shouldStripBg = stripPageBackground ?? hasGradient;
19092
19096
  const textMode = options.textMode ?? (options.outlineText === true ? "pixel-perfect" : "selectable");
19093
19097
  const shouldOutlineText = textMode === "pixel-perfect" || textMode === "auto";
19094
- const outlineSubMode = textMode === "auto" ? "complex-only" : "all";
19098
+ const outlineSubMode = textMode === "pixel-perfect" ? "all" : "gradient-only";
19095
19099
  let pageSvg = page.svg;
19096
19100
  try {
19097
19101
  pageSvg = await convertSvgTextDecorationsToLinesString(pageSvg);
@@ -19381,4 +19385,4 @@ export {
19381
19385
  collectFontDescriptorsFromConfig as y,
19382
19386
  collectFontsFromConfig as z
19383
19387
  };
19384
- //# sourceMappingURL=index-ChHYFk0E.js.map
19388
+ //# sourceMappingURL=index-CTIPncpy.js.map