[feat:] PvSt now includes image
This commit is contained in:
+30
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user