PDF Datenblatt Bilder

This commit is contained in:
Moritz Utcke
2025-03-19 11:20:37 -03:00
parent aea651c7f7
commit 8277eb100c
5 changed files with 23 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ import { addText } from "./utils/text.js";
import { addAnsichtsausweisLabel, addDatumGEG } from "./utils/helpers.js";
import { PERSISTENT_DIR } from "#lib/server/constants.js";
import { fileURLToPath } from "url";
import { getS3File } from "#lib/s3.js";
export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewerbeClient, aufnahme: AufnahmeClient, objekt: ObjektClient, bilder: BildClient[], user: BenutzerClient) {
@@ -141,21 +142,20 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
const bild = bilder && bilder.find(image => image.kategorie === Enums.BilderKategorie.Gebaeude);
if (bild) {
const path = `${PERSISTENT_DIR}/images/${bild.uid}.jpg`;
if (fs.existsSync(path)) {
const file = fs.readFileSync(fileURLToPath(new URL(path, import.meta.url)))
let image: PDFImage;
image = await pdf.embedJpg(file)
pages[0].drawImage(image, {
x: 460.5,
y: height - 289,
width: 111,
height: 138
})
}
if (bild) {
const file = await getS3File("ibc-images", `${bild.uid}.jpg`);
if (file) {
let image: PDFImage;
image = await pdf.embedJpg(file)
pages[0].drawImage(image, {
x: 460.5,
y: height - 289,
width: 111,
height: 138
})
}
}
// Checkmark Angabe energetische Qualität des Gebäudes.
addCheckMark(pages[0], 40, height - 550)