You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

778 lines
30 KiB

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Security;
using System.Security.Policy;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using edoka_dms;
using Model;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Graphics.Fonts;
using Syncfusion.Pdf.Parsing;
using Syncfusion.XPS;
namespace Versandstrasse
{
public class clsVersandstrasse
{
public bool SaveBase64ToFile(string Base64String, string filename)
{
try
{
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(Base64String));
return true;
}
catch
{
return false;
}
}
public string save_stapel(ref Stream[] streams, int MaxSize)
{
try
{
Lic();
PdfDocument finalDoc = new PdfDocument();
PdfDocumentBase.Merge(finalDoc, streams);
MemoryStream outputStream = new MemoryStream();
finalDoc.Save(outputStream);
var size = outputStream.ToArray().Length;
byte[] bytes;
bytes = outputStream.ToArray();
if (size > MaxSize)
{
return "File too large";
}
return Convert.ToBase64String(bytes);
}
catch { return ""; }
}
private List<PdfLoadedDocument> loadedDocuments = new List<PdfLoadedDocument>();
public void Lic()
{
string lickey = "MzYzODg2NkAzMjM4MmUzMDJlMzBTOWljRmxNelA1d1VGOHpGR0lxQzB6UTAwKzIxK2VBNEhBZFp5alcxb1NVPQ==";
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(lickey);
}
bool logo = false;
bool color = false;
int left = 0;
int top = 0;
int height = 0;
int width = 0;
string pages = "";
string xml = "";
string resturi = "";
string apikey = "";
public void writelog(string inhalt)
{
// inhalt = DateTime.Now + " / " + inhalt;
//System.IO.File.AppendAllText(@"h:\edoka_work\vs.log", Environment.NewLine + inhalt);
}
public string check_pdf_pages(string dokument)
{
var stream = new MemoryStream(Convert.FromBase64String(dokument));
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
if (loadedDocument.Pages.Count % 2 == 0) { } else { Add_EmptyPage(ref loadedDocument); }
MemoryStream outputStream = new MemoryStream();
string dok = "";
try
{
loadedDocument.Save(outputStream);
byte[] bytes;
bytes = outputStream.ToArray();
dok = Convert.ToBase64String(bytes);
return dok;
}
catch
{
dok = "";
return dok;
}
finally
{
stream = null;
loadedDocument = null;
outputStream = null;
}
}
public string Prepare_PDF(string dokumentid, string tempdir, string connectionstring, string resturi, string apikey, string startuppath, versandscript vs = null, serienbrief sb = null, string sbsourcedok = "", bool couvertpos = false)
{
try
{
writelog("Start");
Lic();
this.resturi = resturi;
this.apikey = apikey;
clsdok dok = new clsdok("", "", "", "");
if (sbsourcedok != "")
{
dok.dokument = sbsourcedok;
}
else
{
OnDocOffice.OfficeToPDF officeToPDF = new OnDocOffice.OfficeToPDF();
dok.dokument = officeToPDF.word_to_pdf(dokumentid, connectionstring, tempdir);
}
writelog("Nach OfficeToPDF");
//var stream = new MemoryStream(Convert.FromBase64String(dok.dokument));
////Originalfile laden
//PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
Database.DB db = new Database.DB(connectionstring);
db.clear_parameter();
db.add_parameter("@dokumentid", dokumentid);
if (sb != null)
{
db.add_parameter("@doktyp", sb.dokumenttypnr.ToString());
}
db.Get_Tabledata("ondoc_get_versandstrasse_parameter", true, false);
versandscript vscript = new versandscript();
logo = Convert.ToBoolean(db.dsdaten.Tables[0].Rows[0]["logo"]);
color = Convert.ToBoolean(db.dsdaten.Tables[0].Rows[0]["logocolor"]);
top = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0]["logotop"]);
left = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0]["logoleft"]);
height = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0]["logoheight"]);
width = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0]["logowidth"]);
pages = db.dsdaten.Tables[0].Rows[0]["pages"].ToString();
xml = db.dsdaten.Tables[0].Rows[0]["vscript"].ToString();
if (xml != "")
{
XmlSerializer serializer = new XmlSerializer(typeof(versandscript));
using (StringReader reader = new StringReader(xml))
{
vscript = (versandscript)(serializer.Deserialize(reader));
}
foreach (vsdokument vsd in vscript.dokuments)
{
}
if (vscript.Split_Doc != "")
{
writelog("Split");
split_doc(ref vscript, dok.dokument);
}
if (vscript.PartCopies != "")
{
writelog("Copies");
create_copies(ref vscript, dok.dokument);
}
}
else
{
vsdokument d = new vsdokument();
d.LogoTop = top;
d.LogoLeft = left;
d.LogoHeigth = height;
d.LogoWidth = width;
d.LogoColor = color;
d.Logo = logo;
d.LogoOnPages = pages;
d.sourcedokument = dok.dokument;
vscript.dokuments.Add(d);
}
foreach (vsdokument vdok in vscript.dokuments)
{
var stream = new MemoryStream(Convert.FromBase64String(vdok.sourcedokument));
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
if (vdok.Logo)
{
Add_Logo(ref loadedDocument, vdok.LogoColor, vdok.LogoLeft, vdok.LogoTop, vdok.LogoWidth, vdok.LogoHeigth, vdok.LogoOnPages, this.resturi, this.apikey, startuppath);
}
if (couvertpos)
{
writelog("DrawCouvert Start");
drawcouvert(ref loadedDocument);
writelog("DrawCouvert Ende");
}
if (vdok.TextReplaces.Count > 0)
{
foreach (TextReplace tr in vdok.TextReplaces)
{
if (tr.TextToReplace.Trim() != "")
{
writelog("Replace Start " + tr.TextToReplace);
Replace_Text(ref loadedDocument, tr.TextToReplace, tr.NewText, tr.Fontname, tr.Fontsize, startuppath,tr);
writelog("Replace Ende");
}
}
//loadedDocument.Save(@"x:\r1.pdf");
}
if (loadedDocument.Pages.Count % 2 == 0) { } else { Add_EmptyPage(ref loadedDocument); }
MemoryStream outputStream = new MemoryStream();
try
{
loadedDocument.Save(outputStream);
byte[] bytes;
bytes = outputStream.ToArray();
vdok.pdfdokument = Convert.ToBase64String(bytes);
}
catch (Exception ex)
{
writelog(ex.Message);
}
}
writelog("Merge Start");
if (vscript.dokuments.Count > 1)
{
int i = 0;
Stream[] streams = new Stream[vscript.dokuments.Count];
foreach (vsdokument vdoc in vscript.dokuments)
{
var stream = new MemoryStream(Convert.FromBase64String(vdoc.pdfdokument));
streams[i] = stream;
i++;
}
PdfDocument finalDoc = new PdfDocument();
PdfDocumentBase.Merge(finalDoc, streams);
MemoryStream outputStream = new MemoryStream();
string filename = tempdir + Guid.NewGuid().ToString() + ".pdf";
finalDoc.Save(outputStream);
PdfLoadedDocument loadeddoc = new PdfLoadedDocument(outputStream);
loadeddoc.ConvertToPDFA(PdfConformanceLevel.Pdf_A1B);
loadeddoc.Save(outputStream);
byte[] bytes;
bytes = outputStream.ToArray();
dok.dokument = Convert.ToBase64String(bytes);
vscript.FinalDoc = Convert.ToBase64String(bytes);
finalDoc.Close();
finalDoc.Dispose();
streams = null;
vscript.FinalDoc = vscript.FinalDoc;
outputStream = null;
}
else
{
vscript.FinalDoc = vscript.dokuments[0].pdfdokument.ToString();
}
writelog("Merge Ende");
return vscript.FinalDoc;
}
catch (Exception ex) { writelog("2" + ex.Message);return ""; }
}
private void split_doc(ref versandscript vscript, string document)
{
writelog("Split");
; //SaveBase64ToFile(document, @"x:\f0.pdf");
vscript.dokuments[0].sourcedokument = document;
vsdokument vsd = vscript.dokuments[0];
var stream = new MemoryStream(Convert.FromBase64String(vscript.dokuments[0].sourcedokument));
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
TextSearchOptions to = new TextSearchOptions();
Dictionary<int, List<RectangleF>> matchedTextbounds = new Dictionary<int, List<RectangleF>>();
loadedDocument.FindText(vscript.Split_Doc, out matchedTextbounds);
PdfDocument newdoc = new PdfDocument();
PdfDocument newdoc2 = new PdfDocument();
foreach (int index in matchedTextbounds.Keys)
{
if (matchedTextbounds[index].Count > 0)
{
newdoc.ImportPage(loadedDocument, index);
newdoc2.ImportPageRange(loadedDocument, index + 1, loadedDocument.Pages.Count - (index + 1));
}
}
MemoryStream outputStream = new MemoryStream();
newdoc.Save(outputStream);
byte[] bytes;
byte[] bytes1;
bytes = outputStream.ToArray();
vscript.dokuments[0].sourcedokument = Convert.ToBase64String(bytes);
outputStream.Close();
outputStream = null;
MemoryStream outputStream2 = new MemoryStream();
newdoc2.Save(outputStream2);
bytes1 = outputStream2.ToArray();
vscript.dokuments[1].sourcedokument = Convert.ToBase64String(bytes1);
outputStream2.Close();
outputStream2 = null;
//SaveBase64ToFile(vscript.dokuments[0].sourcedokument, @"x:\f1.pdf");
//SaveBase64ToFile(vscript.dokuments[1].sourcedokument, @"x:\f2.pdf");
}
private void create_copies(ref versandscript vscript, string dokument)
{
//vsdokument vsd = vscript.dokuments[0];
//if (vsd.LogoTop == 0) { vsd.LogoTop = top; }
//if (vsd.LogoLeft == 0) { vsd.LogoLeft = left; }
//if (vsd.LogoHeigth == 0) { vsd.LogoHeigth = height; }
//if (vsd.LogoWidth == 0) { vsd.LogoWidth = width; }
//vsd.sourcedokument = dokument;
writelog("Copies");
if (vscript.dokuments[0].sourcedokument == "") { vscript.dokuments[0].sourcedokument = dokument; }
int i = 1;
List<String> copyparts = vscript.PartCopies.Split(';').ToList();
foreach (string cp in copyparts)
{
string[] part = cp.Split(':');
int part1 = Convert.ToInt32(part[0]);
int part2 = Convert.ToInt32(part[1]);
vscript.dokuments[part2 - 1].sourcedokument = vscript.dokuments[part1 - 1].sourcedokument;
//vsdokument source = vscript.dokuments[part1 - 1];
//if (vscript.dokuments.Count > part2) { vscript.dokuments[i] = source; } else { vscript.dokuments.Add(source); }
}
}
private Syncfusion.Pdf.Graphics.Fonts.PdfUsedFont get_font(ref PdfLoadedDocument document)
{
PdfUsedFont[] usedFonts = document.UsedFonts;
foreach (PdfUsedFont font in usedFonts)
{
if (font.Name.Contains("Futura"))
{
return font;
}
}
return null;
}
private PdfUsedFont get_fontname(ref PdfLoadedDocument document, string fontname)
{
PdfUsedFont[] usedFonts = document.UsedFonts;
// Iterate through the fonts and check if they are embedded
foreach (PdfUsedFont font in usedFonts)
{
if (font.Name.Contains(fontname)) { return font; }
//if (font.Type == PdfFontType.TrueType)
//{
// if (font.Name.Contains("Futura")) { return font; }
// break;
// Console.WriteLine($"Font '{font.Name}' is embedded.");
//}
//else
//{
// return font;
// Console.WriteLine($"Font '{font.Name}' is not embedded.");
//}
}
return null;
}
private void Replace_Text(ref PdfLoadedDocument document, string texttoreplace, string newtext, string fontname, string fontsize, string startuppath, TextReplace tr)
{
PdfLoadedPage loadedPage = document.Pages[0] as PdfLoadedPage;
//Dimenssions
int x = -5;
int y = -5;
int w = 0;
int h = 5;
if (tr.Boxpos_X != "") { x=Convert.ToInt32(tr.Boxpos_X); }
if (tr.Boxpos_Y != "") { y=Convert.ToInt32(tr.Boxpos_Y); }
if (tr.Boxpos_W != "") { w=Convert.ToInt32(tr.Boxpos_W); }
if (tr.Boxpos_H != "") { h=Convert.ToInt32(tr.Boxpos_H); }
//Font und Size
string fname = "Futura";
string fsize = "8";
if (tr.Fontname != "") { fname = tr.Fontname; }
if (tr.Fontsize != "") { fsize = tr.Fontsize; }
// PdfUsedFont usedfont = get_fontname(ref document, fname);
PdfFont font = new PdfTrueTypeFont(new Font(fname, Convert.ToInt32(fsize)));
Dictionary<int, List<RectangleF>> matchedTextbounds = new Dictionary<int, List<RectangleF>>();
document.FindText(texttoreplace, out matchedTextbounds);
PdfSolidBrush brush = new PdfSolidBrush(Color.White);
try
{
if (tr.BGColor != "")
{
brush = new PdfSolidBrush(Color.FromName(tr.BGColor));
}
}
catch { }
List<RectangleF> machedrect = new List<RectangleF>();
int pageindex = 0;
for (int i = 0; i < document.Pages.Count; i++)
{
document.FindText(texttoreplace, pageindex, out machedrect);
loadedPage = (PdfLoadedPage)document.Pages[i];
foreach (RectangleF rectangle in matchedTextbounds[i])
{
RectangleF rect = rectangle;
rect.X = rect.X + x;
rect.Y = rect.Y + y;
rect.Width = rect.Width + w;
rect.Height = rect.Height + h;
loadedPage.Graphics.DrawRectangle(PdfBrushes.White, rectangle);
loadedPage.Graphics.DrawRectangle(brush, rect);
loadedPage.Graphics.DrawString(newtext, font, PdfBrushes.Black, rectangle.X - 2, rectangle.Y - 3);
//if (newtext != "")
//{
// System.Drawing.Image img = DrawText(System.Drawing.Color.Black, System.Drawing.Color.White, "Futura Book", 14, newtext, (int)rect.Width, (int)rect.Height, "", "", 0, 0);
// PdfGraphics graphics = loadedPage.Graphics;
// PdfBitmap pdfimg = new PdfBitmap(img);
// graphics.DrawImage(pdfimg, rect.X, rect.Y);
//}
}
}
}
private string get_logo(bool color, string resturi, string apikey)
{
int imageid = 0;
if (color) { imageid = 4; } else { imageid = 5; }
return get_image(imageid, -1, -1, resturi, apikey);
}
private string get_image(int imageid, int width, int heigh, string resturi, string apikey)
{
string URL = resturi + "API/GetImageAsBase64?imageid=" + imageid.ToString() + "&ImageWidth=" + width.ToString() + "&ImageHeight=" + height.ToString();
HttpWebRequest webRequest = HttpWebRequest.Create(URL) as HttpWebRequest;
webRequest.Method = WebRequestMethods.Http.Get;
webRequest.Headers["Authorization"] = "Bearer " + apikey;
try
{
using (HttpWebResponse response = webRequest.GetResponse() as HttpWebResponse)
{
if (response.StatusCode == HttpStatusCode.OK)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseContent = reader.ReadToEnd();
return responseContent;
}
else
{
//Logging.Logging.Error(URL + ": " + response.StatusCode.ToString() + " / " + response.StatusDescription, "Client - GetImage", "");
return "";
}
}
}
catch (Exception ex)
{
return "";
}
}
private void drawcouvert(ref PdfLoadedDocument document)
{
PdfLoadedPage loadedPage = document.Pages[0] as PdfLoadedPage;
PdfUnitConvertor convertor = new PdfUnitConvertor();
float leftmm = 120;
float topmm = 58;
float pointsLeft = convertor.ConvertUnits(leftmm, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
float pointstop = convertor.ConvertUnits(topmm, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
RectangleF bounds = new RectangleF(pointsLeft, pointstop, 150, 70);
//Set the page Transparency$PdfSolidBrush brush = new PdfSolidBrush(Color.LightBlue);
PdfSolidBrush brush = new PdfSolidBrush(Color.LightBlue);
loadedPage.Graphics.Save();
loadedPage.Graphics.SetTransparency(1, 1f, PdfBlendMode.Darken);
//Draw the rectangle on the PDF document
loadedPage.Graphics.DrawRectangle(brush, bounds);
loadedPage.Graphics.Restore();
//PdfLoadedPage loadedPage = document.Pages[0] as PdfLoadedPage;
//PdfPen pen = new PdfPen(PdfBrushes.Red, 10f);
//PointF p1 = new PointF(10, 100);
//PointF p2 = new PointF(10, 200);
//PointF p3 = new PointF(100, 100);
//PointF p4 = new PointF(100, 200);
//PointF p5 = new PointF(55, 150);
//PointF[] points = { p1, p2, p3, p4, p5 };
////Draw the polygon on PDF document
//PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(10, 100), new PointF(100, 200), new PdfColor(Color.Red), new PdfColor(Color.Green));
//loadedPage.Graphics.DrawPolygon(pen, brush, points);
}
private void Add_Logo(ref PdfLoadedDocument document, bool color, int left, int top, int width, int height, string pages, string resturi, string apikey, string startuppath)
{
string imagefile = "";
imagefile = startuppath + @"\images\tkb_logo_ohne_claim_sw.jpg";
if (color)
{
imagefile = startuppath + @"\images\tkb_logo_ohne_claim_4c_c.jpg";
}
//imagefile = get_logo(color,resturi,apikey);
//byte[] bytes = Convert.FromBase64String(imagefile);
//MemoryStream ms = new MemoryStream(bytes);
PdfBitmap image = new PdfBitmap(imagefile);
if (pages == "0") { return; }
if (pages == "All")
{
for (int i = 0; i < document.Pages.Count; i++)
{
PdfLoadedPage loadedPage = document.Pages[i] as PdfLoadedPage;
PdfGraphics graphics = loadedPage.Graphics;
graphics.DrawImage(image, left, top);
}
}
else
{
int docpages = document.Pages.Count;
string[] page = pages.Split(';');
foreach (var p in page)
{
int pageno = Convert.ToInt32(p) - 1;
PdfLoadedPage loadedPage = document.Pages[pageno] as PdfLoadedPage;
PdfGraphics graphics = loadedPage.Graphics;
graphics.DrawImage(image, left, top);
}
}
}
private void Add_EmptyPage(ref PdfLoadedDocument document)
{
document.Pages.Add();
}
public Image DrawText(Color foreColor, Color backColor, string fontName, int fontSize, string txt, int width, int height, string zusatz, string zusatzfontname, int zusatzfontsize, int rotation)
{
//width = 320;
//height = 50;
string barcodetext = txt;
barcodetext = txt;
Bitmap img = new Bitmap(width, height);
Graphics Gimg = Graphics.FromImage(img);
Font imgFont = new Font(fontName, fontSize);
PointF imgPoint = new PointF(0, 0);
SolidBrush bForeColor = new SolidBrush(foreColor);
SolidBrush bBackColor = new SolidBrush(backColor);
Gimg.FillRectangle(bBackColor, 0, 0, width, height);
Gimg.DrawString(barcodetext, imgFont, bForeColor, imgPoint);
//Font fzFont = new Font(zusatzfontname, zusatzfontsize);
//SizeF textSize = Gimg.MeasureString(zusatz, fzFont, 30);
//PointF imgPointZusatz = new PointF(width - textSize.Width, 25);
//Gimg.DrawString(zusatz, fzFont, bForeColor, imgPointZusatz);
return RotateImage(img, rotation, true, true, Color.White);
//img.Save(imagePath, ImageFormat.Jpeg);
}
private static System.Drawing.Image ResizeImage(System.Drawing.Image imgToResize, Size size)
{
// Get the image current width
int sourceWidth = imgToResize.Width;
// Get the image current height
int sourceHeight = imgToResize.Height;
float nPercent = 0;
float nPercentW = 0;
float nPercentH = 0;
// Calculate width and height with new desired size
nPercentW = ((float)size.Width / (float)sourceWidth);
nPercentH = ((float)size.Height / (float)sourceHeight);
nPercent = Math.Min(nPercentW, nPercentH);
// New Width and Height
int destWidth = (int)(sourceWidth * nPercent);
int destHeight = (int)(sourceHeight * nPercent);
Bitmap b = new Bitmap(destWidth, destHeight);
Graphics g = Graphics.FromImage((System.Drawing.Image)b);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
// Draw image with new width and height
g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
g.Dispose();
return (System.Drawing.Image)b;
}
public static Bitmap RotateImage(Image inputImage, float angleDegrees, bool upsizeOk,
bool clipOk, Color backgroundColor)
{
// Test for zero rotation and return a clone of the input image
if (angleDegrees == 0f)
return (Bitmap)inputImage.Clone();
// Set up old and new image dimensions, assuming upsizing not wanted and clipping OK
int oldWidth = inputImage.Width;
int oldHeight = inputImage.Height;
int newWidth = oldWidth;
int newHeight = oldHeight;
float scaleFactor = 1f;
// If upsizing wanted or clipping not OK calculate the size of the resulting bitmap
if (upsizeOk || !clipOk)
{
double angleRadians = angleDegrees * Math.PI / 180d;
double cos = Math.Abs(Math.Cos(angleRadians));
double sin = Math.Abs(Math.Sin(angleRadians));
newWidth = (int)Math.Round(oldWidth * cos + oldHeight * sin);
newHeight = (int)Math.Round(oldWidth * sin + oldHeight * cos);
}
// If upsizing not wanted and clipping not OK need a scaling factor
if (!upsizeOk && !clipOk)
{
scaleFactor = Math.Min((float)oldWidth / newWidth, (float)oldHeight / newHeight);
newWidth = oldWidth;
newHeight = oldHeight;
}
// Create the new bitmap object. If background color is transparent it must be 32-bit,
// otherwise 24-bit is good enough.
Bitmap newBitmap = new Bitmap(newWidth, newHeight, backgroundColor == Color.Transparent ?
PixelFormat.Format32bppArgb : PixelFormat.Format24bppRgb);
newBitmap.SetResolution(inputImage.HorizontalResolution, inputImage.VerticalResolution);
// Create the Graphics object that does the work
using (Graphics graphicsObject = Graphics.FromImage(newBitmap))
{
graphicsObject.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphicsObject.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphicsObject.SmoothingMode = SmoothingMode.HighQuality;
// Fill in the specified background color if necessary
if (backgroundColor != Color.Transparent)
graphicsObject.Clear(backgroundColor);
// Set up the built-in transformation matrix to do the rotation and maybe scaling
graphicsObject.TranslateTransform(newWidth / 2f, newHeight / 2f);
if (scaleFactor != 1f)
graphicsObject.ScaleTransform(scaleFactor, scaleFactor);
graphicsObject.RotateTransform(angleDegrees);
graphicsObject.TranslateTransform(-oldWidth / 2f, -oldHeight / 2f);
// Draw the result
graphicsObject.DrawImage(inputImage, 0, 0);
}
return newBitmap;
}
}
public class versandscript
{
public string bezeichnung { get; set; } = "Versandstrassenparaemter";
public int dokumenttypnr { get; set; } = 0;
public string Split_Doc { get; set; } = "";
public string PartCopies { get; set; } = "";
public string FinalDoc { get; set; } = "";
public List<vsdokument> dokuments { get; set; } = new List<vsdokument>();
}
public class vsdokument
{
public bool Logo { get; set; } = true;
public bool LogoColor { get; set; } = false;
public int LogoTop { get; set; } = 0;
public int LogoLeft { get; set; } = 0;
public int LogoHeigth { get; set; } = 0;
public int LogoWidth { get; set; } = 0;
public string LogoOnPages { get; set; } = "1";
public string sourcedokument { get; set; } = "";
public string pdfdokument { get; set; } = "";
public List<TextReplace> TextReplaces { get; set; } = new List<TextReplace>();
}
public class TextReplace
{
public string TextToReplace { get; set; } = "";
public string NewText { get; set; } = "";
public string Fontname { get; set; } = "";
public string Fontsize { get; set; } = "";
public string BGColor { get; set; } = "";
public string Boxpos_X { get; set; } = "";
public string Boxpos_Y { get; set; } = "";
public string Boxpos_W { get; set; } = "";
public string Boxpos_H { get; set; } = "";
}
}