[chore:] removed unused methods
This commit is contained in:
@@ -35,59 +35,6 @@ public class PdfBuilder
|
||||
private readonly XFont _regularFont = new("Arial", 9, XFontStyleEx.Regular);
|
||||
private readonly XFont _smallFont = new("Arial", 6, XFontStyleEx.Regular);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a PDF document with address stickers from an AddressSet in a 3×7 grid layout on A4 pages.
|
||||
/// </summary>
|
||||
/// <param name="addressSetId">The ID of the AddressSet to use</param>
|
||||
/// <param name="outputPath">Path where the PDF should be saved</param>
|
||||
public void CreateAddressLabelPdfFromAddressSet(int addressSetId, string outputPath)
|
||||
{
|
||||
// Find the AddressSet by ID
|
||||
var addressSet = Settings._instance.addressSets.GetAddressSetByID(addressSetId);
|
||||
if (addressSet == null)
|
||||
throw new ArgumentException($"AddressSet with ID {addressSetId} not found");
|
||||
|
||||
if (addressSet.KasPersons == null || addressSet.KasPersons.Count == 0)
|
||||
throw new ArgumentException($"AddressSet with ID {addressSetId} contains no addresses");
|
||||
|
||||
// Generate markdown addresses from all KasPersons in the set
|
||||
//var addresses = new string?[addressSet.KasPersons.Count];
|
||||
var addresses = new List<string>();
|
||||
|
||||
// find customer (owner) to include sender_address
|
||||
string senderLine = null;
|
||||
try
|
||||
{
|
||||
var owner = Settings._instance.customers.customers.FirstOrDefault(c => c.ID == addressSet.owner_id);
|
||||
if (owner != null && !string.IsNullOrWhiteSpace(owner.sender_address))
|
||||
// ensure single line and wrap in a small-font tag
|
||||
senderLine = "<font6>" + owner.sender_address.Replace("\n", " ").Trim();
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
senderLine = null;
|
||||
}
|
||||
|
||||
for (var i = 0; i < addressSet.KasPersons.Count; i++)
|
||||
{
|
||||
var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].refsid);
|
||||
if (string.IsNullOrWhiteSpace(addr.Trim())) continue;
|
||||
if (!string.IsNullOrEmpty(senderLine))
|
||||
{
|
||||
if (addressSet.KasPersons[i].refsid != null)
|
||||
{
|
||||
senderLine += "\nID: " + addressSet.KasPersons[i].refsid + "</font6>\n";
|
||||
}
|
||||
addresses.Add(senderLine + addr);
|
||||
|
||||
}
|
||||
else
|
||||
addresses.Add(addr);
|
||||
}
|
||||
|
||||
CreateAddressLabelPdf(addresses, outputPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a PDF document with address stickers from an AddressSet with a placeholder in the first cell.
|
||||
|
||||
Reference in New Issue
Block a user