diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 945bca05..3e81d892 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -227,7 +227,7 @@ namespace Volian.Print.Library // ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); if (MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0) yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); - if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break + if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break { // Don't want extra line before step //Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); @@ -436,8 +436,10 @@ namespace Volian.Print.Library break; } // also account for phonelist for locating bottom continue message: + float phoneListHeight = 0; if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList && MyPageHelper.PhoneListHeight != 0) - myBottomMsgSpace += (MyPageHelper.PhoneListHeight - vlnPrintObject.SixLinesPerInch); + phoneListHeight = MyPageHelper.PhoneListHeight; + ySpaceOnCurPage -= phoneListHeight; string myTopMsg = docstyle.Continue.Top.Message; float myTopMsgSpace = ((myTopMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; @@ -554,7 +556,7 @@ namespace Volian.Print.Library RemoveProcessedParagraphs(myList, yTopNew - yTop); yTop = yTopNew; MyPageHelper.ParaBreaks.Add(paraBreak); - ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line. + ySpaceOnCurPage = yPageSize - (myTopMsgSpace + phoneListHeight + SixLinesPerInch); // Allow for continue message and blank line. //ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line. //if (paraBreak.YTopMost != paraBreak.YVeryTop && MyPageHelper.TopMessage == null && MyPageHelper.BottomMessage == null) // ySpaceOnCurPage = yPageSize; diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 26d0def1..2b8adfd1 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -518,7 +518,7 @@ namespace Volian.Print.Library if (phlist != null && phlist != "") { // count lines: - int cl = 1; + int cl = 0; int indx = phlist.IndexOf("\n"); while (indx > 0) { @@ -528,6 +528,7 @@ namespace Volian.Print.Library else indx = phlist.IndexOf("\n", indx + 1); } + if (cl == 0) cl = 1; // phone list is a single line without an ending newline _MyHelper.PhoneListHeight = cl * vlnPrintObject.SixLinesPerInch; } } diff --git a/PROMS/Volian.Print.Library/Rtf2Pdf.cs b/PROMS/Volian.Print.Library/Rtf2Pdf.cs index 490d3262..e47ce00d 100644 --- a/PROMS/Volian.Print.Library/Rtf2Pdf.cs +++ b/PROMS/Volian.Print.Library/Rtf2Pdf.cs @@ -194,7 +194,7 @@ namespace Volian.Print.Library ColumnText ct = new ColumnText(cb); ct.SetSimpleColumn(left, 4 + top - yDescent, right, top - yDescent - 50); iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 2); - Chunk chk = new Chunk(debugText + string.Format(" Top = {0}",top), font); + Chunk chk = new Chunk(debugText + string.Format(", Top = {0}",top), font); Phrase ph = new Phrase(chk); ct.AddElement(ph); cb.SetColorFill(new Color(sysColor)); diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index c5e2a3b8..6c0d14c5 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -753,7 +753,7 @@ namespace Volian.Print.Library IParagraph.Chunks.RemoveAt(0); } } - retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin); + retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), yBottomMargin); if (retval == 0) // problem occurred - paragraph was not able to be printed on page { // pagination logic needs to be fixed. ForcePagination(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation, ref retval);