Update 20250606

This commit is contained in:
Stefan Hutter
2025-06-06 09:13:32 +02:00
parent 10343fcbab
commit 85ff87dc62
106 changed files with 1312 additions and 298 deletions

View File

@@ -117,6 +117,8 @@ namespace DOCGEN
return Convert.ToBase64String(bytes);
}
}
public string generate_serienbrief(string vorlage,serienbrief sb, string dokumentid, string resturi, string apikey)
{
SyncFWord sfword = new SyncFWord(resturi,apikey);
@@ -145,8 +147,45 @@ namespace DOCGEN
dd.barcode_text = sb.barcode_text;
dok.dokument = sfword.Generate_Word(vorlage,dd, sb.img_unterschriftlinks,sb.img_unterschrfitrechts,sb.img_faktura,true);
DocGet dget = new DocGet(this.connectionstring);
string pdfdoc = dget.Convert_Word_To_PDF(dok.dokument);
if (dd.Barcode)
{
System.Drawing.Image barcode = sfword.Get_Barcodeimage(dd);
var stream = new MemoryStream(Convert.FromBase64String(pdfdoc));
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
PdfBitmap image = new PdfBitmap(barcode);
for (int i = 0; i < loadedDocument.Pages.Count; i++)
{
PdfLoadedPage loadedPage = loadedDocument.Pages[i] as PdfLoadedPage;
PdfGraphics graphics = loadedPage.Graphics;
if (dd.barcode_horizontal == 1)
{
graphics.DrawImage(image, dd.barcode_left, dd.barcode_top, dd.barcode_width, dd.barcode_height);
}
else
{
graphics.DrawImage(image, dd.barcode_left, dd.barcode_top, dd.barcode_width, dd.barcode_height);
}
}
loadedDocument.ConvertToPDFA(PdfConformanceLevel.Pdf_A1B);
MemoryStream outputStream = new MemoryStream();
loadedDocument.Save(outputStream);
byte[] bytes;
bytes = outputStream.ToArray();
dok.dokument = Convert.ToBase64String(bytes);
dget = null;
outputStream = null;
} else
{
dok.dokument = pdfdoc;
}
db = null;
dok.doktype = "W";
dok.doktype = "P";
sfword = null;
return dok.dokument;