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

@@ -546,7 +546,7 @@ namespace Volian.Print.Library
}
else // don't use Word margins
{
rct = PageSize.LETTER;
rct = PDFPageSize.UsePaperSize(MyItem.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
}
// C2018-004 create meta file for baseline compares
if (currentSection.IsStepSection)
@@ -761,7 +761,7 @@ namespace Volian.Print.Library
// Create an MSWord Pdf
// Setup a pdf Document for printing
OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before);
iTextSharp.text.Rectangle rct = PageSize.LETTER;
iTextSharp.text.Rectangle rct = PDFPageSize.UsePaperSize(myProcedure.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
if (myProcedure.Sections != null && !myProcedure.Sections[0].IsStepSection && !doingFoldout) // B2019-166 also don't do this if doing a foldout else it will use the margins set in word
{
SectionInfo si = myProcedure.Sections[0] as SectionInfo;
@@ -1271,7 +1271,7 @@ namespace Volian.Print.Library
private void GenerateTOC(SectionInfo tocSection, ProcedureInfo myProcedure, PdfContentByte cb, PdfLayer textLayer)
{
iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter;
float _PointsPerPage = 792;
float _PointsPerPage = PDFPageSize.PaperSizePoints(myProcedure.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
float yTopMargin = _PointsPerPage - (float)tocSection.MyDocStyle.Layout.TopMargin;
float yBottomMargin = Math.Max(0, yTopMargin - (float)tocSection.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch);
if (textLayer != null) cb.BeginLayer(textLayer);
@@ -1782,8 +1782,8 @@ namespace Volian.Print.Library
section.StepSectPageBreaksForSupInfo.Clear();
section.StepSectPageBreaks.Clear();
}
// 792: 72 * 11 inches - TopRow - Top is high value
float _PointsPerPage = 792;
// 792: 72 * 11 inches - TopRow - Top is high value for 8.5x11 paper, 842 for A4 paper
float _PointsPerPage = PDFPageSize.PaperSizePoints(myItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin;
yTopMargin -= _MyHelper.AdjustTopMarginForMultiLinePageListItems;
// the following line was modified to comment out the - 2 * SixLinesPerInch. this fixed a pagination problem with WCN EMG E-3.
@@ -1909,7 +1909,8 @@ namespace Volian.Print.Library
if (SupInfoPdfPage == null) SupInfoPdfPage = new Dictionary<int, int>();
else SupInfoPdfPage.Clear();
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + vlnParagraph.MyItemInfo.ItemID.ToString() + @".pdf";
PdfContentByte cb = OpenDoc(SupInfoPdfName, PageSize.LETTER);
iTextSharp.text.Rectangle pageSize = PDFPageSize.UsePaperSize(MyItem.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
PdfContentByte cb = OpenDoc(SupInfoPdfName, pageSize);
if (cb == null) return;
VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0);
cb.PdfWriter.PageEvent = myPageHelper;
@@ -2410,7 +2411,7 @@ namespace Volian.Print.Library
string key = string.Format("{0}.{1}", sectInfo.ItemID, pageNumber);
if(dicSize.ContainsKey(key))
return dicSize[key];
return PageSize.LETTER;
return PDFPageSize.UsePaperSize(sectInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
}
public void LoadTree(ItemInfo ii)
{