From 9a546064cf5e3ce2162a67bdfa35bdce289d1d8e Mon Sep 17 00:00:00 2001 From: Paul Larsen Date: Fri, 26 Jan 2024 09:26:42 -0500 Subject: [PATCH] C2024-002-Print-Section --- .../DlgPrintProcedure.cs | 6 ++-- .../frmPDFStatusForm.cs | 4 +-- PROMS/VEPROMS User Interface/frmVEPROMS.cs | 2 +- PROMS/Volian.Print.Library/PromsPrinter.cs | 34 +++++++++++-------- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index f5bdd150..af4cc645 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -775,7 +775,7 @@ namespace VEPROMS // B2021-102 put in the using for better memory management using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), - swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor))//;//C2018-009 print PROMS version + swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor, PntSectID))//;//C2018-009 print PROMS version { frmStatus.CloseWhenDone = true; Application.DoEvents(); @@ -856,7 +856,7 @@ namespace VEPROMS // B2016-249 Output Procedure to folder associated with Parent Child using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, - new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor)) // ;//C2018-009 print PROMS version + new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor, PntSectID)) // ;//C2018-009 print PROMS version { frmStatus.PntSectID = PntSectID; frmStatus.CloseWhenDone = true; @@ -1009,7 +1009,7 @@ namespace VEPROMS // B2018-124 use text of watermark form drop down list instead of enum value using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50), - swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd, watermarkColor))//; //C2018-009 print PROMS version + swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd, watermarkColor, PntSectID))//; //C2018-009 print PROMS version { frmStatus.MakePlaceKeeper = swtbtnGeneratePlacekeeper.Value; frmStatus.MakeContinuousActionSummary = cbxGenerateConActSum.Checked; diff --git a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs index 8ae41372..a5065c1c 100644 --- a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs +++ b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs @@ -97,7 +97,7 @@ namespace VEPROMS get { return _pntSectID; } set { _pntSectID = value; } } - public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor) + public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor, int PntSectID = -1) { // B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic ProcedureInfo MyProcedure = myItem as ProcedureInfo; @@ -282,7 +282,7 @@ namespace VEPROMS cachePartInfo = PartInfo.CacheList; } - _PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary); + _PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary, PntSectID); ProfileTimer.Pop(profileDepth); diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index fcfa6323..5ff941ce 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -1210,7 +1210,7 @@ namespace VEPROMS prnDlg.SelectedSlave = args.UnitIndex; prnDlg.MySessionInfo = MySessionInfo; prnDlg.SetupForProcedure(); // Setup filename - prnDlg.QPCreatePDF(); // Create Print report + prnDlg.ShowDialog(this); // Create Print report si2.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0; } diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 1557c8a7..da4bfc27 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -323,7 +323,7 @@ namespace Volian.Print.Library set { _MergedPdf = value; } } public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite, - ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, int removeTrailngHardReturnsAndManualPageBreaks, string blankPageText, bool didAll, MergedPdf mergedPdf, string watermarkColor) + ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, int removeTrailngHardReturnsAndManualPageBreaks, string blankPageText, bool didAll, MergedPdf mergedPdf, string watermarkColor, int PntSectID = -1) { Prefix = prefix; // RHM20150506 Multiline ItemID TextBox _MyItem = myItem; @@ -348,6 +348,7 @@ namespace Volian.Print.Library _DidAll = didAll; _MergeNotIncluded = false; _MergedPdf = mergedPdf; + _pntSectID = PntSectID; //_MyReaderHelper.LoadTree(myItem); } // Pass 1 PDF Name @@ -367,7 +368,7 @@ namespace Volian.Print.Library // B2019-152: MergedLandscapePages is a dictionary whose key is the pdf file name & values are all of the page numbers // in that pdf that should have landscaped page numbers. These are added when the page is finished (onEndPage) public static Dictionary> MergedLandscapePages = null; - public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary) + public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary, int PntSectID = -1) { if (_MyItem is ProcedureInfo) { @@ -805,20 +806,23 @@ namespace Volian.Print.Library int cnt = 0; foreach (SectionInfo mySection in myProcedure.Sections) { - if (!mySection.MyDocStyle.IsStepSection && !mySection.IsAutoTOCSection) + if (PntSectID == -1 || (PntSectID > -1 && mySection.ItemID == PntSectID)) { - VEPROMS.CSLA.Library.Document.ConvertWordSectionToDOCX((ItemInfo)mySection); // B2023-093 Convert a Word section to the DOCX Word format if needed before printing - } - //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y") - || (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) - { - // if floating foldouts, need a list of sections & foldoutreaders. Just do first for now. + if (!mySection.MyDocStyle.IsStepSection && !mySection.IsAutoTOCSection) + { + VEPROMS.CSLA.Library.Document.ConvertWordSectionToDOCX((ItemInfo)mySection); // B2023-093 Convert a Word section to the DOCX Word format if needed before printing + } + //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box + if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y") + || (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) + { + // if floating foldouts, need a list of sections & foldoutreaders. Just do first for now. - _MyFoldoutSection.Add(mySection); - string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false, false); - _MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null); - cnt++; + _MyFoldoutSection.Add(mySection); + string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false, false); + _MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null); + cnt++; + } } } } @@ -2980,7 +2984,7 @@ namespace Volian.Print.Library } } } - //} + } } } }