Erweiterungen

This commit is contained in:
2025-09-19 14:40:08 +02:00
parent a1b4b3035d
commit 82958afe61

View File

@@ -112,6 +112,7 @@ public class PdfBoxService {
contentStream.endText();
yPosition -= 20;
float recipientStartY = yPosition; // Store starting position for date alignment
// Recipient address
String[] recipientLines = {
@@ -132,41 +133,26 @@ public class PdfBoxService {
}
}
// Date (right aligned, same vertical level as recipient)
float dateColumn = 450; // Move further to the right
contentStream.beginText();
contentStream.setFont(new PDType1Font(Standard14Fonts.FontName.HELVETICA), FONT_SIZE);
contentStream.newLineAtOffset(dateColumn, recipientStartY);
contentStream.showText("Datum");
contentStream.endText();
contentStream.beginText();
contentStream.newLineAtOffset(dateColumn, recipientStartY - LINE_HEIGHT);
contentStream.showText(data.getInvoiceDate());
contentStream.endText();
// Company address (right side)
float rightYPosition = yPosition + (recipientLines.length * LINE_HEIGHT);
String[] companyLines = {
data.getCompanyStreet(),
data.getCompanyCity(),
"",
"Tel.: " + data.getCompanyPhone(),
data.getCompanyWebsite()
};
for (String line : companyLines) {
contentStream.beginText();
contentStream.newLineAtOffset(rightColumn, rightYPosition);
contentStream.showText(line != null ? line : "");
contentStream.endText();
rightYPosition -= LINE_HEIGHT;
}
return Math.min(yPosition, rightYPosition) - 10;
}
private float drawInvoiceDetails(PDPageContentStream contentStream, float yPosition, InvoiceData data) throws IOException {
// Invoice date (right aligned)
contentStream.beginText();
contentStream.setFont(new PDType1Font(Standard14Fonts.FontName.HELVETICA), FONT_SIZE);
contentStream.newLineAtOffset(400, yPosition);
contentStream.showText("Datum");
contentStream.endText();
contentStream.beginText();
contentStream.newLineAtOffset(400, yPosition - LINE_HEIGHT);
contentStream.showText(data.getInvoiceDate());
contentStream.endText();
yPosition -= 40;
// Invoice title
contentStream.beginText();