[chore:] pvst image preparation
This commit is contained in:
+13
-8
@@ -181,8 +181,8 @@ public class PdfBuilder
|
|||||||
|
|
||||||
string output_inter = outputPath.Replace(".pdf", "-international.pdf");
|
string output_inter = outputPath.Replace(".pdf", "-international.pdf");
|
||||||
|
|
||||||
if(addresses_german.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath);
|
if(addresses_german.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath, pvst);
|
||||||
if(addresses_inter.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter);
|
if(addresses_inter.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter, pvst);
|
||||||
|
|
||||||
if (_settings.exportRunningSheets)
|
if (_settings.exportRunningSheets)
|
||||||
{
|
{
|
||||||
@@ -207,7 +207,7 @@ public class PdfBuilder
|
|||||||
/// <param name="addresses">Array of addresses</param>
|
/// <param name="addresses">Array of addresses</param>
|
||||||
/// <param name="placeholderText">Text for the first cell (top-left)</param>
|
/// <param name="placeholderText">Text for the first cell (top-left)</param>
|
||||||
/// <param name="outputPath">Path where the PDF should be saved</param>
|
/// <param name="outputPath">Path where the PDF should be saved</param>
|
||||||
public void CreateAddressLabelPdfWithPlaceholder(List<string> addresses, string placeholderText, string outputPath)
|
public void CreateAddressLabelPdfWithPlaceholder(List<string> addresses, string placeholderText, string outputPath, bool pvst)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -226,7 +226,7 @@ public class PdfBuilder
|
|||||||
|
|
||||||
using (var gfx = XGraphics.FromPdfPage(page))
|
using (var gfx = XGraphics.FromPdfPage(page))
|
||||||
{
|
{
|
||||||
DrawPageWithPlaceholder(gfx, addresses, ref addressIndex, ref isFirstCell, placeholderText);
|
DrawPageWithPlaceholder(gfx, addresses, ref addressIndex, ref isFirstCell, placeholderText, pvst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ public class PdfBuilder
|
|||||||
|
|
||||||
|
|
||||||
private void DrawPageWithPlaceholder(XGraphics gfx, List<string> addresses, ref int addressIndex,
|
private void DrawPageWithPlaceholder(XGraphics gfx, List<string> addresses, ref int addressIndex,
|
||||||
ref bool isFirstCell, string placeholderText)
|
ref bool isFirstCell, string placeholderText, bool pvst)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -254,12 +254,12 @@ public class PdfBuilder
|
|||||||
// First cell: placeholder
|
// First cell: placeholder
|
||||||
if (isFirstCell)
|
if (isFirstCell)
|
||||||
{
|
{
|
||||||
DrawCell(gfx, x, y, placeholderText);
|
DrawCell(gfx, x, y, pvst, placeholderText);
|
||||||
isFirstCell = false;
|
isFirstCell = false;
|
||||||
}
|
}
|
||||||
else if (addressIndex < addresses.Count)
|
else if (addressIndex < addresses.Count)
|
||||||
{
|
{
|
||||||
DrawCell(gfx, x, y, addresses[addressIndex]);
|
DrawCell(gfx, x, y, pvst, addresses[addressIndex]);
|
||||||
addressIndex++;
|
addressIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -275,7 +275,7 @@ public class PdfBuilder
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawCell(XGraphics gfx, double x, double y, string? address)
|
private void DrawCell(XGraphics gfx, double x, double y, bool pvst, string? address)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -286,6 +286,11 @@ public class PdfBuilder
|
|||||||
var rect = new XRect(x, y, cellWidthPoints, cellHeightPoints);
|
var rect = new XRect(x, y, cellWidthPoints, cellHeightPoints);
|
||||||
gfx.DrawRectangle(XPens.Transparent, rect);
|
gfx.DrawRectangle(XPens.Transparent, rect);
|
||||||
|
|
||||||
|
if (pvst)
|
||||||
|
{
|
||||||
|
// Draw image here
|
||||||
|
}
|
||||||
|
|
||||||
// Draw address content if available
|
// Draw address content if available
|
||||||
if (!string.IsNullOrEmpty(address)) DrawMarkdownText(gfx, address, x, y, cellWidthPoints, cellHeightPoints);
|
if (!string.IsNullOrEmpty(address)) DrawMarkdownText(gfx, address, x, y, cellWidthPoints, cellHeightPoints);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user