diff --git a/PROMS/Volian.Print.Library/MergedPdf.cs b/PROMS/Volian.Print.Library/MergedPdf.cs index 5a466fd5..059c9919 100644 --- a/PROMS/Volian.Print.Library/MergedPdf.cs +++ b/PROMS/Volian.Print.Library/MergedPdf.cs @@ -17,16 +17,16 @@ namespace Volian.Print.Library private string _Title; public string Title { - get { return _Title; } // used for pdf outline + get { return _Title; } // used for pdf outline set { _Title = value; } } - private int _PageCount; // number of pages in the particular pdf, to aid in determining total page count for merged pdf + private int _PageCount; // number of pages in the particular pdf, to aid in determining total page count for merged pdf public int PageCount { get { return _PageCount; } set { _PageCount = value; } } - private string _PdfFileName; // used for finding the procedure's pdf file to merge + private string _PdfFileName; // used for finding the procedure's pdf file to merge public string PdfFileName { get { return _PdfFileName; } @@ -84,7 +84,7 @@ namespace Volian.Print.Library _docVersionInfo = dvi; } // the following merges the procedure pdfs into a single pdf - public bool DoTheMerge(Dictionary> MergedLandscapPages) + public bool DoTheMerge(Dictionary> MergedLandscapPages, bool generatePointListFile) { if (MergedPdfs == null) { @@ -95,6 +95,14 @@ namespace Volian.Print.Library string slashReplace = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_"; MergedFileName = _folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf"; MergedFileName = ItemInfo.StripRtfFormatting(MergedFileName); + // C2021-063 file name of Alarm Point List file containing Serial Number, Title, and merged Page Number + StreamWriter sw = null; + string PointListPageNums = MergedFileName.Replace(".pdf", "_PointList.txt"); + if (generatePointListFile) + { + FileInfo fi = new FileInfo(PointListPageNums); + sw = fi.CreateText(); + } PdfWriter writer = null; // see if it can be created and if not, see if it is open and tell user: try @@ -117,10 +125,17 @@ namespace Volian.Print.Library int mergedPageNumber = 0; // this is the number that will be used for the token (for of ) int totalPages = 0; // this is the number that will be used for the token (for of ) foreach (MergedPdfProc mpp in MergedPdfs) totalPages += mpp.PageCount; - bool doPageNum = GetPageOfInfo(); // get the format and location of page number - this can be reused for each procedure - // the MergedPdfs contains a list of all of the procedures' pdfs that will be merged into the final pdf + bool doPageNum = GetPageOfInfo(); // get the format and location of page number - this can be reused for each procedure + // the MergedPdfs contains a list of all of the procedures' pdfs that will be merged into the final pdf + int idxSerialNum = 0; // used to generate the Alarm serial number for Point List file foreach (MergedPdfProc mpp in MergedPdfs) { + // C2021-063 write Alarm Point List information to the text file + if (generatePointListFile) + { + // write Serial Number, Title, and Page Number in the Point List file + sw.WriteLine("{0}\t{1}\t{2}", idxSerialNum++, mpp.Title, mergedPageNumber + 1); + } string pdffilename = _folder + @"\" + mpp.PdfFileName; if (!File.Exists(pdffilename)) { @@ -175,6 +190,12 @@ namespace Volian.Print.Library _MyLog.Error(tmp, ex); } } + // C2021-063 display the generated Alarm Point List text in NotePad + if (generatePointListFile) + { + sw.Close(); + System.Diagnostics.Process.Start(PointListPageNums); + } doc.Close(); return true; }