"fix-pdf-normalize-to-a4"
This commit is contained in:
@@ -34,8 +34,14 @@ export async function generateInvoicePdf(
|
||||
? await pdfDoc.embedPng(imgBytes)
|
||||
: await pdfDoc.embedJpg(imgBytes);
|
||||
|
||||
const imgW = image.width;
|
||||
const imgH = image.height;
|
||||
// Normaliser à une largeur A4 (595pt) pour que la section invités
|
||||
// soit visible. Sans normalisation, image.width est en pixels
|
||||
// (ex. 3024px), ce qui donne une page de 42 pouces de large et
|
||||
// rend la section invités (~134pt) imperceptible en bas de page.
|
||||
const PAGE_W = 595;
|
||||
const scale = PAGE_W / image.width;
|
||||
const imgW = PAGE_W;
|
||||
const imgH = Math.round(image.height * scale);
|
||||
|
||||
const isLast = idx === imagePaths.length - 1;
|
||||
const addList = isLast && guests.length > 0;
|
||||
|
||||
Reference in New Issue
Block a user