From 5b21bd70dfeb40afc28db353fe8c0c93c80f532c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Notin?= Date: Wed, 8 Nov 2023 22:52:28 +0100 Subject: [PATCH] Generate landscape pages as landscape PDF Fix #147 --- src/utils/images-to-pdf/images-to-pdf.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/images-to-pdf/images-to-pdf.ts b/src/utils/images-to-pdf/images-to-pdf.ts index 167b05cd..db5d8452 100644 --- a/src/utils/images-to-pdf/images-to-pdf.ts +++ b/src/utils/images-to-pdf/images-to-pdf.ts @@ -26,8 +26,9 @@ export async function imagesToPDF( const physicalWidth = width / dpi; const physicalHeight = height / dpi; const format = getImageFormat(blob); + const orientation = physicalWidth > physicalHeight ? "l" : "p"; - doc.addPage([physicalWidth, physicalHeight]); + doc.addPage([physicalWidth, physicalHeight], orientation); doc.addImage(buffer, format, 0, 0, physicalWidth, physicalHeight); }