1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2026-03-14 13:55:44 +01:00

format: Resize based on rotation

This commit is contained in:
Vincent LAURENT 2025-07-10 16:29:11 +02:00
commit 08f15b0dbb

View file

@ -643,7 +643,14 @@ async function save(order) {
pdfPage.setRotation(window['PDFLib'].degrees(parseInt(rotation)));
}
if(format) {
resizePage(pdfPage, mm2points(parseInt(format.split("x")[0])), mm2points(parseInt(format.split("x")[1])));
let width = mm2points(parseInt(format.split("x")[0]));
let height = mm2points(parseInt(format.split("x")[1]));
if(pdfPage.getHeight() > pdfPage.getWidth()) {
resizePage(pdfPage, Math.min(height, width), Math.max(height, width));
} else {
resizePage(pdfPage, Math.max(height, width), Math.min(height, width));
}
}
pdf.addPage(pdfPage);
}