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

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

View File

@ -303,7 +303,9 @@ namespace Volian.Controls.Library
private void btnPrint_Click(object sender, EventArgs e)
{
OnPrintRequest(new DisplayLibDocEventArgs("Library Document Usage", LibDocList));
string paperSize = "Letter";
paperSize = LibDocList[listBoxLibDocs.SelectedIndex].LibraryDocumentUsageList[0].ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
OnPrintRequest(new DisplayLibDocEventArgs("Library Document Usage", LibDocList, paperSize));
}
}
public class DisplayLibDocEventArgs
@ -321,6 +323,14 @@ namespace Volian.Controls.Library
get { return _libDocList; }
set { _libDocList = value; }
}
private string _PaperSize; // C2020-002 paper size is now set in the format files
public string PaperSize
{
get { return _PaperSize; }
set { _PaperSize = value; }
}
//private string _SearchString = null;
//public string SearchString
//{
@ -339,10 +349,11 @@ namespace Volian.Controls.Library
// get { return _MyItemInfoList; }
// set { _MyItemInfoList = value; }
//}
public DisplayLibDocEventArgs(string reportTitle, DocumentInfoList libDocList)
public DisplayLibDocEventArgs(string reportTitle, DocumentInfoList libDocList, string paperSize)
{
_ReportTitle = reportTitle;
_libDocList = libDocList;
_PaperSize = paperSize; // C2020-002 paper size is now set in the format files
}
}
public delegate void DisplayLibDocEvent(object sender, DisplayLibDocEventArgs args);

View File

@ -954,6 +954,9 @@ namespace Volian.Controls.Library
}
private void btnPrintReport_Click(object sender, EventArgs e)
{
string paperSize = "Letter";
if (Mydocversion != null && Mydocversion.ActiveFormat != null)
paperSize = Mydocversion.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
//B2019-144 Set the document text color to Red (overlay) or Black (normal)
Color lastColor = MSWordToPDF.OverrideColor;// B2019-144 Remember override color
if (MSWordToPDF.OverrideColor != Color.Black)
@ -966,7 +969,7 @@ namespace Volian.Controls.Library
GenerateAccIDSortedROList();
else
GenerateROList();
OnPrintRequest(new DisplayReportsEventArgs("RO Summary Report", "RO Summary Report", MyROFSTLookup, ROList));
OnPrintRequest(new DisplayReportsEventArgs("RO Summary Report", "RO Summary Report", MyROFSTLookup, ROList, paperSize));
}
else if (cbxComplete.Checked) // Complete RO Report
{
@ -976,7 +979,8 @@ namespace Volian.Controls.Library
GenerateROList();
string ROList = GetListOfROs(false);//don't include the RODbID in the RO list
string roDataFile = BuildRODataFile(ROList);
OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, MyROFSTLookup, cbxComplete.Checked, this.Mydocversion.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, cbxIncldMissingROs.Checked));
if (Mydocversion != null)
OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, MyROFSTLookup, cbxComplete.Checked, Mydocversion.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, cbxIncldMissingROs.Checked, paperSize));
}
else if (cbxROUsage.Checked)
{
@ -988,10 +992,10 @@ namespace Volian.Controls.Library
{
Csla.SortedBindingList<ItemInfo> sortedResults = new Csla.SortedBindingList<ItemInfo>(SearchResults);
sortedResults.ApplySort("FoundROID", ListSortDirection.Ascending);
OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By RO", "RO Usage", sortedResults, usageSortedByProcedure, cbxIncldMissingROs.Checked));
OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By RO", "RO Usage", sortedResults, usageSortedByProcedure, cbxIncldMissingROs.Checked, paperSize));
}
else
OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By Procedure", "RO Usage", SearchResults, usageSortedByProcedure, cbxIncldMissingROs.Checked));
OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By Procedure", "RO Usage", SearchResults, usageSortedByProcedure, cbxIncldMissingROs.Checked, paperSize));
}
else if (cbxTransFromProcs.Checked)
{
@ -1079,7 +1083,13 @@ namespace Volian.Controls.Library
get { return _IncludeEmptyROFields; }
set { _IncludeEmptyROFields = value; }
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList, bool sortByProcedure, bool includeMissingROs)
private string _PaperSize = "Letter";
public string PaperSize // C2020-002 paper size is now set in the format files
{
get { return _PaperSize; }
set { _PaperSize = value; }
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList, bool sortByProcedure, bool includeMissingROs, string paperSize)
{
// RO Usage Report
_ReportTitle = reportTitle;
@ -1087,9 +1097,10 @@ namespace Volian.Controls.Library
_MyItemInfoList = myItemInfoList;
_SortUsageByProcedure = sortByProcedure;
_IncludeMissingROs = includeMissingROs;
_PaperSize = paperSize; // C2020-002 paper size is now set in the format files
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, ROFSTLookup rofstLookUp, bool completeROReport, bool convertCaretToDelta, bool includeEmptyROFields)
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, ROFSTLookup rofstLookUp, bool completeROReport, bool convertCaretToDelta, bool includeEmptyROFields, string paperSize)
{
_ReportTitle = reportTitle;
_TypesSelected = typesSelected;
@ -1098,14 +1109,16 @@ namespace Volian.Controls.Library
_ConvertCaretToDelta = convertCaretToDelta;
_rofstLookup = rofstLookUp;
_IncludeEmptyROFields = includeEmptyROFields;
_PaperSize = paperSize; // C2020-002 paper size is now set in the format files
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List<string> roListForReport)
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List<string> roListForReport, string paperSize)
{
// RO Summary Report
_ReportTitle = reportTitle;
_TypesSelected = typesSelected;
_rofstLookup = rofstLookUp;
_ROListForReport = roListForReport;
_PaperSize = paperSize; // C2020-002 paper size is now set in the format files
}
}
public delegate void DisplayReportsEvent(object sender, DisplayReportsEventArgs args);

View File

@ -2413,6 +2413,13 @@ namespace Volian.Controls.Library
get { return _HowLong; }
set { _HowLong = value; }
}
private string _PaperSize;
public string PaperSize // C2020-002 paper size is now set in the format files
{
get { return _PaperSize; }
set { _PaperSize = value; }
}
public DisplaySearchEventArgs(TimeSpan howLong)
{
HowLong = howLong;
@ -2423,6 +2430,12 @@ namespace Volian.Controls.Library
_TypesSelected = typesSelected;
_MyItemInfoList = myItemInfoList;
_SearchString = searchString;
foreach (ItemInfo tmpII in myItemInfoList)
if (tmpII != null && tmpII.ActiveFormat != null)
{
_PaperSize = tmpII.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
break;
}
}
}
public delegate void DisplaySearchEvent(object sender, DisplaySearchEventArgs args);

View File

@ -742,7 +742,6 @@ namespace Volian.Print.Library
AddText(Hdrs.strHdrs[iLoop].Replace("__"," "), F12Bold); // should be bold and first header is centered
}
}
static float _Top = 792;
public PdfDestination MyPdfDestTop
{
get

View File

@ -124,11 +124,12 @@ namespace Volian.Print.Library
int numPages = reader.NumberOfPages;
int currentPageNumber = 0;
PdfOutline outline = null;
Rectangle paperSize = PDFPageSize.UsePaperSize(_docVersionInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
do // merging pages into complete...
{
currentPageNumber += 1;
mergedPageNumber += 1;
doc.SetPageSize(PageSize.LETTER);
doc.SetPageSize(paperSize);
doc.NewPage();
PdfImportedPage page = writer.GetImportedPage(reader, currentPageNumber); // gets a page that is 'ready' to be written to combined pdf
if (doPageNum) // get the string & fill in with <page> and <of> numbers

View File

@ -59,7 +59,8 @@ namespace Volian.Print.Library
}
public void BuildChronology()
{
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
Rectangle paperSize = PDFPageSize.UsePaperSize(MyProc.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize);// C2020-002 paper size is now set in the format files
iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36);
if (!CreateResultsPDF(document)) return;
try
{
@ -92,7 +93,8 @@ namespace Volian.Print.Library
public void BuildSummary(bool openReport)
{
bool hasData = false;
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
Rectangle paperSize = PDFPageSize.UsePaperSize(MyProc.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36);
if (!CreateResultsPDF(document)) return;
try
{

View File

@ -37,7 +37,8 @@ namespace Volian.Print.Library
}
public void BuildReport()
{
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
Rectangle paperSize = PDFPageSize.UsePaperSize(MyDocVersion.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36);
if (!CreateResultsPDF(document)) return;
try
{
@ -225,7 +226,8 @@ namespace Volian.Print.Library
public void BuildAllReport(DocVersionInfo dvi)
{
MyDocVersion = dvi;
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
Rectangle paperSize = PDFPageSize.UsePaperSize(MyDocVersion.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36);
if (!CreateResultsPDF(document)) return;
try
{

View File

@ -75,8 +75,9 @@ namespace Volian.Print.Library
private bool _ConvertCaretToDelta = true;
private bool _IncludeEmptyROFields = false;
private string _PaperSize = "Letter"; // C2020-002 paper size is now set in the format files
// Search Results Report
public PDFReport(string reportTitle, string typesSelected, ICollection<ItemInfo> resultList, string fileName)
public PDFReport(string reportTitle, string typesSelected, ICollection<ItemInfo> resultList, string fileName, string paperSize)
{
_ResultList = resultList;
_FileName = fileName;
@ -84,21 +85,23 @@ namespace Volian.Print.Library
_TypesSelected = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(typesSelected);
_ReportType = (int)ReportType.SearchResults;
_ByLine = "PROMS Search Results";
_PaperSize = paperSize;
}
// Library Document Report
public PDFReport(string reportTitle, DocumentInfoList libDocList, string fileName)
public PDFReport(string reportTitle, DocumentInfoList libDocList, string fileName, string paperSize)
{
_LibDocList = libDocList;
_FileName = fileName;
_ReportTitle = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(reportTitle);
_ReportType = (int)ReportType.LibraryDocUsage;
_ByLine = "Generated By PROMS";
_PaperSize = paperSize;
}
// RO Usage
public PDFReport(string reportTitle, ICollection<ItemInfo> resultList, string fileName, bool sortUsageByProcedure, bool includeMissingROs)
public PDFReport(string reportTitle, ICollection<ItemInfo> resultList, string fileName, bool sortUsageByProcedure, bool includeMissingROs, string paperSize)
{
_ResultList = resultList;
_FileName = fileName;
@ -107,10 +110,11 @@ namespace Volian.Print.Library
_ByLine = "Generated By PROMS";
_SortUsageByProcedure = sortUsageByProcedure;
_IncludeMissingROs = includeMissingROs;
_PaperSize = paperSize;
}
// RO Complete RO Report
public PDFReport(string reportTitle, string roDataFile, string outfile, ROFSTLookup fstlookup, bool completeReport, bool convertCaretToDelta, bool includeEmptyROFields)
public PDFReport(string reportTitle, string roDataFile, string outfile, ROFSTLookup fstlookup, bool completeReport, bool convertCaretToDelta, bool includeEmptyROFields, string paperSize)
{
_FileName = outfile;
_ReportTitle = reportTitle;
@ -120,10 +124,11 @@ namespace Volian.Print.Library
_ConvertCaretToDelta = convertCaretToDelta;
_ROFSTLookup = fstlookup;
_IncludeEmptyROFields = includeEmptyROFields;
_PaperSize = paperSize;
}
// RO Summary Report
public PDFReport(string reportTitle, string outfile, ROFSTLookup fstlookup, List<string> roList)
public PDFReport(string reportTitle, string outfile, ROFSTLookup fstlookup, List<string> roList, string paperSize)
{
_FileName = outfile;
_ReportTitle = reportTitle;
@ -131,6 +136,7 @@ namespace Volian.Print.Library
_ByLine = "RO Summary Report";
_ROFSTLookup = fstlookup;
_ROList = roList;
_PaperSize = paperSize;
}
private string AddGroup(PdfPTable datatable, string dvPath, string lastDvPath, Font f2, bool StripLast, Color bgColor, bool skipFirst)
@ -365,7 +371,8 @@ namespace Volian.Print.Library
}
public void Build()
{
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
//iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
iTextSharp.text.Document document = new iTextSharp.text.Document(PDFPageSize.UsePaperSize(_PaperSize), 36, 36, 36, 36); // C2020-002 paper size is now set in the format files
if (!CreateResultsPDF(document, _ReportType)) return;
try
{

View File

@ -72,10 +72,13 @@ namespace Volian.Print.Library
get { return _ProcedureCount; }
set { _ProcedureCount = value; }
}
private string _PaperSize = "Letter";
public PDFTransitionReport(FolderInfo fi, string fileName)
{
_FileName = fileName;
folderInfo = fi;
if (fi.ActiveFormat != null)
_PaperSize = fi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
}
public PDFTransitionReport(ProcedureInfo pi, string fileName)
{
@ -83,10 +86,12 @@ namespace Volian.Print.Library
procedureInfo = pi;
transitionInfoList = TransitionInfoList.GetTransitionReportData(procedureInfo.MyDocVersion.VersionID, procedureInfo.ItemID);
_TransitionInfoCount = transitionInfoList.Count;
_PaperSize = pi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
}
public void BuildTransitionReport()
{
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER.Rotate(), 36, 36, 36, 36);
Rectangle paperSize = PDFPageSize.UsePaperSize(_PaperSize); // C2020-002 paper size is now set in the format files
iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize.Rotate(), 36, 36, 36, 36);
if (!CreateResultsPDF(document)) return;
try
{

View File

@ -768,8 +768,7 @@ namespace Volian.Print.Library
}
private float GetYPageSizeUseOnAllButFirstPage()
{
//float _PointsPerPage = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // A4 paper logic
float _PointsPerPage = 792;
float _PointsPerPage = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
int indx = (int)MyItemInfo.MyDocStyle.IndexOtherThanFirstPage;
foreach (DocStyle ds in MyItemInfo.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
{

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)
{

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);
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, 792 - 36, 252, 324);
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");

View File

@ -357,7 +357,7 @@ namespace Volian.Print.Library
if (myPageHelper.BottomContent != null)
{
cb.MoveTo(0, (float)myPageHelper.BottomContent);
cb.LineTo(792, (float)myPageHelper.BottomContent);
cb.LineTo(PDFPageSize.PaperSizePoints(MySection.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize), (float)myPageHelper.BottomContent); // C2020-002 paper size is now set in the format files
}
int i = 0;
for (float y = yBottom; y <= yTop; y += 12)
@ -715,7 +715,7 @@ i = 0;
float tmp = 0;
if (NotesToFootNotes != null && NotesToFootNotes.Count > 0)
{
float _PointsPerPage = 792;
float _PointsPerPage = (float)PDFPageSize.PaperSizePoints(MySection.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
float yTopMargin = _PointsPerPage - (float)MySection.MyDocStyle.Layout.TopMargin;
float myYOff = NotesToFootNotesYoffset;
foreach (vlnParagraph ntfn in NotesToFootNotes)
@ -1397,7 +1397,7 @@ i = 0;
//token = Regex.Replace(token, @"[\xB3-\xDF]", " ");
// handle any conditional PS tokens
if (plstr.Contains(@"PS="))
if (token.Contains(@"PS="))
{
ProcedureConfig procConfig = new ProcedureConfig(section.MyProcedure.MyContent.Config);
if (procConfig != null)

View File

@ -1381,8 +1381,7 @@ namespace Volian.Print.Library
}
private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)
{
//float _PointsPerPage = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // A4 paper logic
float _PointsPerPage = 792;
float _PointsPerPage = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
// if this document style has another style that is for pages other than first, we need to
// reset the document style off of this section AND reset docstyle values used.
// C2018-003 fixed use of getting the active section
@ -1706,8 +1705,7 @@ namespace Volian.Print.Library
if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination())
{
RefreshDocStyle();
//yTopMargin = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize) - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; // C2018-003 fixed use of getting the active section // A4 paper logic
yTopMargin = 792 - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; // C2018-003 fixed use of getting the active section
yTopMargin = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize) - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; // C2018-003 fixed use of getting the active section // C2020-002 paper size is now set in the format files
yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.PageLength); // C2018-003 fixed use of getting the active section
yPageStart = yTopMargin;
}
@ -2803,8 +2801,7 @@ namespace Volian.Print.Library
{
if (MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PrintSectOnFirst) == E_DocStructStyle.DSS_PrintSectOnFirst) // C2018-003 fixed use of getting the active section
{
//float localYTopMargin = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize) - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; // A4 paper logic
float localYTopMargin = 792 - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin;
float localYTopMargin = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize) - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; // C2020-002 paper size is now set in the format files
yBtmMarginForMsg = Math.Max(0, localYTopMargin - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.PageLength);
}
}

View File

@ -250,7 +250,8 @@ namespace Volian.Print.Library
public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException)
{
ColumnText myColumnText = new ColumnText(cb);
myColumnText.SetSimpleColumn(0, 792F, width, 0); // Bottom margin
float pgHeight = cb.PdfDocument.PageSize.Height; // C2020-002 paper size is now set in the format files
myColumnText.SetSimpleColumn(0, pgHeight, width, 0); // Bottom margin
if (suffix != string.Empty)
{
Chunk chk = iParagraph.Chunks[0] as Chunk;
@ -276,7 +277,7 @@ namespace Volian.Print.Library
//throw (new Exception("Paragraph longer than a page"));
Console.WriteLine("Paragraph longer than a page");
}
return 792F - myColumnText.YLine; // This gives the height of the Paragraph
return pgHeight - myColumnText.YLine; // This gives the height of the Paragraph // C2020-002 paper size is now set in the format files
}
public float GetTableWidth(PdfContentByte cb, Paragraph iParagraph, float? maxWidth)
{