Logic for putting a blank page in the PDF if the procedure prints duplex foldouts

This commit is contained in:
2013-08-29 13:16:59 +00:00
parent 2336a70679
commit 518e3182b2
3 changed files with 93 additions and 7 deletions

View File

@@ -654,6 +654,7 @@ namespace Volian.Print.Library
string tmpstr = null;
SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID);
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 9 {0}", cb.PdfWriter.CurrentPageNumber);
MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si, ref tmp, ref tmpstr);
Processed = true;
return yPageStart;
@@ -678,7 +679,8 @@ namespace Volian.Print.Library
case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
cb.PdfDocument.NewPage();
if(MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null)) //do not reset for 1st step
//_MyLog.InfoFormat("NewPage 10 {0}", cb.PdfWriter.CurrentPageNumber);
if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null)) //do not reset for 1st step
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate1");
if (MyItemInfo.IsSection)
@@ -687,8 +689,17 @@ namespace Volian.Print.Library
MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null);
}
// Only do foldout page if not done for section break, i.e. check the there's a previous step.
if (MyItemInfo.MyPrevious != null && MyItemInfo.FoldoutIndex()>-1)
if (MyItemInfo.MyPrevious != null && MyItemInfo.FoldoutIndex() > -1)
PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex());
else if (PromsPrinter.MyFoldoutReader.Count > 0 && MyPageHelper.MyPromsPrinter.InsertBlankPages)
{
// insert a blank page if this step section had a foldout associated and the checkbox
// on the print dialog, to add blank pages, is checked
MyPageHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 10 blank {0}", cb.PdfWriter.CurrentPageNumber);
}
yPageStart = yTopMargin + YTopMost;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
@@ -737,10 +748,18 @@ namespace Volian.Print.Library
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate2");
if (MyItemInfo.MyHLS.FoldoutIndex()>-1)
if (MyItemInfo.MyHLS.FoldoutIndex() > -1)
PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.MyHLS.FoldoutIndex()); // temporary foldout
else if (PromsPrinter.MyFoldoutReader.Count > 0 && MyPageHelper.MyPromsPrinter.InsertBlankPages)
{
MyPageHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
cb.PdfDocument.NewPage();
_MyLog.InfoFormat("NewPage Break within step blank {0}", cb.PdfWriter.CurrentPageNumber);
}
// if there is a 'container vlnbox' around the HLS, flag that the drawn box must also break:
if (MyHighLevelParagraph != null && MyHighLevelParagraph.PartsContainer != null && MyHighLevelParagraph.PartsContainer.Count > 0)
@@ -793,6 +812,7 @@ namespace Volian.Print.Library
{
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection)
//_MyLog.InfoFormat("NewPage 12 {0}", cb.PdfWriter.CurrentPageNumber);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate3");
if (MyItemInfo.IsSection)
@@ -802,6 +822,15 @@ namespace Volian.Print.Library
}
if (MyItemInfo.FoldoutIndex() > -1)
PromsPrinter.DoFoldoutPage(cb, "HLS (7 lpi) break", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex());
else if (PromsPrinter.MyFoldoutReader.Count > 0 && MyPageHelper.MyPromsPrinter.InsertBlankPages)
{
// insert a blank page if this step section had a foldout associated and the checkbox
// on the print dialog, to add blank pages, is checked
MyPageHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 12 lpi blank {0}", cb.PdfWriter.CurrentPageNumber);
}
// 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)