update 20250413
This commit is contained in:
@@ -18,6 +18,7 @@ using Model;
|
||||
using Syncfusion.Pdf;
|
||||
using Syncfusion.Pdf.Graphics;
|
||||
using Syncfusion.Pdf.Parsing;
|
||||
using Syncfusion.XPS;
|
||||
|
||||
|
||||
namespace Versandstrasse
|
||||
@@ -57,7 +58,7 @@ namespace Versandstrasse
|
||||
string resturi = "";
|
||||
string apikey = "";
|
||||
|
||||
public string Prepare_PDF(string dokumentid, string tempdir, string connectionstring, string resturi, string apikey, string startuppath, versandscript vs = null, serienbrief sb = null, string sbsourcedok="")
|
||||
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)
|
||||
{
|
||||
Lic();
|
||||
this.resturi=resturi;
|
||||
@@ -145,7 +146,11 @@ namespace Versandstrasse
|
||||
{
|
||||
Add_Logo(ref loadedDocument, vdok.LogoColor, vdok.LogoLeft, vdok.LogoTop, vdok.LogoWidth, vdok.LogoHeigth, vdok.LogoOnPages,this.resturi,this.apikey,startuppath);
|
||||
}
|
||||
|
||||
|
||||
if (couvertpos)
|
||||
{
|
||||
drawcouvert(ref loadedDocument);
|
||||
}
|
||||
if (vdok.TextReplaces.Count > 0)
|
||||
{
|
||||
foreach (TextReplace tr in vdok.TextReplaces)
|
||||
@@ -336,6 +341,42 @@ namespace Versandstrasse
|
||||
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, 100, 45);
|
||||
|
||||
//Set the page Transparency$PdfSolidBrush brush = new PdfSolidBrush(Color.LightBlue);
|
||||
PdfSolidBrush brush = new PdfSolidBrush(Color.LightBlue);
|
||||
loadedPage.Graphics.Save();
|
||||
loadedPage.Graphics.SetTransparency(1, 1, PdfBlendMode.Multiply);
|
||||
|
||||
//Draw the rectangle on the PDF document
|
||||
loadedPage.Graphics.DrawRectangle(brush, bounds);
|
||||
|
||||
//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 = "";
|
||||
@@ -358,7 +399,7 @@ namespace Versandstrasse
|
||||
{
|
||||
PdfLoadedPage loadedPage = document.Pages[i] as PdfLoadedPage;
|
||||
PdfGraphics graphics = loadedPage.Graphics;
|
||||
graphics.DrawImage(image, 85, 30);
|
||||
graphics.DrawImage(image,left,top);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -372,7 +413,7 @@ namespace Versandstrasse
|
||||
int pageno = Convert.ToInt32(p) - 1;
|
||||
PdfLoadedPage loadedPage = document.Pages[pageno] as PdfLoadedPage;
|
||||
PdfGraphics graphics = loadedPage.Graphics;
|
||||
graphics.DrawImage(image, 85, 30);
|
||||
graphics.DrawImage(image, left, top);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user