C2020-002 Logic to use either the Letter or A4 paper size

This commit is contained in:
2020-02-14 17:16:28 +00:00
parent 2234bde5e1
commit b41320ed24
15 changed files with 111 additions and 47 deletions

View File

@@ -56,7 +56,8 @@ namespace Volian.Print.Library
}
public void Process()
{
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER);
iTextSharp.text.Document document = new iTextSharp.text.Document(PaperSizeRec); // C2020-002 paper size is now set in the format files
int paperSizePoints = PDFPageSize.PaperSizePoints(PaperSize); // C2020-002 paper size is now set in the format files
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(FileName, FileMode.Create));
document.Open();
// Open RTF Document
@@ -65,9 +66,9 @@ namespace Volian.Print.Library
Paragraph para = rtf2IText.Convert();
para.SetLeading(12F, 0);
PdfContentByte cb = writer.DirectContent;
SampleParagraphs(para, cb, 792-36, 252, 36);
para.Add(new Chunk(" (continued)",para.Font));
SampleParagraphs(para, cb, 792 - 36, 252, 324);
SampleParagraphs(para, cb, paperSizePoints - 36, 252, 36); // C2020-002 paper size is now set in the format files
para.Add(new Chunk(" (continued)", para.Font));
SampleParagraphs(para, cb, paperSizePoints - 36, 252, 324); // C2020-002 paper size is now set in the format files
// Close the document
document.Close();
}
@@ -80,6 +81,17 @@ namespace Volian.Print.Library
yTop = newYTop;
}
}
private static string _PaperSize = "LETTER"; // default paper size
public static string PaperSize // C2020-002 paper size is now set in the format files
{
get { return Rtf2Pdf._PaperSize; }
set { Rtf2Pdf._PaperSize = value; }
}
private Rectangle _PaperSizeRec = PageSize.LETTER; // default paper size
public Rectangle PaperSizeRec
{
get { return PDFPageSize.UsePaperSize(PaperSize); }
}
private static bool _PdfDebug = true;
public static bool PdfDebug
{
@@ -310,11 +322,12 @@ namespace Volian.Print.Library
float top = y + Offset.Y;
float right = left + width;
float bottom = top - height;
int paperSizePoints = PDFPageSize.PaperSizePoints(myGrid.MyFlexGrid.MyDVI.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
ColumnText myColumnText = new ColumnText(cb);
myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin);
//if (textLayer != null) cb.BeginLayer(textLayer); // RHM20150507 Table Scrunch
// C2018-004 create meta file for baseline compares
if (top + GridTopAdjust > 792) // B2019-110 Table continued on the next page - off the top of page
if (top + GridTopAdjust > paperSizePoints) // B2019-110 Table continued on the next page - off the top of page
{
_MyLog.ErrorFormat("\r\n===> Table Printing Off the Top of Page");
Volian.Base.Library.BaselineMetaFile.WriteLine("## Error - Grid Off the Top of Page");