From 61af3b60cc8a53679a48fbabae233949e1501f09 Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 12 Jul 2017 14:04:48 +0000 Subject: [PATCH] B2017-139: SAMG Facing page print has missing blank pages --- PROMS/Volian.Print.Library/PromsPrinter.cs | 2 +- PROMS/Volian.Print.Library/vlnParagraph.cs | 66 ++++++++++++++-------- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index fa65dae7..b9bfd9b0 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -891,10 +891,10 @@ namespace Volian.Print.Library _MyHelper.OnBlankPage = true; cb.PdfDocument.Add(new iTextSharp.text.Table(1)); NewPage(); - firstStepSec = false; } } } + firstStepSec = false; CreateStepPdf(mySection, cb); } else diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index e60f427a..712b2504 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1604,33 +1604,51 @@ 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. 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. Also, if the section title is printed, then need to get the facing page before the section title is printed and if - // this is the hls where the section title was printed, don't do the facing page. - bool titlePrinted = false; - if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)) + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge) { - // see if the section title is printed. - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - titlePrinted = (sch == null || sch.Section_PrintHdr == "Y") || !(MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps; - titlePrinted &= (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle); - } - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && (MyItemInfo.ActiveSection as SectionInfo).HasSupInfoSteps && ((MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !titlePrinted) || (MyItemInfo.IsStepSection && titlePrinted)) && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) - { - // 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) + // 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 the section title is printed, then need to get the facing page before the section title is printed and if + // this is the hls where the section title was printed, don't do the facing page. + bool titlePrinted = false; + if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)) { - MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true); + // see if the section title is printed. + SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; + titlePrinted = (sch == null || sch.Section_PrintHdr == "Y") || !(MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps; + titlePrinted &= (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle); } - else + // If this is first step section and there is no supinfo, the blank page was done in proms printer. + // If this is first step section and there is supinfo, it needs to be put out + bool notFirstOrFirstHasSupInfo = false; + bool firstSec = true; + foreach (SectionInfo sec in MyItemInfo.MyProcedure.Sections) { - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + if (sec.IsStepSection) + { + if (sec.ItemID == MyItemInfo.MyActiveSection.ItemID) break; + firstSec = false; + break; + } + } + notFirstOrFirstHasSupInfo = !firstSec || (MyItemInfo.ActiveSection as SectionInfo).HasSupInfoSteps; + if (notFirstOrFirstHasSupInfo && ((MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !titlePrinted) || (MyItemInfo.IsStepSection && titlePrinted)) && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) + { + // 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)) @@ -1815,7 +1833,7 @@ namespace Volian.Print.Library MyPromsPrinter.NewPage(); _MyLog.InfoFormat("NewPage Break within step blank {0}", cb.PdfWriter.CurrentPageNumber); } - if (!MyPageHelper.CreatingSupInfoPage && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); if (sid != -1)