Skip to content

Commit

Permalink
Build with makePDF fix
Browse files Browse the repository at this point in the history
  • Loading branch information
linev committed Feb 17, 2025
1 parent 122d3cf commit 61658d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions build/jsroot.js
Original file line number Diff line number Diff line change
Expand Up @@ -143537,6 +143537,8 @@ async function makePDF(svg, args) {
}
});

let pr = Promise.resolve();

if (nodejs) {
const doc = internals.nodejs_document;
doc.originalCreateElementNS = doc.createElementNS;
Expand All @@ -143558,6 +143560,10 @@ async function makePDF(svg, args) {
};
return res;
};

pr = Promise.resolve().then(function () { return _rollup_plugin_ignore_empty_module_placeholder$1; }).then(handle => {
globalThis.Image = handle.Image;
});
}

const orientation = (svg.width < svg.height) ? 'portrait' : 'landscape';
Expand Down Expand Up @@ -143594,10 +143600,9 @@ async function makePDF(svg, args) {
doc.addFont(filename, fcfg.n, fcfg.s || 'normal');
});

let pr = Promise.resolve();
if (need_symbols && !custom_fonts[kSymbol] && settings.LoadSymbolTtf) {
const handler = new FontHandler(122, 10);
pr = handler.load().then(() => {
pr = pr.then(() => handler.load()).then(() => {
handler.addCustomFontToSvg(select(svg.node));
doc.addFileToVFS(kSymbol + '.ttf', handler.base64);
doc.addFont(kSymbol + '.ttf', kSymbol, 'normal');
Expand Down Expand Up @@ -143630,8 +143635,10 @@ async function makePDF(svg, args) {
globalThis.document = undefined;
globalThis.CSSStyleSheet = undefined;
globalThis.CSSStyleRule = undefined;
globalThis.Image = undefined;
internals.nodejs_document.createElementNS = internals.nodejs_document.originalCreateElementNS;
if (args?.as_buffer) return Buffer.from(res);
if (args?.as_buffer)
return Buffer.from(res);
}

return res;
Expand Down
1 change: 1 addition & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
1. Upgrade three.js r168 -> r173
1. Internals - use private members in JSROOT classes like `#draw_object`
1. Fix - handle `TPave` NDC position also when fInit is not set
1. Fix - properly handle image sizes in svg2pdf


## Changes in 7.8.1
Expand Down

0 comments on commit 61658d6

Please sign in to comment.