diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index b6af2c24..3c41697c 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -6936,7 +6936,11 @@ namespace VEPROMS.CSLA.Library private List _StepSectPageBreaksForSupInfo = null; public List StepSectPageBreaksForSupInfo { - get { return _StepSectPageBreaksForSupInfo; } + get + { + if (_StepSectPageBreaksForSupInfo == null) _StepSectPageBreaksForSupInfo = new List(); + return _StepSectPageBreaksForSupInfo; + } set { _StepSectPageBreaksForSupInfo = value; } } // Keeps track of step section itemids where page breaks occur diff --git a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs index ec1914f6..bd3c7f6d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs @@ -244,7 +244,8 @@ namespace VEPROMS.CSLA.Library { None = 0, DoPageBreaks = 1, - Merge = 2 + SupInfoPdfPrint = 2, + Merge = 3 } #endregion } diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 0b463537..af77c46c 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -80,7 +80,7 @@ namespace Volian.Print.Library } // If printing a supinfo pdf, see if there is a page break at this supinfo paragraph, i.e. an entry will // exist in the list that contains the supinfo paragraph pagebreaks that was generated in the first pagebreak pass - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage) + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint) { int retval = 0; SectionInfo supInfoSect = MyItemInfo.MyActiveSection as SectionInfo; diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 984b4cd4..fa65dae7 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -1621,8 +1621,7 @@ namespace Volian.Print.Library ItemInfo myItemInfo = section as ItemInfo; if (SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks) { - if (section.StepSectPageBreaksForSupInfo == null) section.StepSectPageBreaksForSupInfo = new List(); - else section.StepSectPageBreaksForSupInfo.Clear(); + section.StepSectPageBreaksForSupInfo.Clear(); section.StepSectPageBreaks.Clear(); } // 792: 72 * 11 inches - TopRow - Top is high value @@ -1743,18 +1742,20 @@ namespace Volian.Print.Library string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + vlnParagraph.MyItemInfo.ItemID.ToString() + @".pdf"; PdfContentByte cb = OpenDoc(SupInfoPdfName, PageSize.LETTER); if (cb == null) return; - VlnSvgPageHelper myPageHealper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0); - cb.PdfWriter.PageEvent = myPageHealper; - myPageHealper.AllowAllWatermarks = AllowAllWatermarks; - myPageHealper.MyPdfWriter = cb.PdfWriter; - myPageHealper.CreatingFoldoutPage = false; - myPageHealper.CreatingSupInfoPage = true; - myPageHealper.MyPdfContentByte = cb; - myPageHealper.ChangeBarDefinition = MyChangeBarDefinition; + VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0); + cb.PdfWriter.PageEvent = myPageHelper; + myPageHelper.AllowAllWatermarks = AllowAllWatermarks; + myPageHelper.MyPdfWriter = cb.PdfWriter; + myPageHelper.CreatingFoldoutPage = false; + myPageHelper.CreatingSupInfoPage = true; + myPageHelper.MyPdfContentByte = cb; + myPageHelper.ChangeBarDefinition = MyChangeBarDefinition; float yPageStart = yTopMargin; vlnParagraph._yPageStartForSupInfo = yTopMargin; SupInfoAjustGroupings(vlnParagraph,cb); + SupInfoPrintType = E_SupInfoPrintType.SupInfoPdfPrint; vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); + SupInfoPrintType = E_SupInfoPrintType.Merge; try { cb.PdfDocument.Close(); diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index c0ef2112..e60f427a 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -465,6 +465,9 @@ namespace Volian.Print.Library public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) { + // Don't print section titles for supplemental information because the title is 'Supplemental Information': + if (MyItemInfo.IsSection && MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint) return yPageStart; + //if(PartsAbove.Count > 0 && PartsAbove[0] is vlnHeader) // if (PartsLeft.Count > 0 && PartsLeft[0] is vlnTab) // //if((PartsLeft[0] as vlnTab).Text[0] != '\u25CF') @@ -1604,27 +1607,30 @@ namespace Volian.Print.Library // 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) + // 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)) { - // 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) + // 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) { - // 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(); - } + 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)) @@ -1699,7 +1705,7 @@ namespace Volian.Print.Library } // 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) + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && itemIsPrinted /*&& !MyItemInfo.IsSection*/ && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); if (sid != -1) @@ -1809,7 +1815,7 @@ namespace Volian.Print.Library MyPromsPrinter.NewPage(); _MyLog.InfoFormat("NewPage Break within step blank {0}", cb.PdfWriter.CurrentPageNumber); } - if (!MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) + if (!MyPageHelper.CreatingSupInfoPage && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); if (sid != -1) @@ -1968,7 +1974,7 @@ namespace Volian.Print.Library } // 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) + if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && itemIsPrinted /*&& !MyItemInfo.IsSection */ && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) { int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); if (sid != -1) @@ -3510,6 +3516,8 @@ namespace Volian.Print.Library } } if (itemInfo is StepInfo && ((itemInfo as StepInfo).MyConfig as StepConfig).Step_PreferredPagebreak) HasPrefPageBreak = true; + // The following adds supplemental information items to the SupInfoSection list off of the section level paragraph for printing + // of the sup info pdf. The SupInfoSection list is just a flat list of all supplemental information within the section. if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && loadChildren && itemInfo.SupInfos != null) { SupInfoSection.ChildrenBelow.Add(cb, itemInfo.SupInfos, XOffset, 0, 0, rnoLevel, maxRNO, formatInfo);