Ansichtsausweis
This commit is contained in:
@@ -14,7 +14,7 @@ import { PERSISTENT_DIR } from "#lib/server/constants.js";
|
||||
/* -------------------------------- Pdf Tools ------------------------------- */
|
||||
|
||||
export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohnenClient, aufnahme: AufnahmeClient, objekt: ObjektClient, bilder: BildClient[], user: BenutzerClient) {
|
||||
const VerbrauchsausweisWohnenGEG2024PDF = fs.readFileSync(new URL("../../../public/pdf/templates/GEG24_Wohngebaeude_ohne_pfeile_form.pdf", import.meta.url), "base64");
|
||||
const VerbrauchsausweisWohnenGEG2024PDF = fs.readFileSync(new URL("../../../public/pdf/templates/GEG24_Wohngebaeude_ohne_pfeile.pdf", import.meta.url), "base64");
|
||||
const pdf = await PDFDocument.load(VerbrauchsausweisWohnenGEG2024PDF)
|
||||
const pages = pdf.getPages()
|
||||
|
||||
@@ -28,26 +28,6 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
||||
const font = await pdf.embedFont(StandardFonts.Helvetica)
|
||||
const bold = await pdf.embedFont(StandardFonts.HelveticaBold)
|
||||
|
||||
const form = pdf.getForm()
|
||||
form.updateFieldAppearances(font)
|
||||
|
||||
const fillFormField = (name: string, value: string, fontSize: number = 8, alignment: TextAlignment = TextAlignment.Left) => {
|
||||
const field = form.getTextField(name)
|
||||
field.setFontSize(fontSize)
|
||||
field.setText(value)
|
||||
field.setAlignment(alignment)
|
||||
}
|
||||
|
||||
const toggleCheck = (name: string, checked: boolean = true) => {
|
||||
const field = form.getCheckBox(name)
|
||||
|
||||
if (checked) {
|
||||
field.check()
|
||||
} else {
|
||||
field.uncheck()
|
||||
}
|
||||
}
|
||||
|
||||
pages[0].drawText(aufnahme.gebaeudetyp || "", {
|
||||
x: 211,
|
||||
y: height - 166,
|
||||
@@ -612,7 +592,5 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
||||
addDatumGEG(page, font)
|
||||
}
|
||||
|
||||
pdf.getForm().flatten()
|
||||
|
||||
return pdf.save();
|
||||
}
|
||||
Reference in New Issue
Block a user