From cebd81773580c6bcb576769f5f0ab63843a31baf Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Fri, 17 Jul 2026 16:12:34 +0200 Subject: [PATCH] [feat:] PvSt now includes image --- Tasks/PdfBuilder.cs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Tasks/PdfBuilder.cs b/Tasks/PdfBuilder.cs index b526347..9587fe4 100644 --- a/Tasks/PdfBuilder.cs +++ b/Tasks/PdfBuilder.cs @@ -288,7 +288,7 @@ public class PdfBuilder if (pvst) { - // Draw image here + InsertDPPressepostImage(gfx, rect); } // Draw address content if available @@ -301,6 +301,35 @@ public class PdfBuilder } + public void InsertDPPressepostImage(XGraphics gfx, XRect cell) + { + try + { + const double imageSizeX = 47.3; // pt + const double imageSizeY = 14.8; // pt + //const double margin = 20.0; // pt + + var imagePath = Path.Combine("assets", "DP_VerkVermerk_PresseP_NAT.jpg"); + + if (!File.Exists(imagePath)) + { + Logger.Log($"Image not found: {imagePath}", Logger.LogType.Error); + return; + } + + using var image = XImage.FromFile(imagePath); + + double x = cell.Right - imageSizeX - MmToPoints(Settings._instance.pdfExport.cellPaddingRightMm); + double y = cell.Top + MmToPoints(Settings._instance.pdfExport.cellPaddingTopMm) + _smallFont.Height + _regularFont.Height - 3; + + gfx.DrawImage(image, x, y, imageSizeX, imageSizeY); + } + catch (Exception ex) + { + Logger.Log($"Error while inserting Pressepost image: {ex.Message}", Logger.LogType.Error); + } + } + private void DrawEmptyCell(XGraphics gfx, double x, double y) { try