@pixldocs/canvas-renderer 0.5.495 → 0.5.497
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/{index-Cvi3YYOq.js → index-CKhnRi3S.js} +617 -117
- package/dist/index-CKhnRi3S.js.map +1 -0
- package/dist/{index-DaaT4Mo7.cjs → index-CZm1oVfa.cjs} +600 -100
- package/dist/index-CZm1oVfa.cjs.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +31 -0
- package/dist/index.js +18 -17
- package/dist/{vectorPdfExport-B6m8o09g.js → vectorPdfExport-DV-TJwjP.js} +4 -4
- package/dist/{vectorPdfExport-B6m8o09g.js.map → vectorPdfExport-DV-TJwjP.js.map} +1 -1
- package/dist/{vectorPdfExport-roj_Ddzd.cjs → vectorPdfExport-De8UFmDy.cjs} +4 -4
- package/dist/{vectorPdfExport-roj_Ddzd.cjs.map → vectorPdfExport-De8UFmDy.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/canvasWatermark-B0ab38Ok.cjs +0 -123
- package/dist/canvasWatermark-B0ab38Ok.cjs.map +0 -1
- package/dist/canvasWatermark-pkhacGge.js +0 -123
- package/dist/canvasWatermark-pkhacGge.js.map +0 -1
- package/dist/index-Cvi3YYOq.js.map +0 -1
- package/dist/index-DaaT4Mo7.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-CZm1oVfa.cjs");
|
|
4
4
|
exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
|
|
5
5
|
exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
|
|
6
6
|
exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
|
|
@@ -29,6 +29,7 @@ exports.getPublishedTemplate = index.getPublishedTemplate;
|
|
|
29
29
|
exports.getTemplateForm = index.getTemplateForm;
|
|
30
30
|
exports.hasAnyPreviewBlur = index.hasAnyPreviewBlur;
|
|
31
31
|
exports.injectPreviewBlur = index.injectPreviewBlur;
|
|
32
|
+
exports.injectWatermark = index.injectWatermark;
|
|
32
33
|
exports.isBundledAssetUrl = index.isBundledAssetUrl;
|
|
33
34
|
exports.isFontAvailable = index.isFontAvailable;
|
|
34
35
|
exports.isPrivateUrl = index.isPrivateUrl;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { getProxiedImageUrl } from '../../../src/lib/canvasImageLoader';
|
|
|
5
5
|
import { hasAnyPreviewBlur } from '../../../src/lib/previewBlur';
|
|
6
6
|
import { InferredSection } from '../../../src/lib/inferFormSchemaFromTemplate';
|
|
7
7
|
import { injectPreviewBlur } from '../../../src/lib/previewBlur';
|
|
8
|
+
import { injectWatermark } from '../../../src/lib/canvasWatermark';
|
|
8
9
|
import { isBundledAssetUrl } from '../../../src/lib/canvasImageLoader';
|
|
9
10
|
import { isPrivateUrl } from '../../../src/lib/canvasImageLoader';
|
|
10
11
|
import { jsPDF } from 'jspdf';
|
|
@@ -286,6 +287,8 @@ export { InferredSection }
|
|
|
286
287
|
|
|
287
288
|
export { injectPreviewBlur }
|
|
288
289
|
|
|
290
|
+
export { injectWatermark }
|
|
291
|
+
|
|
289
292
|
export { isBundledAssetUrl }
|
|
290
293
|
|
|
291
294
|
/** Check if a font is in our local mapping */
|
|
@@ -567,6 +570,8 @@ export declare class PixldocsRenderer {
|
|
|
567
570
|
maxImageEdgePx?: number;
|
|
568
571
|
compressImages?: boolean;
|
|
569
572
|
compressionQuality?: number;
|
|
573
|
+
watermark?: boolean;
|
|
574
|
+
watermarkOptions?: WatermarkOptions;
|
|
570
575
|
}): Promise<PdfRenderResult>;
|
|
571
576
|
/**
|
|
572
577
|
* Resolve from V2 sectionState and render a vector PDF.
|
|
@@ -632,6 +637,28 @@ export declare class PixldocsRenderer {
|
|
|
632
637
|
* renderer.
|
|
633
638
|
*/
|
|
634
639
|
private awaitFontsForConfig;
|
|
640
|
+
/**
|
|
641
|
+
* Flush BOTH process-global text-measurement caches after fonts are ready
|
|
642
|
+
* and BEFORE the capture canvas mounts.
|
|
643
|
+
*
|
|
644
|
+
* Why: anything that measured text before the webfonts finished loading —
|
|
645
|
+
* most notably `applyContentBoundsPagination` running inside
|
|
646
|
+
* `resolveFromForm` on a cold page (the EC2/MCP flow: resolve + render in
|
|
647
|
+
* one browser context) — populates the app measurement cache and Fabric's
|
|
648
|
+
* global char-width cache with FALLBACK metrics. `createText` then places
|
|
649
|
+
* center/right-aligned lines from those stale widths, so a right-aligned
|
|
650
|
+
* grid cell on a continuation page drew shifted left by
|
|
651
|
+
* (fallbackWidth − realWidth) px vs the editor (caught by
|
|
652
|
+
* tests/parity `auto-paginate`, a 9px shift). The later
|
|
653
|
+
* `waitForStableTextMetrics` pass re-primes glyph bounds but never moves
|
|
654
|
+
* the already-positioned box, so the flush must happen pre-mount.
|
|
655
|
+
*
|
|
656
|
+
* Only called from the headless PNG paths (`render`/`renderAllPages`),
|
|
657
|
+
* which already default to clearing the global char cache in
|
|
658
|
+
* `waitForStableTextMetrics` — the live-preview-adjacent PDF path keeps
|
|
659
|
+
* its `clearGlobalCharCache: false` behaviour untouched.
|
|
660
|
+
*/
|
|
661
|
+
private flushTextMeasurementCaches;
|
|
635
662
|
private getNormalizedGradientStops;
|
|
636
663
|
private paintPageBackground;
|
|
637
664
|
private renderPageViaPreviewCanvas;
|
|
@@ -775,6 +802,10 @@ export declare interface RenderFromFormOptions extends Omit<RenderOptions, 'page
|
|
|
775
802
|
export declare interface RenderOptions {
|
|
776
803
|
/** Page index to render (default: 0) */
|
|
777
804
|
pageIndex?: number;
|
|
805
|
+
/** Inject the PixlDocs watermark before rendering (test/demo-key renders). */
|
|
806
|
+
watermark?: boolean;
|
|
807
|
+
/** Customize watermark text/opacity/fontSize/angle. */
|
|
808
|
+
watermarkOptions?: WatermarkOptions;
|
|
778
809
|
/** Output format (default: 'png') */
|
|
779
810
|
format?: 'png' | 'jpeg' | 'webp';
|
|
780
811
|
/** Quality for jpeg/webp (0-1, default: 0.92) */
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, F, q, s, t, P, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, N, b, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7 } from "./index-
|
|
1
|
+
import { D, F, q, s, t, P, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, N, b, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8 } from "./index-CKhnRi3S.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEPLOYMENT_VERSION_MARKER,
|
|
4
4
|
F as FONT_FALLBACK_DEVANAGARI,
|
|
@@ -28,21 +28,22 @@ export {
|
|
|
28
28
|
Q as getTemplateForm,
|
|
29
29
|
R as hasAnyPreviewBlur,
|
|
30
30
|
S as injectPreviewBlur,
|
|
31
|
-
U as
|
|
32
|
-
V as
|
|
33
|
-
W as
|
|
34
|
-
X as
|
|
35
|
-
Y as
|
|
36
|
-
Z as
|
|
37
|
-
_ as
|
|
38
|
-
$ as
|
|
39
|
-
a0 as
|
|
40
|
-
a1 as
|
|
41
|
-
a2 as
|
|
42
|
-
a3 as
|
|
43
|
-
a4 as
|
|
44
|
-
a5 as
|
|
45
|
-
a6 as
|
|
46
|
-
a7 as
|
|
31
|
+
U as injectWatermark,
|
|
32
|
+
V as isBundledAssetUrl,
|
|
33
|
+
W as isFontAvailable,
|
|
34
|
+
X as isPrivateUrl,
|
|
35
|
+
Y as listPublishedTemplates,
|
|
36
|
+
Z as loadGoogleFontCSS,
|
|
37
|
+
_ as normalizeFontFamily,
|
|
38
|
+
$ as resolveBlurElementExactIdsFromFlatFormKeys,
|
|
39
|
+
a0 as resolveFontWeight,
|
|
40
|
+
a1 as resolveForRender,
|
|
41
|
+
a2 as resolveFromForm,
|
|
42
|
+
a3 as resolveTemplateData,
|
|
43
|
+
a4 as rewriteSvgFontsForJsPDF,
|
|
44
|
+
a5 as setAutoShrinkDebug,
|
|
45
|
+
a6 as setBundledAssetPrefixes,
|
|
46
|
+
a7 as warmResolvedTemplateForPreview,
|
|
47
|
+
a8 as warmTemplateFromForm
|
|
47
48
|
};
|
|
48
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -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 { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints, o as getWorldAngleDeg } from "./index-
|
|
4
|
+
import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints, o as getWorldAngleDeg } from "./index-CKhnRi3S.js";
|
|
5
5
|
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-B_rPB0OF.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
@@ -3252,7 +3252,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
3252
3252
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
3253
3253
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
3254
3254
|
try {
|
|
3255
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
3255
|
+
const { getNormalizedSvgUrl } = await import("./index-CKhnRi3S.js").then((n) => n.a9);
|
|
3256
3256
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
3257
3257
|
} catch {
|
|
3258
3258
|
return null;
|
|
@@ -4061,7 +4061,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
4061
4061
|
}
|
|
4062
4062
|
let fetchUrl = imageUrl;
|
|
4063
4063
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
4064
|
-
const { isPrivateUrl } = await import("./index-
|
|
4064
|
+
const { isPrivateUrl } = await import("./index-CKhnRi3S.js").then((n) => n.a9);
|
|
4065
4065
|
if (isPrivateUrl(imageUrl)) return null;
|
|
4066
4066
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
4067
4067
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -6209,4 +6209,4 @@ export {
|
|
|
6209
6209
|
preparePagesForExport,
|
|
6210
6210
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
6211
6211
|
};
|
|
6212
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
6212
|
+
//# sourceMappingURL=vectorPdfExport-DV-TJwjP.js.map
|