@pixldocs/canvas-renderer 0.5.496 → 0.5.498
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-CZtvER5z.cjs → index-CUZInOyk.cjs} +435 -74
- package/dist/index-CUZInOyk.cjs.map +1 -0
- package/dist/{index-CiSoT2Lk.js → index-lbU-Xs_t.js} +452 -91
- package/dist/index-lbU-Xs_t.js.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-B2KtFs76.cjs → vectorPdfExport-6Hi7Og4W.cjs} +4 -4
- package/dist/{vectorPdfExport-B2KtFs76.cjs.map → vectorPdfExport-6Hi7Og4W.cjs.map} +1 -1
- package/dist/{vectorPdfExport-E3x8GBto.js → vectorPdfExport-D8iQi9WT.js} +4 -4
- package/dist/{vectorPdfExport-E3x8GBto.js.map → vectorPdfExport-D8iQi9WT.js.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-CZtvER5z.cjs.map +0 -1
- package/dist/index-CiSoT2Lk.js.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-CUZInOyk.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-lbU-Xs_t.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
|
|
@@ -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-
|
|
6
|
+
const index = require("./index-CUZInOyk.cjs");
|
|
7
7
|
const pdfFonts = require("./pdfFonts-CySSLV-P.cjs");
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -3271,7 +3271,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
3271
3271
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
3272
3272
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
3273
3273
|
try {
|
|
3274
|
-
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-
|
|
3274
|
+
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-CUZInOyk.cjs")).then((n) => n.canvasImageLoader);
|
|
3275
3275
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
3276
3276
|
} catch {
|
|
3277
3277
|
return null;
|
|
@@ -4080,7 +4080,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
4080
4080
|
}
|
|
4081
4081
|
let fetchUrl = imageUrl;
|
|
4082
4082
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
4083
|
-
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-
|
|
4083
|
+
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-CUZInOyk.cjs")).then((n) => n.canvasImageLoader);
|
|
4084
4084
|
if (isPrivateUrl(imageUrl)) return null;
|
|
4085
4085
|
const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
|
|
4086
4086
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -6226,4 +6226,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
|
|
|
6226
6226
|
exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
|
|
6227
6227
|
exports.preparePagesForExport = preparePagesForExport;
|
|
6228
6228
|
exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
|
|
6229
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
6229
|
+
//# sourceMappingURL=vectorPdfExport-6Hi7Og4W.cjs.map
|