From f0e34d8a409f884333aae6dacdbda90a83cf32d3 Mon Sep 17 00:00:00 2001 From: Vincent LAURENT Date: Wed, 16 Jul 2025 11:17:55 +0200 Subject: [PATCH 1/2] booklet: ddd pages must be reversed --- public/js/organization.js | 7 ++++++- templates/organization.html.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/js/organization.js b/public/js/organization.js index 0d600bc..cf4a153 100644 --- a/public/js/organization.js +++ b/public/js/organization.js @@ -668,7 +668,12 @@ async function save(order) { const pdfBooklet = await window['PDFLib'].PDFDocument.create(); for(let i = nbPages; i > 0; i--) { - orgaPages.push([i, 2 * nbPages - i + 1]); + let pages = [i, 2 * nbPages - i + 1]; + if(i % 2) { + orgaPages.push(pages.reverse()); + } else { + orgaPages.push(pages); + } } for(pages of orgaPages.reverse()) { await merge2Pages(pdfBooklet, pdf.getPages()[pages[0] - 1], pdf.getPages()[pages[1] - 1], pageWidth, pageHeight) diff --git a/templates/organization.html.php b/templates/organization.html.php index 98d3851..41fcd3b 100644 --- a/templates/organization.html.php +++ b/templates/organization.html.php @@ -165,7 +165,7 @@ - + @@ -41,9 +41,10 @@ - + - + +
diff --git a/templates/organization.html.php b/templates/organization.html.php index 41fcd3b..c94d0ae 100644 --- a/templates/organization.html.php +++ b/templates/organization.html.php @@ -22,7 +22,7 @@ " class="form-control form-control-lg" type="file" accept=".pdf,application/pdf,image/png,image/jpeg" multiple="true" />

 

-

+