@pixldocs/canvas-renderer 0.5.162 → 0.5.164
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-D96xE7-z.cjs → index-BfBR4Koj.cjs} +15 -12
- package/dist/index-BfBR4Koj.cjs.map +1 -0
- package/dist/{index-C6rEqM4R.js → index-Gj2Xgcsf.js} +15 -12
- package/dist/index-Gj2Xgcsf.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C5vnOg8Q.js → vectorPdfExport-C-XaAhxd.js} +35 -4
- package/dist/vectorPdfExport-C-XaAhxd.js.map +1 -0
- package/dist/{vectorPdfExport-KTzhlsHG.cjs → vectorPdfExport-gXz5yjal.cjs} +35 -4
- package/dist/vectorPdfExport-gXz5yjal.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-C6rEqM4R.js.map +0 -1
- package/dist/index-D96xE7-z.cjs.map +0 -1
- package/dist/vectorPdfExport-C5vnOg8Q.js.map +0 -1
- package/dist/vectorPdfExport-KTzhlsHG.cjs.map +0 -1
|
@@ -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-BfBR4Koj.cjs");
|
|
7
7
|
const pdfFonts = require("./pdfFonts-BTEVnYX8.cjs");
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -1915,6 +1915,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
1915
1915
|
}
|
|
1916
1916
|
}
|
|
1917
1917
|
async function drawPreparedLiveCanvasSvgPageToPdf(options) {
|
|
1918
|
+
var _a;
|
|
1918
1919
|
const { rawSvg, pdf, pageWidth, pageHeight, pageKey, stripPageBackground } = options;
|
|
1919
1920
|
const svgToDraw = await prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, {
|
|
1920
1921
|
stripPageBackground
|
|
@@ -1926,6 +1927,36 @@ async function drawPreparedLiveCanvasSvgPageToPdf(options) {
|
|
|
1926
1927
|
pdf.saveGraphicsState();
|
|
1927
1928
|
setPdfColorFromSvg(pdf, svgToDraw);
|
|
1928
1929
|
const pdfToUse = pdfWithColorLogging(pdf);
|
|
1930
|
+
try {
|
|
1931
|
+
const texts = Array.from(svgToDraw.querySelectorAll("text"));
|
|
1932
|
+
for (let i = 0; i < texts.length; i++) {
|
|
1933
|
+
const t = texts[i];
|
|
1934
|
+
const content = (t.textContent || "").replace(/\s+/g, " ").trim().slice(0, 60);
|
|
1935
|
+
const tspans = Array.from(t.querySelectorAll("tspan")).map((s) => ({
|
|
1936
|
+
x: s.getAttribute("x"),
|
|
1937
|
+
y: s.getAttribute("y"),
|
|
1938
|
+
text: (s.textContent || "").slice(0, 40)
|
|
1939
|
+
}));
|
|
1940
|
+
const parentG = ((_a = t.parentElement) == null ? void 0 : _a.tagName) === "g" ? t.parentElement : null;
|
|
1941
|
+
console.log("[svg-parity-dump]", JSON.stringify({
|
|
1942
|
+
page: pageKey,
|
|
1943
|
+
idx: i,
|
|
1944
|
+
snippet: content,
|
|
1945
|
+
textAttrs: {
|
|
1946
|
+
x: t.getAttribute("x"),
|
|
1947
|
+
y: t.getAttribute("y"),
|
|
1948
|
+
anchor: t.getAttribute("text-anchor"),
|
|
1949
|
+
fontFamily: t.getAttribute("font-family"),
|
|
1950
|
+
fontSize: t.getAttribute("font-size"),
|
|
1951
|
+
fontWeight: t.getAttribute("font-weight")
|
|
1952
|
+
},
|
|
1953
|
+
parentTransform: (parentG == null ? void 0 : parentG.getAttribute("transform")) || null,
|
|
1954
|
+
tspans
|
|
1955
|
+
}));
|
|
1956
|
+
}
|
|
1957
|
+
} catch (e) {
|
|
1958
|
+
console.warn("[svg-parity-dump] failed:", e);
|
|
1959
|
+
}
|
|
1929
1960
|
await svg2pdfWithDomMount(svgToDraw, pdfToUse, svg2pdfOpts(0, 0, pageWidth, pageHeight));
|
|
1930
1961
|
pdf.restoreGraphicsState();
|
|
1931
1962
|
pdf.setFillColor(0, 0, 0);
|
|
@@ -2488,7 +2519,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2488
2519
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2489
2520
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2490
2521
|
try {
|
|
2491
|
-
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-
|
|
2522
|
+
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-BfBR4Koj.cjs")).then((n) => n.canvasImageLoader);
|
|
2492
2523
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2493
2524
|
} catch {
|
|
2494
2525
|
return null;
|
|
@@ -3269,7 +3300,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3269
3300
|
}
|
|
3270
3301
|
let fetchUrl = imageUrl;
|
|
3271
3302
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3272
|
-
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-
|
|
3303
|
+
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-BfBR4Koj.cjs")).then((n) => n.canvasImageLoader);
|
|
3273
3304
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3274
3305
|
const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
|
|
3275
3306
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5251,4 +5282,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
|
|
|
5251
5282
|
exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
|
|
5252
5283
|
exports.preparePagesForExport = preparePagesForExport;
|
|
5253
5284
|
exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
|
|
5254
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5285
|
+
//# sourceMappingURL=vectorPdfExport-gXz5yjal.cjs.map
|