@pixldocs/canvas-renderer 0.5.40 → 0.5.42
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/dist/{canvasWatermark-DAZIQ_IR.cjs → canvasWatermark-B0ab38Ok.cjs} +12 -8
- package/dist/canvasWatermark-B0ab38Ok.cjs.map +1 -0
- package/dist/{canvasWatermark-CM85x4k7.js → canvasWatermark-pkhacGge.js} +12 -8
- package/dist/canvasWatermark-pkhacGge.js.map +1 -0
- package/dist/index.cjs +197 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +197 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/canvasWatermark-CM85x4k7.js.map +0 -1
- package/dist/canvasWatermark-DAZIQ_IR.cjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -221,7 +221,7 @@ export declare function normalizeFontFamily(fontStack: string): string;
|
|
|
221
221
|
* Package version banner. Bump alongside package.json so we can confirm
|
|
222
222
|
* (via browser:log) that the deployed bundle matches the expected build.
|
|
223
223
|
*/
|
|
224
|
-
export declare const PACKAGE_VERSION = "0.5.
|
|
224
|
+
export declare const PACKAGE_VERSION = "0.5.42";
|
|
225
225
|
|
|
226
226
|
export declare interface PageSettings {
|
|
227
227
|
backgroundColor?: string;
|
|
@@ -249,6 +249,8 @@ export declare interface PdfFromFormOptions {
|
|
|
249
249
|
themeId?: string;
|
|
250
250
|
/** Whether to inject watermark. Default: auto (true for paid templates, false for free). */
|
|
251
251
|
watermark?: boolean;
|
|
252
|
+
/** Customize watermark text/opacity/fontSize/angle. Defaults preserve current behavior. */
|
|
253
|
+
watermarkOptions?: WatermarkOptions;
|
|
252
254
|
/** Optional prefetched rows from a trusted server to skip browser-side REST fetching. */
|
|
253
255
|
prefetched?: ResolveFromFormOptions['prefetched'];
|
|
254
256
|
/** PDF document title */
|
|
@@ -418,6 +420,8 @@ export declare interface RenderFromFormOptions extends Omit<RenderOptions, 'page
|
|
|
418
420
|
themeId?: string;
|
|
419
421
|
/** Whether to inject watermark on preview. Default: auto (true for paid templates, false for free). */
|
|
420
422
|
watermark?: boolean;
|
|
423
|
+
/** Customize watermark text/opacity/fontSize/angle. Defaults preserve current behavior. */
|
|
424
|
+
watermarkOptions?: WatermarkOptions;
|
|
421
425
|
/** Optional prefetched rows from a trusted server to skip browser-side REST fetching. */
|
|
422
426
|
prefetched?: ResolveFromFormOptions['prefetched'];
|
|
423
427
|
}
|
|
@@ -638,4 +642,12 @@ export declare function warmResolvedTemplateForPreview(config: TemplateConfig, o
|
|
|
638
642
|
*/
|
|
639
643
|
export declare function warmTemplateFromForm(options: ResolveFromFormOptions & WarmOptions): Promise<void>;
|
|
640
644
|
|
|
645
|
+
/** Watermark appearance overrides (mirrors src/lib/canvasWatermark WatermarkOptions). */
|
|
646
|
+
declare interface WatermarkOptions {
|
|
647
|
+
text?: string;
|
|
648
|
+
opacity?: number;
|
|
649
|
+
fontSize?: number;
|
|
650
|
+
angle?: number;
|
|
651
|
+
}
|
|
652
|
+
|
|
641
653
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -4782,6 +4782,157 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
|
|
|
4782
4782
|
return true;
|
|
4783
4783
|
});
|
|
4784
4784
|
}
|
|
4785
|
+
const PD_BG_KEY = "__pdBg";
|
|
4786
|
+
const PATCHED_KEY = "__pdBgPatched";
|
|
4787
|
+
function extractTextBgConfig(element) {
|
|
4788
|
+
return {
|
|
4789
|
+
color: element.textBgColor,
|
|
4790
|
+
padding: Math.max(0, Number(element.textBgPadding ?? 0)) || 0,
|
|
4791
|
+
rxTL: Math.max(0, Number(element.textBgRxTL ?? 0)) || 0,
|
|
4792
|
+
rxTR: Math.max(0, Number(element.textBgRxTR ?? 0)) || 0,
|
|
4793
|
+
rxBR: Math.max(0, Number(element.textBgRxBR ?? 0)) || 0,
|
|
4794
|
+
rxBL: Math.max(0, Number(element.textBgRxBL ?? 0)) || 0
|
|
4795
|
+
};
|
|
4796
|
+
}
|
|
4797
|
+
function hasTextBackground(cfg) {
|
|
4798
|
+
if (!cfg) return false;
|
|
4799
|
+
const c = (cfg.color || "").toString().trim().toLowerCase();
|
|
4800
|
+
return !!c && c !== "transparent" && c !== "none" && c !== "rgba(0,0,0,0)";
|
|
4801
|
+
}
|
|
4802
|
+
function buildTextShadow(element) {
|
|
4803
|
+
const color = element.textShadowColor;
|
|
4804
|
+
const blur = Number(element.textShadowBlur ?? 0);
|
|
4805
|
+
const ox = Number(element.textShadowOffsetX ?? 0);
|
|
4806
|
+
const oy = Number(element.textShadowOffsetY ?? 0);
|
|
4807
|
+
if (!color || color === "transparent") return null;
|
|
4808
|
+
if (blur === 0 && ox === 0 && oy === 0) return null;
|
|
4809
|
+
return new fabric.Shadow({
|
|
4810
|
+
color,
|
|
4811
|
+
blur: blur || 0,
|
|
4812
|
+
offsetX: ox || 0,
|
|
4813
|
+
offsetY: oy || 0,
|
|
4814
|
+
affectStroke: false,
|
|
4815
|
+
nonScaling: false
|
|
4816
|
+
});
|
|
4817
|
+
}
|
|
4818
|
+
function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
|
|
4819
|
+
const maxR = Math.min(w, h) / 2;
|
|
4820
|
+
const tl = Math.min(Math.max(0, rTL), maxR);
|
|
4821
|
+
const tr = Math.min(Math.max(0, rTR), maxR);
|
|
4822
|
+
const br = Math.min(Math.max(0, rBR), maxR);
|
|
4823
|
+
const bl = Math.min(Math.max(0, rBL), maxR);
|
|
4824
|
+
ctx.beginPath();
|
|
4825
|
+
ctx.moveTo(x + tl, y);
|
|
4826
|
+
ctx.lineTo(x + w - tr, y);
|
|
4827
|
+
if (tr > 0) ctx.quadraticCurveTo(x + w, y, x + w, y + tr);
|
|
4828
|
+
ctx.lineTo(x + w, y + h - br);
|
|
4829
|
+
if (br > 0) ctx.quadraticCurveTo(x + w, y + h, x + w - br, y + h);
|
|
4830
|
+
ctx.lineTo(x + bl, y + h);
|
|
4831
|
+
if (bl > 0) ctx.quadraticCurveTo(x, y + h, x, y + h - bl);
|
|
4832
|
+
ctx.lineTo(x, y + tl);
|
|
4833
|
+
if (tl > 0) ctx.quadraticCurveTo(x, y, x + tl, y);
|
|
4834
|
+
ctx.closePath();
|
|
4835
|
+
}
|
|
4836
|
+
function applyTextBackground(obj, cfg) {
|
|
4837
|
+
var _a;
|
|
4838
|
+
obj[PD_BG_KEY] = { ...cfg };
|
|
4839
|
+
if (obj[PATCHED_KEY]) return;
|
|
4840
|
+
obj[PATCHED_KEY] = true;
|
|
4841
|
+
const originalRender = obj._render.bind(obj);
|
|
4842
|
+
obj._render = function(ctx) {
|
|
4843
|
+
const bg = this[PD_BG_KEY];
|
|
4844
|
+
if (hasTextBackground(bg)) {
|
|
4845
|
+
const w = this.width ?? 0;
|
|
4846
|
+
const h = this.height ?? 0;
|
|
4847
|
+
const pad = Math.max(0, Number(bg.padding ?? 0));
|
|
4848
|
+
const x = -w / 2 - pad;
|
|
4849
|
+
const y = -h / 2 - pad;
|
|
4850
|
+
const bgW = w + pad * 2;
|
|
4851
|
+
const bgH = h + pad * 2;
|
|
4852
|
+
ctx.save();
|
|
4853
|
+
buildRoundedRectPath2D(
|
|
4854
|
+
ctx,
|
|
4855
|
+
x,
|
|
4856
|
+
y,
|
|
4857
|
+
bgW,
|
|
4858
|
+
bgH,
|
|
4859
|
+
bg.rxTL ?? 0,
|
|
4860
|
+
bg.rxTR ?? 0,
|
|
4861
|
+
bg.rxBR ?? 0,
|
|
4862
|
+
bg.rxBL ?? 0
|
|
4863
|
+
);
|
|
4864
|
+
ctx.fillStyle = bg.color;
|
|
4865
|
+
ctx.fill();
|
|
4866
|
+
ctx.restore();
|
|
4867
|
+
}
|
|
4868
|
+
originalRender(ctx);
|
|
4869
|
+
};
|
|
4870
|
+
const originalToObject = obj.toObject.bind(obj);
|
|
4871
|
+
obj.toObject = function(propertiesToInclude) {
|
|
4872
|
+
const out = originalToObject(propertiesToInclude);
|
|
4873
|
+
const bg = this[PD_BG_KEY];
|
|
4874
|
+
if (hasTextBackground(bg)) {
|
|
4875
|
+
out.__pdBg = { ...bg };
|
|
4876
|
+
}
|
|
4877
|
+
return out;
|
|
4878
|
+
};
|
|
4879
|
+
const originalToSVG = (_a = obj.toSVG) == null ? void 0 : _a.bind(obj);
|
|
4880
|
+
if (typeof originalToSVG === "function") {
|
|
4881
|
+
obj.toSVG = function(reviver) {
|
|
4882
|
+
const svg = originalToSVG(reviver);
|
|
4883
|
+
const bg = this[PD_BG_KEY];
|
|
4884
|
+
if (!hasTextBackground(bg)) return svg;
|
|
4885
|
+
const w = this.width ?? 0;
|
|
4886
|
+
const h = this.height ?? 0;
|
|
4887
|
+
const pad = Math.max(0, Number(bg.padding ?? 0));
|
|
4888
|
+
const x = -w / 2 - pad;
|
|
4889
|
+
const y = -h / 2 - pad;
|
|
4890
|
+
const bgW = w + pad * 2;
|
|
4891
|
+
const bgH = h + pad * 2;
|
|
4892
|
+
const d = buildRoundedRectPathD(
|
|
4893
|
+
x,
|
|
4894
|
+
y,
|
|
4895
|
+
bgW,
|
|
4896
|
+
bgH,
|
|
4897
|
+
bg.rxTL ?? 0,
|
|
4898
|
+
bg.rxTR ?? 0,
|
|
4899
|
+
bg.rxBR ?? 0,
|
|
4900
|
+
bg.rxBL ?? 0
|
|
4901
|
+
);
|
|
4902
|
+
const fill = bg.color;
|
|
4903
|
+
const bgPath = `<path d="${d}" fill="${escapeXmlAttr(fill)}" />`;
|
|
4904
|
+
const openTagMatch = svg.match(/^\s*<g\b[^>]*>/);
|
|
4905
|
+
if (openTagMatch) {
|
|
4906
|
+
const openTag = openTagMatch[0];
|
|
4907
|
+
return svg.replace(openTag, openTag + bgPath);
|
|
4908
|
+
}
|
|
4909
|
+
return `<g>${bgPath}${svg}</g>`;
|
|
4910
|
+
};
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
function buildRoundedRectPathD(x, y, w, h, rTL, rTR, rBR, rBL) {
|
|
4914
|
+
const maxR = Math.min(w, h) / 2;
|
|
4915
|
+
const tl = Math.min(Math.max(0, rTL), maxR);
|
|
4916
|
+
const tr = Math.min(Math.max(0, rTR), maxR);
|
|
4917
|
+
const br = Math.min(Math.max(0, rBR), maxR);
|
|
4918
|
+
const bl = Math.min(Math.max(0, rBL), maxR);
|
|
4919
|
+
const fmt = (n) => Number.isFinite(n) ? Number(n.toFixed(3)) : 0;
|
|
4920
|
+
const parts = [];
|
|
4921
|
+
parts.push(`M ${fmt(x + tl)} ${fmt(y)}`);
|
|
4922
|
+
parts.push(`L ${fmt(x + w - tr)} ${fmt(y)}`);
|
|
4923
|
+
if (tr > 0) parts.push(`Q ${fmt(x + w)} ${fmt(y)} ${fmt(x + w)} ${fmt(y + tr)}`);
|
|
4924
|
+
parts.push(`L ${fmt(x + w)} ${fmt(y + h - br)}`);
|
|
4925
|
+
if (br > 0) parts.push(`Q ${fmt(x + w)} ${fmt(y + h)} ${fmt(x + w - br)} ${fmt(y + h)}`);
|
|
4926
|
+
parts.push(`L ${fmt(x + bl)} ${fmt(y + h)}`);
|
|
4927
|
+
if (bl > 0) parts.push(`Q ${fmt(x)} ${fmt(y + h)} ${fmt(x)} ${fmt(y + h - bl)}`);
|
|
4928
|
+
parts.push(`L ${fmt(x)} ${fmt(y + tl)}`);
|
|
4929
|
+
if (tl > 0) parts.push(`Q ${fmt(x)} ${fmt(y)} ${fmt(x + tl)} ${fmt(y)}`);
|
|
4930
|
+
parts.push("Z");
|
|
4931
|
+
return parts.join(" ");
|
|
4932
|
+
}
|
|
4933
|
+
function escapeXmlAttr(s) {
|
|
4934
|
+
return String(s).replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
4935
|
+
}
|
|
4785
4936
|
const TRIANGLE_STROKE_MITER_LIMIT = 1e6;
|
|
4786
4937
|
const toSafeNumber = (value, fallback = 0) => Number.isFinite(value) ? Math.max(0, Number(value)) : fallback;
|
|
4787
4938
|
function normalizeShapeType(shapeType) {
|
|
@@ -5082,6 +5233,9 @@ function createText(element) {
|
|
|
5082
5233
|
textbox.setCoords();
|
|
5083
5234
|
}
|
|
5084
5235
|
textbox.dirty = true;
|
|
5236
|
+
applyTextBackground(textbox, extractTextBgConfig(element));
|
|
5237
|
+
const shadow = buildTextShadow(element);
|
|
5238
|
+
if (shadow) textbox.set("shadow", shadow);
|
|
5085
5239
|
return textbox;
|
|
5086
5240
|
}
|
|
5087
5241
|
function createLine(element) {
|
|
@@ -7694,7 +7848,19 @@ const PageCanvas = forwardRef(
|
|
|
7694
7848
|
const resolvedSizeForCompare = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 0, height: typeof element.height === "number" ? element.height : 0 };
|
|
7695
7849
|
const fabricText = existingObj.text ?? "";
|
|
7696
7850
|
const storeText = element.text ?? "";
|
|
7697
|
-
const otherPropsChanged = Math.abs((existingObj.width ?? 0) - resolvedSizeForCompare.width) > 0.1 || Math.abs((existingObj.height ?? 0) - resolvedSizeForCompare.height) > 0.1 || Math.abs((existingObj.angle ?? 0) - (element.angle ?? 0)) > 0.1 || Math.abs((existingObj.scaleX ?? 1) - (element.scaleX ?? 1)) > 0.01 || Math.abs((existingObj.scaleY ?? 1) - (element.scaleY ?? 1)) > 0.01 || (existingObj.flipX ?? false) !== (element.flipX ?? false) || (existingObj.flipY ?? false) !== (element.flipY ?? false) || fabricText !== storeText || existingObj.fill !== (element.fill ?? "") || existingObj.stroke !== (element.stroke ?? "") || Math.abs((existingObj.strokeWidth ?? 0) - (element.strokeWidth ?? 0)) > 0.01 || Math.abs((existingObj.opacity ?? 1) - (element.opacity ?? 1)) > 0.01 || (existingObj.fontSize ?? 0) !== (element.fontSize ?? 0) || (existingObj.fontFamily ?? "") !== (element.fontFamily ?? "") || //
|
|
7851
|
+
const otherPropsChanged = Math.abs((existingObj.width ?? 0) - resolvedSizeForCompare.width) > 0.1 || Math.abs((existingObj.height ?? 0) - resolvedSizeForCompare.height) > 0.1 || Math.abs((existingObj.angle ?? 0) - (element.angle ?? 0)) > 0.1 || Math.abs((existingObj.scaleX ?? 1) - (element.scaleX ?? 1)) > 0.01 || Math.abs((existingObj.scaleY ?? 1) - (element.scaleY ?? 1)) > 0.01 || (existingObj.flipX ?? false) !== (element.flipX ?? false) || (existingObj.flipY ?? false) !== (element.flipY ?? false) || fabricText !== storeText || existingObj.fill !== (element.fill ?? "") || existingObj.stroke !== (element.stroke ?? "") || Math.abs((existingObj.strokeWidth ?? 0) - (element.strokeWidth ?? 0)) > 0.01 || Math.abs((existingObj.opacity ?? 1) - (element.opacity ?? 1)) > 0.01 || (existingObj.fontSize ?? 0) !== (element.fontSize ?? 0) || (existingObj.fontFamily ?? "") !== (element.fontFamily ?? "") || // Detect text background + shadow changes so panel edits flow into Fabric.
|
|
7852
|
+
JSON.stringify({
|
|
7853
|
+
c: element.textBgColor ?? null,
|
|
7854
|
+
p: element.textBgPadding ?? 0,
|
|
7855
|
+
tl: element.textBgRxTL ?? 0,
|
|
7856
|
+
tr: element.textBgRxTR ?? 0,
|
|
7857
|
+
br: element.textBgRxBR ?? 0,
|
|
7858
|
+
bl: element.textBgRxBL ?? 0,
|
|
7859
|
+
sc: element.textShadowColor ?? null,
|
|
7860
|
+
sb: element.textShadowBlur ?? 0,
|
|
7861
|
+
sx: element.textShadowOffsetX ?? 0,
|
|
7862
|
+
sy: element.textShadowOffsetY ?? 0
|
|
7863
|
+
}) !== (existingObj.__lastTextBgShadowJson ?? "") || // CRITICAL: Detect gradient fill/stroke changes — serialise to JSON for deep comparison
|
|
7698
7864
|
JSON.stringify(element.fillGradient || null) !== (existingObj.__lastFillGradientJson ?? "null") || JSON.stringify(element.strokeGradient || null) !== (existingObj.__lastStrokeGradientJson ?? "null");
|
|
7699
7865
|
const forceApplyFromPanel = syncTriggeredByPanelRef.current;
|
|
7700
7866
|
const noPropsOrPositionChanged = !positionChanged && !otherPropsChanged;
|
|
@@ -8589,6 +8755,26 @@ const PageCanvas = forwardRef(
|
|
|
8589
8755
|
}
|
|
8590
8756
|
obj.setCoords();
|
|
8591
8757
|
obj.dirty = true;
|
|
8758
|
+
try {
|
|
8759
|
+
applyTextBackground(obj, extractTextBgConfig(element));
|
|
8760
|
+
const shadow = buildTextShadow(element);
|
|
8761
|
+
obj.set("shadow", shadow ?? null);
|
|
8762
|
+
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
8763
|
+
c: element.textBgColor ?? null,
|
|
8764
|
+
p: element.textBgPadding ?? 0,
|
|
8765
|
+
tl: element.textBgRxTL ?? 0,
|
|
8766
|
+
tr: element.textBgRxTR ?? 0,
|
|
8767
|
+
br: element.textBgRxBR ?? 0,
|
|
8768
|
+
bl: element.textBgRxBL ?? 0,
|
|
8769
|
+
sc: element.textShadowColor ?? null,
|
|
8770
|
+
sb: element.textShadowBlur ?? 0,
|
|
8771
|
+
sx: element.textShadowOffsetX ?? 0,
|
|
8772
|
+
sy: element.textShadowOffsetY ?? 0
|
|
8773
|
+
});
|
|
8774
|
+
obj.dirty = true;
|
|
8775
|
+
} catch (err) {
|
|
8776
|
+
console.warn("[text-bg] failed to apply background/shadow", err);
|
|
8777
|
+
}
|
|
8592
8778
|
} else if (!isImage && !isLine) {
|
|
8593
8779
|
if (obj instanceof fabric.Circle) {
|
|
8594
8780
|
obj.set({
|
|
@@ -12053,7 +12239,7 @@ function PixldocsPreview(props) {
|
|
|
12053
12239
|
!canvasSettled && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12054
12240
|
] });
|
|
12055
12241
|
}
|
|
12056
|
-
const PACKAGE_VERSION = "0.5.
|
|
12242
|
+
const PACKAGE_VERSION = "0.5.42";
|
|
12057
12243
|
let __underlineFixInstalled = false;
|
|
12058
12244
|
function installUnderlineFix(fab) {
|
|
12059
12245
|
var _a;
|
|
@@ -12208,7 +12394,7 @@ class PixldocsRenderer {
|
|
|
12208
12394
|
* This is the primary external API for the package.
|
|
12209
12395
|
*/
|
|
12210
12396
|
async renderFromForm(options) {
|
|
12211
|
-
const { templateId, formSchemaId, sectionState, themeId, watermark, prefetched, ...renderOpts } = options;
|
|
12397
|
+
const { templateId, formSchemaId, sectionState, themeId, watermark, watermarkOptions, prefetched, ...renderOpts } = options;
|
|
12212
12398
|
const resolved = await resolveFromForm({
|
|
12213
12399
|
templateId,
|
|
12214
12400
|
formSchemaId,
|
|
@@ -12221,8 +12407,8 @@ class PixldocsRenderer {
|
|
|
12221
12407
|
const shouldWatermark = watermark ?? resolved.price > 0;
|
|
12222
12408
|
let configToRender = resolved.config;
|
|
12223
12409
|
if (shouldWatermark) {
|
|
12224
|
-
const { injectWatermark } = await import("./canvasWatermark-
|
|
12225
|
-
configToRender = injectWatermark(configToRender);
|
|
12410
|
+
const { injectWatermark } = await import("./canvasWatermark-pkhacGge.js");
|
|
12411
|
+
configToRender = injectWatermark(configToRender, watermarkOptions);
|
|
12226
12412
|
}
|
|
12227
12413
|
return this.renderAllPages(configToRender, renderOpts);
|
|
12228
12414
|
}
|
|
@@ -12261,7 +12447,7 @@ class PixldocsRenderer {
|
|
|
12261
12447
|
* Resolve from V2 sectionState and return SVGs for all pages (for server vector PDF).
|
|
12262
12448
|
*/
|
|
12263
12449
|
async renderSvgsFromForm(options) {
|
|
12264
|
-
const { templateId, formSchemaId, sectionState, themeId, watermark, prefetched } = options;
|
|
12450
|
+
const { templateId, formSchemaId, sectionState, themeId, watermark, watermarkOptions, prefetched } = options;
|
|
12265
12451
|
const resolved = await resolveFromForm({
|
|
12266
12452
|
templateId,
|
|
12267
12453
|
formSchemaId,
|
|
@@ -12274,8 +12460,8 @@ class PixldocsRenderer {
|
|
|
12274
12460
|
const shouldWatermark = watermark ?? resolved.price > 0;
|
|
12275
12461
|
let configToRender = resolved.config;
|
|
12276
12462
|
if (shouldWatermark) {
|
|
12277
|
-
const { injectWatermark } = await import("./canvasWatermark-
|
|
12278
|
-
configToRender = injectWatermark(configToRender);
|
|
12463
|
+
const { injectWatermark } = await import("./canvasWatermark-pkhacGge.js");
|
|
12464
|
+
configToRender = injectWatermark(configToRender, watermarkOptions);
|
|
12279
12465
|
}
|
|
12280
12466
|
return this.renderAllPageSvgs(configToRender);
|
|
12281
12467
|
}
|
|
@@ -12293,7 +12479,7 @@ class PixldocsRenderer {
|
|
|
12293
12479
|
* This is the primary PDF export API — mirrors renderFromForm() but returns a PDF.
|
|
12294
12480
|
*/
|
|
12295
12481
|
async renderPdfFromForm(options) {
|
|
12296
|
-
const { templateId, formSchemaId, sectionState, themeId, watermark, prefetched, title, fontBaseUrl } = options;
|
|
12482
|
+
const { templateId, formSchemaId, sectionState, themeId, watermark, watermarkOptions, prefetched, title, fontBaseUrl } = options;
|
|
12297
12483
|
const resolved = await resolveFromForm({
|
|
12298
12484
|
templateId,
|
|
12299
12485
|
formSchemaId,
|
|
@@ -12306,8 +12492,8 @@ class PixldocsRenderer {
|
|
|
12306
12492
|
const shouldWatermark = watermark ?? resolved.price > 0;
|
|
12307
12493
|
let configToRender = resolved.config;
|
|
12308
12494
|
if (shouldWatermark) {
|
|
12309
|
-
const { injectWatermark } = await import("./canvasWatermark-
|
|
12310
|
-
configToRender = injectWatermark(configToRender);
|
|
12495
|
+
const { injectWatermark } = await import("./canvasWatermark-pkhacGge.js");
|
|
12496
|
+
configToRender = injectWatermark(configToRender, watermarkOptions);
|
|
12311
12497
|
}
|
|
12312
12498
|
const svgs = await this.renderAllPageSvgs(configToRender);
|
|
12313
12499
|
const { assemblePdfFromSvgs: assemblePdfFromSvgs2 } = await Promise.resolve().then(() => pdfExport);
|