diff --git a/src/components/Dashboard/DashboardAusweis.svelte b/src/components/Dashboard/DashboardAusweis.svelte index 9ecc3983..d649d9eb 100644 --- a/src/components/Dashboard/DashboardAusweis.svelte +++ b/src/components/Dashboard/DashboardAusweis.svelte @@ -688,7 +688,7 @@ {aufnahme.aussenwand_min_12cm_gedaemmt ? "Außenwand min. 12cm gedämmt" : ""}
- Hiermit bestätige ich {benutzer.vorname} {benutzer.name} als Besteller folgende Angaben:
+ Hiermit bestätige ich {benutzer.vorname} {benutzer.name} als Besteller:
{#if ausweis.pruefpunkt_heizungsalter}
Das Heizungsalter ist jünger als 3 Jahre. Es betrifft einen Heizungstausch ohne energetische Verbesserung.
{/if} diff --git a/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts b/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts index 9cb0ce00..7d88d653 100644 --- a/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts +++ b/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts @@ -199,19 +199,28 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe if (bild) { const file = await getS3File("ibc-images", `${bild.id}.jpg`); - if (file) { let image: PDFImage; - image = await pdf.embedJpg(file) + image = await pdf.embedJpg(file); + + const originalWidth = image.width; + const originalHeight = image.height; + + // Calculate the scaling factor to fit within the maximum dimensions while maintaining proportions + const scaleFactor = Math.min(111 / originalWidth, 138 / originalHeight); + + const scaledWidth = originalWidth * scaleFactor; + const scaledHeight = originalHeight * scaleFactor; + pages[0].drawImage(image, { x: 460.5, - y: height - 289, - width: 111, - height: 138 - }) + y: (height - 289 - scaledHeight) + 138, // Adjust y to align the image properly + width: scaledWidth, + height: scaledHeight + }); } } - + // Checkmark Verbrauchsausweis. pages[0].drawText("x", { x: 41, diff --git a/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts b/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts index b79385b4..35984c55 100644 --- a/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts +++ b/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts @@ -59,13 +59,23 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne if (file) { let image: PDFImage; - image = await pdf.embedJpg(file) + image = await pdf.embedJpg(file); + + const originalWidth = image.width; + const originalHeight = image.height; + + // Calculate the scaling factor to fit within the maximum dimensions while maintaining proportions + const scaleFactor = Math.min(111 / originalWidth, 138 / originalHeight); + + const scaledWidth = originalWidth * scaleFactor; + const scaledHeight = originalHeight * scaleFactor; + pages[0].drawImage(image, { x: 460.5, - y: height - 289, - width: 111, - height: 138 - }) + y: (height - 289 - scaledHeight) + 138, // Adjust y to align the image properly + width: scaledWidth, + height: scaledHeight + }); } }