From 4924f38cb1447f47805e2aa5e0bad83575748902 Mon Sep 17 00:00:00 2001 From: Spencer Peace Date: Tue, 31 Dec 2024 10:05:33 +0100 Subject: [PATCH] fix(ensure fonts are loaded before drawing PDF Druckvermerk) --- app/services/pdf/fillPdf.server.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/pdf/fillPdf.server.ts b/app/services/pdf/fillPdf.server.ts index 1aabdaa4a..80e1a8b7e 100644 --- a/app/services/pdf/fillPdf.server.ts +++ b/app/services/pdf/fillPdf.server.ts @@ -55,16 +55,16 @@ export async function fillPdf({ const pdfDoc = await PDFDocument.load(global.__pdfFileBuffers[flowId]!); resizeToA4(pdfDoc); - addDruckvermerk(pdfDoc, yPositionsDruckvermerk, xPositionsDruckvermerk); - - const form = pdfDoc.getForm(); - pdfDoc.registerFontkit(fontkit); customPdfFormFont = await pdfDoc.embedFont(bundesSansCondensed, { features: { liga: false, }, }); + addDruckvermerk(pdfDoc, yPositionsDruckvermerk, xPositionsDruckvermerk); + + const form = pdfDoc.getForm(); + const rawUpdateFieldAppearances = form.updateFieldAppearances.bind(form); form.updateFieldAppearances = () => rawUpdateFieldAppearances(customPdfFormFont);