diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index c301d4de..c0ef2112 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1577,6 +1577,7 @@ namespace Volian.Print.Library supInfoSect.StepSectPageBreaksForSupInfo.Add(aboveSupinfoId!=-1?aboveSupinfoId:MyItemInfo.SupInfos[0].ItemID); MyPromsPrinter.NeedSupInfoBreak = false; } + bool itemIsPrinted = false; switch (paginate) { // .oooooo. .oooo. @@ -1600,19 +1601,30 @@ namespace Volian.Print.Library yPageStart = _yPageStartForSupInfo - SixLinesPerInch; yLocation = yPageStart - YTopMost; } - // printing a procedure with section(s) that have supplemental information - determine facing page needed to be merged in: - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps) + // printing a procedure with section(s) that have supplemental information - determine facing page needed to be merged in. For + // case 0, it is typically at the beginning of the section since the page break occurred in the code that calls this. + // Note that if the procedure has any sections with supinfo, then the entire procedure will need facing pages, either blank page + // or supinfo steps. + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { - int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); - if (sid != -1) + // check if the item is printed, a step is always printed but a section title may or may not based on format flags. if it is not + // printed, don't put out facing page because it will be put out when there is printable text. + itemIsPrinted = IsPrintedStepItemForSupInfo(); + if (itemIsPrinted) { - MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true); - } - else - { - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + // If there is supplemental information to be printed on the facing page, then get the id that has supinfo + // so that it can be retrieved from the pdf for the supinfos for this section. + int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); + if (sid != -1) + { + MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true); + } + else + { + MyPageHelper.OnBlankPage = true; + cb.PdfDocument.Add(new iTextSharp.text.Table(1)); + MyPromsPrinter.NewPage(); + } } } if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) @@ -1685,10 +1697,9 @@ namespace Volian.Print.Library //_MyLog.InfoFormat("NewPage 10 blank {0}", cb.PdfWriter.CurrentPageNumber); } } - // If there is supplemental information to be printed on the facing page, then get the id that has supinfo - // so that it can be retrieved from the pdf for the supinfos for this section. If there is one, - // use DoSupInfoPage to put out the page, otherwise do a blank page. - if (MyPromsPrinter.SupInfoPrintType==E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps) + // See comments under case 0 explaining supinfo/facing page processing. + itemIsPrinted = IsPrintedStepItemForSupInfo(); + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && itemIsPrinted && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); if (sid != -1) @@ -1798,7 +1809,7 @@ namespace Volian.Print.Library MyPromsPrinter.NewPage(); _MyLog.InfoFormat("NewPage Break within step blank {0}", cb.PdfWriter.CurrentPageNumber); } - if (!MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps) + if (!MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); if (sid != -1) @@ -1955,10 +1966,9 @@ namespace Volian.Print.Library MyPromsPrinter.NewPage(); //_MyLog.InfoFormat("NewPage 12 lpi blank {0}", cb.PdfWriter.CurrentPageNumber); } - // If there is supplemental information to be printed on the facing page, then get the id that has supinfo - // so that it can be retrieved from the pdf for the supinfos for this section. If there is one, - // use DoSupInfoPage to put out the page, otherwise do a blank page. - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps) + // See comments under case 0 explaining supinfo/facing page processing. + itemIsPrinted = IsPrintedStepItemForSupInfo(); + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && itemIsPrinted && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); if (sid != -1) @@ -2199,7 +2209,18 @@ namespace Volian.Print.Library ProfileTimer.Pop(profileDepth); return yPageStart; } - + private bool IsPrintedStepItemForSupInfo() + { + bool printedMySectTitle = true; + if (MyItemInfo.IsSection) + { + // see if the section title is printed. + SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; + printedMySectTitle = (sch == null || sch.Section_PrintHdr == "Y") || !(MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps; + printedMySectTitle &= (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle); + } + return printedMySectTitle; + } private int ChildrenAboveHaveSupInfo() { if (ChildrenAbove == null || ChildrenAbove.Count < 1) return -1;