C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location

This commit is contained in:
2021-10-25 14:19:37 +00:00
parent 2b25136036
commit 033df8ccb3
5 changed files with 293 additions and 34 deletions

View File

@@ -73,6 +73,10 @@ namespace Volian.Print.Library
private MergedPdfsPageNumCorner _corner;
private float _xloc = 0;
private float _yloc = 0;
// C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
private MergedPdfsPageNumCorner _landcorner;
private float _landxloc = 0;
private float _landyloc = 0;
// the following constructs the class that contains data for merging a group of pdfs.
public MergedPdf(string folder, DocVersionInfo dvi)
{
@@ -182,6 +186,7 @@ namespace Volian.Print.Library
float pgleft = page.BoundingBox.Left;
float pgtop = page.BoundingBox.Top;
float pgbot = page.BoundingBox.Bottom;
MergedPdfsPageNumCorner cnr = _corner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
// B2019-152: Landscape page numbers when merging
if (landscape)
{
@@ -189,6 +194,7 @@ namespace Volian.Print.Library
pgleft = page.BoundingBox.Bottom;
pgtop = page.BoundingBox.Right;
pgbot = page.BoundingBox.Left;
cnr = _landcorner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
}
Phrase ph = new Phrase();
Chunk chk = new Chunk(outputpage, _itextFont);
@@ -196,7 +202,7 @@ namespace Volian.Print.Library
Paragraph pg = new Paragraph(ph);
ColumnText columnText = new ColumnText(cb);
cb.SaveState();
switch (_corner)
switch (cnr)
{
case MergedPdfsPageNumCorner.TopRight:
columnText.Alignment = Element.ALIGN_RIGHT;
@@ -204,7 +210,7 @@ namespace Volian.Print.Library
{
System.Drawing.Drawing2D.Matrix myMatrix1 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0);
cb.Transform(myMatrix1);
columnText.SetSimpleColumn(0, pgright - _yloc, pgright - _xloc, 0);
columnText.SetSimpleColumn(0, pgright - _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y
}
else
columnText.SetSimpleColumn(0, pgtop - _yloc, pgright - _xloc, 0);
@@ -215,7 +221,7 @@ namespace Volian.Print.Library
{
System.Drawing.Drawing2D.Matrix myMatrix2 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Width, 0);
cb.Transform(myMatrix2);
columnText.SetSimpleColumn(0, _yloc, pgright - _xloc, 0);
columnText.SetSimpleColumn(0, _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y
}
else
columnText.SetSimpleColumn(0, _yloc, pgright - _xloc, 0);
@@ -225,7 +231,7 @@ namespace Volian.Print.Library
{
System.Drawing.Drawing2D.Matrix myMatrix3 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0);
cb.Transform(myMatrix3);
columnText.SetSimpleColumn(_xloc, pgright - _yloc, pgright - _xloc, 0);
columnText.SetSimpleColumn(_xloc, pgright - _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y
}
else
{
@@ -237,7 +243,7 @@ namespace Volian.Print.Library
{
System.Drawing.Drawing2D.Matrix myMatrix4 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Width, 0);
cb.Transform(myMatrix4);
columnText.SetSimpleColumn(_xloc, _yloc, pgright - _xloc, 0);
columnText.SetSimpleColumn(_xloc, _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y
}
else
{
@@ -284,6 +290,10 @@ namespace Volian.Print.Library
_xloc = (float)dvc.Print_MergedPdfsPageNumLocX * 72;
_yloc = (float)dvc.Print_MergedPdfsPageNumLocY * 72;
_corner = dvc.Print_MergedPdfsPageNumCorner;
// C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
_landxloc = (float)dvc.Print_MergedPdfsLandPageNumLocX * 72;
_landyloc = (float)dvc.Print_MergedPdfsLandPageNumLocY * 72;
_landcorner = dvc.Print_MergedPdfsLandPageNumCorner;
return true;
}