This commit is contained in:
@@ -29,6 +29,15 @@ namespace Volian.Print.Library
|
||||
private int Paginate(float yLocation, float yTopMargin, float yBottomMargin)
|
||||
{
|
||||
float yPageSize = yTopMargin - yBottomMargin;
|
||||
// yPageSizeNextPage is the page size of the 'next' page. A format variable exists off of the docstyle
|
||||
// For UseOnFirstPage vs UseOnAllButFirstPage. If this is set for this format, and processing the FIRST
|
||||
// page, the size of next page, which may be different, is used in pagination calculationstop.
|
||||
// If this format flag is not set, or not printing the first page of the section with this flag,
|
||||
// this next page size is the same as current page size.
|
||||
float yPageSizeNextPage = yPageSize;
|
||||
if (!MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
|
||||
yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage();
|
||||
|
||||
// TODO: This does not account for a long step as the last step that would exceed more than one page and
|
||||
// that has an end message that needs to be accounted for in determining pagination. To do that the last
|
||||
// child should be the only paragraph that accounts for the End message.
|
||||
@@ -150,20 +159,21 @@ namespace Volian.Print.Library
|
||||
|
||||
// YSize includes a blank line after the step which we don't want to include in the page break test, thus the
|
||||
// YSize - SixLinesPerInch:
|
||||
if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSize) // 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);
|
||||
ShowPageBreak(5, "HLS will fit on 1 Page at 6 LPI", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
// A page break will occur before the step is put out. ShowPageBreak with first argument of -1 is NOT a page break.
|
||||
ShowPageBreak(5, "HLS will fit on 1 Page at 6 LPI", "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
return 1;
|
||||
}
|
||||
// TODO - yEndMsg - compressed size?
|
||||
|
||||
// ySize7LPI includes a blank line after the step which we don't want to include in the page break test.
|
||||
else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps && (ySize7LPI - SixLinesPerInch) < (yPageSize * SixLinesPerInch / _SevenLinesPerInch))
|
||||
else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps && (ySize7LPI - SixLinesPerInch) < (yPageSizeNextPage * SixLinesPerInch / _SevenLinesPerInch))
|
||||
{
|
||||
//Console.WriteLine("'PageBreak',3,'Yes','HLS will fit on 1 Page at 7 LPI',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
||||
ShowPageBreak(7, "HLS will fit on 1 Page at 7 LPI", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
ShowPageBreak(7, "HLS will fit on 1 Page at 7 LPI", "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
//Console.WriteLine("'7LPI',{0},{1}", MyItemInfo.DBSequence, YSize);
|
||||
return 3; // High Level Step can fit at SevenLinesPerInch
|
||||
}
|
||||
@@ -174,18 +184,22 @@ namespace Volian.Print.Library
|
||||
if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch;
|
||||
// TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20.
|
||||
//float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit
|
||||
//is the amount of space left (yWithinMargins) is greater than 1/2 of the current page (yPageSize / 2):
|
||||
if (KeepWithHeader ||( !ManualPageBreak && ((MyItemInfo.ActiveFormat.MyStepSectionLayoutData.SpecialPageBreakFlag && yWithinMargins > yPageSize / 2 &&
|
||||
myFirstPieceSize < yWithinMargins) || KeepStepsOnPage)))
|
||||
{
|
||||
//Console.WriteLine("'PageBreak',4,'No','HLS will have to split anyway',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
||||
// yPageSize is space on next page. This may be different if the format flag 'UseOnAllButFirst' is
|
||||
// set.
|
||||
// yWithinMargins is space available on current page.
|
||||
if(firstStep == "Yes")
|
||||
ShowPageBreak(8, "First HLS has to split on current page", firstStep, YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
ShowPageBreak(8, "First HLS has to split on current page", firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
else
|
||||
ShowPageBreak(6, "HLS will have to split on current page", "Special", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
ShowPageBreak(6, "HLS will have to split on current page", "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
// if the HLS is part of a Smart Template (i.e. WCNCKL table), don't add in an extra line because
|
||||
// that makes pagination work incorrectly because the Smart Template has a 'table' line after the
|
||||
// text.
|
||||
BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
//BuildPageBreakList(yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate?0:SixLinesPerInch), yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
return 0; // Stay on this page
|
||||
}
|
||||
@@ -193,16 +207,16 @@ namespace Volian.Print.Library
|
||||
// Less than half a page left, start printing on a new page.
|
||||
//Console.WriteLine("'PageBreak',5,'Yes','HLS will have to split',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
||||
if (firstStep == "Yes")
|
||||
ShowPageBreak(9, "First HLS will have to split on new page", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
ShowPageBreak(9, "First HLS will have to split on new page", "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
else
|
||||
ShowPageBreak(3, "HLS will have to split on new page", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
ShowPageBreak(3, "HLS will have to split on new page", "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
// Determine items where page break(s) occur
|
||||
//BuildPageBreakList(yPageSize, yPageSize - 2 * SixLinesPerInch); // Case Base
|
||||
//BuildPageBreakList(yPageSize, yPageSize); // Case 1 :Works for ES05 Step 15 SubStep 7
|
||||
// Pagination Fix Break1LineShort2
|
||||
//BuildPageBreakList(yPageSize + yExtra, yPageSize); // Case 1 :Works for ES05 Step 15 SubStep 7
|
||||
// Pagination Fix Break1LineShort4
|
||||
BuildPageBreakList(yPageSize + yExtra, yPageSize + yExtra2,KeepStepsOnPage); // Case 1 :Works for ES05 Step 15 SubStep 7
|
||||
BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 1 :Works for ES05 Step 15 SubStep 7
|
||||
return 1; // Paginate on High Level Steps
|
||||
}
|
||||
//if (yWithinMargins > yPageSize / 2)
|
||||
@@ -216,6 +230,22 @@ namespace Volian.Print.Library
|
||||
//return 2;
|
||||
throw new Exception("PageBreak Logic Missing, vlnParagraph.cs");
|
||||
}
|
||||
|
||||
private float GetYPageSizeUseOnAllButFirstPage()
|
||||
{
|
||||
float _PointsPerPage = 792;
|
||||
int indx = (int)MyItemInfo.MyDocStyle.IndexOtherThanFirstPage;
|
||||
foreach (DocStyle ds in MyItemInfo.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
|
||||
{
|
||||
if (ds.Index == indx)
|
||||
{
|
||||
float yTopMargin = _PointsPerPage - (float)ds.Layout.TopMargin;
|
||||
float yBottomMargin = Math.Max(0, yTopMargin - (float)ds.Layout.PageLength);
|
||||
return yTopMargin - yBottomMargin;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
private void ForcePagination(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation, ref float retval)
|
||||
{
|
||||
cb.PdfDocument.NewPage(); // pagination issue
|
||||
|
Reference in New Issue
Block a user