Eliminate Forced pagination problems in IP2 Bck

Resize figures when figure is bigger than page
Remove {NULLDOCCURPAGE} when processing page numbers
This commit is contained in:
Kathy Ruffing 2014-10-14 13:39:52 +00:00
parent f994210ea6
commit 4ebc193d09
3 changed files with 38 additions and 3 deletions

View File

@ -243,12 +243,31 @@ namespace Volian.Print.Library
// ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); // ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
if (MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0) if (MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0)
yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage();
if (KeepStepsOnPage && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel && YSize == ySizeIncludingFirst && YSize + yEndMsg > yWithinMargins)
if (KeepStepsOnPage
&& !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel
&& YSize == ySizeIncludingFirst
&& YSize + yEndMsg > yWithinMargins)
{ {
// If the first step is the size of the entire step and the step has an end message then don't try to break the step // If the first step is the size of the entire step and the step has an end message then don't try to break the step
KeepStepsOnPage = false; KeepStepsOnPage = false;
//_MyLog.WarnFormat("Kick Step to Next Page {0},{1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); //_MyLog.WarnFormat("Kick Step to Next Page {0},{1}", MyItemInfo.ItemID, MyItemInfo.ShortPath);
} }
if (yWithinMargins < SixLinesPerInch) KeepStepsOnPage = false; // if there is no room to print, don't keep steps on the page
// The following was added for IP2 background printing. There were situations where there was a HLS and its paragraph was
// put on next page (IP2 bck: E-3/References), and a paragraph was writing into the footer (FR-H.1 step 2.2.3.1. KBR 10/14/14)
if (KeepStepsOnPage
&& MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel
&& YSize == ySizeIncludingFirst
&& ((ChildrenBelow.Count >= 1 && ChildrenBelow[0].MyItemInfo.IsParagraph && ChildrenBelow[0].ChildrenBelow.Count == 0)
|| ChildrenBelow.Count == 0))
{
KeepStepsOnPage = false;
}
// Keep figure (the only figure, i.e. count==1) with its parent.
if (ChildrenBelow.Count == 1 && ChildrenBelow[0].MyItemInfo.IsFigure) KeepStepsOnPage = false;
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 // Don't want extra line before step

View File

@ -2055,6 +2055,8 @@ namespace Volian.Print.Library
return ItemInfo.RomanNumbering(CurrentPageNumber).ToLower(); return ItemInfo.RomanNumbering(CurrentPageNumber).ToLower();
case "{SETREV}": case "{SETREV}":
return MySection.MyDocVersion.DocVersionConfig.ProcedureSetRev; return MySection.MyDocVersion.DocVersionConfig.ProcedureSetRev;
case "{NULLDOCCURPAGE}":
return "";
} }
if (!_MissingTokens.Contains(match.Value)) if (!_MissingTokens.Contains(match.Value))
{ {

View File

@ -795,7 +795,11 @@ namespace Volian.Print.Library
yPageStart = yTopMargin + YVeryTop; yPageStart = yTopMargin + YVeryTop;
yLocation = yPageStart - YOffset; // yLocation is physical location from bottom of page. yLocation = yPageStart - YOffset; // yLocation is physical location from bottom of page.
} }
if (yLocation - Height < 24) _MyLog.WarnFormat("Very Low {0},{1},{2},{3},{4},{5}",MyItemInfo.ShortPath,MyItemInfo.ItemID,yLocation,Height,yLocation-Height,yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength); if (yLocation - Height < 24)
{
if (DebugPagination.IsOpen)
DebugPagination.WriteLine("Very Low {0},{1},{2},{3},{4},{5}", MyItemInfo.ShortPath, MyItemInfo.ItemID, yLocation, Height, yLocation - Height, yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength);
}
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), 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 if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed. { // pagination logic needs to be fixed.
@ -1918,6 +1922,13 @@ namespace Volian.Print.Library
get { return _Suffix; } get { return _Suffix; }
set { _Suffix = value; } set { _Suffix = value; }
} }
private float RoughSizeOfPage
{
get
{
return (float)(MyItemInfo.MyDocStyle.Layout.PageLength - MyItemInfo.MyDocStyle.Layout.TopMargin - MyItemInfo.MyDocStyle.Layout.FooterLength);
}
}
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren) public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren)
{ {
Prefix = prefix; Prefix = prefix;
@ -2393,7 +2404,10 @@ namespace Volian.Print.Library
string[] vals = val.Split("\n".ToCharArray()); string[] vals = val.Split("\n".ToCharArray());
Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips; Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips;
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier); int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
Height = lines * SixLinesPerInch; // Check that the Height of figure isn't too big to fit on the page, if it is
// set the Height to the printable part of page - Height of the HLS and an extra line
// for between HLS & figure.
Height = Math.Min(lines * SixLinesPerInch, RoughSizeOfPage - MyParent.Height - SixLinesPerInch);
//yForCheckoff = yoff + Height - SixLinesPerInch; //yForCheckoff = yoff + Height - SixLinesPerInch;
if (dropCheckoff) if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text