Improved accounting for bottom continue messages for pagination
Bottom Message (below text) fix and pagination improvements Include RNO separator in ‘BottomContent’ calculation Reset ‘BottomContent’ for each page & added ruler for bottom of page
This commit is contained in:
parent
65bfcdb9b8
commit
06ba7bf825
@ -196,7 +196,8 @@ namespace Volian.Print.Library
|
||||
else
|
||||
firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count - 1];
|
||||
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
|
||||
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > yWithinMargins;
|
||||
float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);
|
||||
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess);
|
||||
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
|
||||
KeepStepsOnPage = false;
|
||||
if (ySizeIncludingFirst == YSize) KeepStepsOnPage = false;
|
||||
@ -404,6 +405,8 @@ namespace Volian.Print.Library
|
||||
float mySize7LPI = mySize; // +SixLinesPerInch;
|
||||
if (_Match16BitPagination) mySize7LPI += SixLinesPerInch;
|
||||
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
|
||||
float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);
|
||||
if (KeepStepsOnPage && ySizeIncludingFirst > (yWithinMargins - ySizeBtmCtnMess1)) KeepStepsOnPage = false;
|
||||
if (!KeepWithHeader && !KeepStepsOnPage && mySize - SixLinesPerInch + yEndMsg - tableSpaceAvailable <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break
|
||||
{
|
||||
// Don't want extra line before step
|
||||
@ -720,8 +723,7 @@ namespace Volian.Print.Library
|
||||
//while ((YSize - yTop) >= ySpaceOnCurPage)
|
||||
// Pagination Fix Break1LineShort3b
|
||||
DocStyle docstyle = MyItemInfo.MyDocStyle;
|
||||
string myBottomMsg = docstyle.Continue.Bottom.Message;
|
||||
float myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
|
||||
float myBottomMsgSpace = GetBottomContinueMessageSize(docstyle);
|
||||
switch (docstyle.Continue.Bottom.Location)
|
||||
{
|
||||
case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page
|
||||
@ -1093,6 +1095,16 @@ namespace Volian.Print.Library
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
|
||||
private float GetBottomContinueMessageSize(DocStyle docstyle)
|
||||
{
|
||||
float myBottomMsgSpace = 0;
|
||||
docstyle = MyItemInfo.MyDocStyle;
|
||||
string myBottomMsg = docstyle.Continue.Bottom.Message;
|
||||
myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
|
||||
if (myBottomMsg != null && myBottomMsg.Contains("par")) myBottomMsgSpace += SixLinesPerInch;
|
||||
return myBottomMsgSpace;
|
||||
}
|
||||
|
||||
private bool JustATableThatWillFit(vlnParagraph paraBreak, float ypagesize)
|
||||
{
|
||||
if (paraBreak.MyItemInfo.MyContent.Text.Replace(" ", "").Replace(@"\u160?", "").Replace(@"\'A0", "") != "") return false;
|
||||
|
@ -241,7 +241,12 @@ namespace Volian.Print.Library
|
||||
DrawChangeBars(writer.DirectContent);
|
||||
DrawMessages(writer.DirectContent);
|
||||
if (!CreatingFoldoutPage)
|
||||
{
|
||||
DrawRuler(writer.DirectContent);
|
||||
float x = MySection == null ? 555 : (float)MySection.MyDocStyle.Layout.PageWidth;
|
||||
DrawBottomRuler(writer.DirectContent, x / 2 - 144); //aer column
|
||||
DrawBottomRuler(writer.DirectContent, x - 144); //rno column
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -308,11 +313,48 @@ namespace Volian.Print.Library
|
||||
}
|
||||
PageListTopCheckOffHeader = null;
|
||||
PageListLastCheckOffHeader = null;
|
||||
BottomContent = null;
|
||||
YMultiplier = 1;
|
||||
PrintedAPage = true;
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
|
||||
private void DrawBottomRuler(PdfContentByte cb, float x)
|
||||
{
|
||||
VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
if (myPageHelper.DebugLayer != null)
|
||||
{
|
||||
cb.BeginLayer(myPageHelper.DebugLayer);
|
||||
cb.SaveState();
|
||||
cb.SetLineWidth(.1F);
|
||||
cb.SetColorStroke(new Color(System.Drawing.Color.Plum));
|
||||
float height = 350;
|
||||
float yTop = 350;
|
||||
float yBottom = yTop - height;
|
||||
cb.MoveTo(x, yTop);
|
||||
cb.LineTo(x, yBottom);
|
||||
if (myPageHelper.BottomContent != null)
|
||||
{
|
||||
cb.MoveTo(0, (float)myPageHelper.BottomContent);
|
||||
cb.LineTo(792, (float)myPageHelper.BottomContent);
|
||||
}
|
||||
int i = 0;
|
||||
for (float y = yBottom; y <= yTop; y += 10)
|
||||
{
|
||||
float w = 10;
|
||||
if (i % 10 == 0) w = 30;
|
||||
else if (i % 5 == 0) w = 20;
|
||||
cb.SetLineWidth(w / 30);
|
||||
i++;
|
||||
cb.MoveTo(x + w, y);
|
||||
cb.LineTo(x, y);
|
||||
cb.Stroke();
|
||||
}
|
||||
i = 0;
|
||||
cb.Stroke();
|
||||
cb.RestoreState();
|
||||
cb.EndLayer();
|
||||
}
|
||||
}
|
||||
private void DrawVertical(PdfContentByte cb, float x, float top, float bottom)
|
||||
{
|
||||
cb.SaveState();
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
//using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
using iTextSharp.text.pdf;
|
||||
@ -935,6 +935,7 @@ namespace Volian.Print.Library
|
||||
// }
|
||||
// MyPageHelper.BottomContent = yLocation - Height;
|
||||
//if (MyItemInfo.InList(39048)) Console.WriteLine("Here");
|
||||
MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier);
|
||||
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
//}
|
||||
@ -1361,7 +1362,7 @@ namespace Volian.Print.Library
|
||||
//`88b ooo d8( 888 o. )88b 888 .o 888
|
||||
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' o888o
|
||||
case 1: // Break on High Level Step
|
||||
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
docstyle = MyItemInfo.MyDocStyle;
|
||||
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
|
||||
bool doSectionContinue = !MyItemInfo.IsSection && ((docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue);
|
||||
@ -1410,8 +1411,8 @@ namespace Volian.Print.Library
|
||||
}
|
||||
yPageStart = yTopMargin + YTopMost;
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
|
||||
if (doSectionContinue ) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null);
|
||||
// KBR for WCNTRN work: SectionTopMessage(cb, yTopMargin, yLocation);
|
||||
if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null);
|
||||
// If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it
|
||||
if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && (!MyItemInfo.IsSection || MyItemInfo.IsSeparateSubsection))
|
||||
{
|
||||
@ -1432,7 +1433,7 @@ namespace Volian.Print.Library
|
||||
// `88b ooo d8( 888 o. )88b 888 .o .oP .o
|
||||
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' 8888888888
|
||||
case 2: // Break within a Step
|
||||
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
docstyle = MyItemInfo.MyDocStyle;
|
||||
bool doAlarmBox = false;
|
||||
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
|
||||
@ -1549,6 +1550,7 @@ namespace Volian.Print.Library
|
||||
doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle;
|
||||
}
|
||||
}
|
||||
// KBR for WCNTRN work:SectionTopMessage(cb, yTopMargin, yLocation);
|
||||
if (!doSectionTitleContinued || !SectionShowTitles)
|
||||
addExtraLines = DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, doThreeContinues && MyItemInfo.MyParent != null && MyItemInfo.MyParent.MyTab != null ? MyItemInfo.MyParent.MyTab.CleanText : null);
|
||||
|
||||
@ -1604,7 +1606,7 @@ namespace Volian.Print.Library
|
||||
case 3: // Break on High Level Step (SevenLinesPerInch)
|
||||
if (!firstHighLevelStep)
|
||||
{
|
||||
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
|
||||
MyPromsPrinter.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection)
|
||||
//_MyLog.InfoFormat("NewPage 12 {0}", cb.PdfWriter.CurrentPageNumber);
|
||||
@ -1731,7 +1733,7 @@ namespace Volian.Print.Library
|
||||
MyPageHelper.ParaBreaks[0] == this)
|
||||
{
|
||||
ShowPageBreak(1, CheckForCompression("PageBreakOnStep/Caution/Note HLS"), "Yes", YTop - YBottomMost, yTopMargin - yBottomMargin, yTopMargin - yBottomMargin, false);
|
||||
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
|
||||
MyPageHelper.BottomMessage = null;
|
||||
MyPageHelper.TopMessage = null;
|
||||
MyPromsPrinter.NewPage();
|
||||
@ -1846,6 +1848,29 @@ namespace Volian.Print.Library
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return yPageStart;
|
||||
}
|
||||
// KBR: WCNTRN work
|
||||
//private void SectionTopMessage(PdfContentByte cb, float yTopMargin, float yLocation)
|
||||
//{
|
||||
// if (MyItemInfo.MyDocStyle.SectTop != null && MyItemInfo.MyDocStyle.SectTop.Message != null)
|
||||
// {
|
||||
// float sectMsgY = CalculateYLocation(YTop, yTopMargin);
|
||||
// if (MyPageHelper.YMultiplier != 1)
|
||||
// {
|
||||
// sectMsgY = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier;
|
||||
// }
|
||||
// VE_Font sctMsgFont = MyItemInfo.MyDocStyle.SectTop.Font;
|
||||
// string scttop = null;
|
||||
// if (!MyItemInfo.IsStepSection && MyItemInfo.MyDocStyle.SectTop.Message != null)
|
||||
// scttop = MyItemInfo.MyDocStyle.SectTop.Message.Replace("%s", (MyItemInfo.ActiveSection as SectionInfo).DisplayNumber);
|
||||
// else
|
||||
// scttop = (MyItemInfo as SectionInfo).DisplayNumber;
|
||||
// float scttopWidth = scttop.Length * 6;
|
||||
// float ctr = (float)MyItemInfo.MyDocStyle.SectTop.Margin;
|
||||
// float sctcntrX = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctr - (scttopWidth / 2);
|
||||
// vlnText mySectMsg = new vlnText(cb, this, scttop, scttop, sctcntrX, sectMsgY, sctMsgFont);
|
||||
// PartsLeft.Add(mySectMsg);
|
||||
// }
|
||||
//}
|
||||
// Added to try to resolve a problem when printing FNP-1-FRP-I.3 Attachment 3 Table 1.
|
||||
// May be needed to evaluate this problem in the future.
|
||||
//private void CompareSectionInfo(SectionInfo si, SectionInfo si1)
|
||||
@ -2128,7 +2153,9 @@ namespace Volian.Print.Library
|
||||
switch (docstyle.Continue.Bottom.Location)
|
||||
{
|
||||
case E_ContBottomLoc.EndOfText: // place continue string at end of text
|
||||
msg_yLocation = msg_yLocation + yLocation - SixLinesPerInch;
|
||||
// msg_yLocation accounts for extra lines in message from docstyle; and BottomContent is the actual
|
||||
// location of the last line of text on page.
|
||||
msg_yLocation = msg_yLocation + ((float)MyPageHelper.BottomContent - (SixLinesPerInch * MyPageHelper.YMultiplier));
|
||||
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
|
||||
if (yBottomMargin + (docstyle.Layout.FooterLength ?? 0) > msg_yLocation)
|
||||
{ // Adjusted Continue Message Y Offset
|
||||
@ -2168,7 +2195,6 @@ namespace Volian.Print.Library
|
||||
_MyLog.WarnFormat("**** BOTTOM CONTINUE MESSAGE NOT CODED FOR LOCATION {0}*****", docstyle.Continue.Bottom.Location);
|
||||
break;
|
||||
}
|
||||
MyPageHelper.BottomContent = null;// RHM20150525 - Table Scrunch
|
||||
if (!PageBreakOnStep)
|
||||
{
|
||||
float xoffB = 0;
|
||||
@ -2271,23 +2297,28 @@ namespace Volian.Print.Library
|
||||
return true;
|
||||
}
|
||||
}
|
||||
private void OutputOtherPageSteps(PdfContentByte cb, float YTopMost, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||
private float OutputOtherPageSteps(PdfContentByte cb, float YTopMost, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||
{
|
||||
float retval = YTopMost;
|
||||
// Find any items remaining in MyPageHelper.MyParagraphs that should be printed on this page.
|
||||
vlnParagraphs process = new vlnParagraphs(null);
|
||||
foreach (vlnParagraph vPara in MyPageHelper.MyParagraphs.Values)
|
||||
{
|
||||
if (vPara.MyItemInfo.InList(3351)) Console.WriteLine("here");
|
||||
//if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost))
|
||||
if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
|
||||
if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost))
|
||||
if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // RHM20150507 Table Scrunch
|
||||
process.Add(vPara);
|
||||
else // RHM20150507 Table Scrunch
|
||||
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}",MyItemInfo.ItemID,MyItemInfo.ShortPath);
|
||||
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath);
|
||||
else if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
|
||||
retval = Math.Min(retval, vPara.YOffset);
|
||||
}
|
||||
foreach (vlnParagraph vPara in process)
|
||||
{
|
||||
vPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private float _YVeryTop = -1;
|
||||
public float YVeryTop
|
||||
@ -4060,20 +4091,20 @@ namespace Volian.Print.Library
|
||||
{
|
||||
stText = " ";
|
||||
// turn underline off
|
||||
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, FontStyle.Regular); //myFont.Style. | FontStyle.Underline);
|
||||
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, System.Drawing.FontStyle.Regular); //myFont.Style. | FontStyle.Underline);
|
||||
}
|
||||
else
|
||||
stText = vlntxt.StartText;
|
||||
|
||||
if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout)
|
||||
{
|
||||
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | FontStyle.Underline);
|
||||
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | System.Drawing.FontStyle.Underline);
|
||||
stText = stText.Replace(@"\ulnone ", "");
|
||||
stText = stText.Replace(@"\ulnone", "");
|
||||
}
|
||||
if (stText.Contains("{IND}")) stText = stText.Replace("{IND}", "\x5");
|
||||
if (itemInfo.IsSection && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && itemInfo.MyParent.IsProcedure)
|
||||
myFont = new System.Drawing.Font(myFont.FontFamily, 14, myFont.Style | FontStyle.Bold);
|
||||
myFont = new System.Drawing.Font(myFont.FontFamily, 14, myFont.Style | System.Drawing.FontStyle.Bold);
|
||||
_RtfSB.Append(AddFontTable(myFont));
|
||||
_RtfSB.Append(stText);
|
||||
if (_MyItemInfo.IsStep && !itemInfo.FormatStepData.UseSmartTemplate && _MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
|
||||
|
@ -74,6 +74,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
else
|
||||
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin);
|
||||
MyPageHelper.BottomContent = yLocation-SixLinesPerInch;
|
||||
return yPageStart;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user