Skip to content

Commit 047b7cf

Browse files
committed
Fix - use 'portrait' for PDF page
If width smaller than height, otherwise svg2pdf cut drawing dimension
1 parent fa444c8 commit 047b7cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: modules/base/makepdf.mjs

+4-2
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,20 @@ async function makePDF(svg, args) {
8585

8686
let doc;
8787

88+
const orientation = (svg.width < svg.height) ? 'portrait' : 'landscape';
89+
8890
if (args?.as_doc)
8991
doc = args?.doc;
9092

9193
if (doc) {
9294
doc.addPage({
93-
orientation: 'landscape',
95+
orientation,
9496
unit: 'px',
9597
format: [svg.width + 10, svg.height + 10]
9698
});
9799
} else {
98100
doc = new jsPDF({
99-
orientation: 'landscape',
101+
orientation,
100102
unit: 'px',
101103
format: [svg.width + 10, svg.height + 10]
102104
});

0 commit comments

Comments
 (0)