From 8aece0fb7999cc421f8db14faf7a9eb96ab6ff39 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 6 May 2011 14:00:03 +0000 Subject: [PATCH] - Replace slashes and backslashes with underscores in the pdf file name - Use pdf name specified in the dialog --- PROMS/Volian.Print.Library/PromsPrinter.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 44b0f956..0181a167 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -106,6 +106,14 @@ namespace Volian.Print.Library private string _RevDate; private ItemInfo _MyItem; private string _Watermark; + private string _PDFFile; + + public string PDFFile + { + get { return _PDFFile; } + set { _PDFFile = value; } + } + private bool _DebugOutput; public bool DebugOutput { @@ -138,7 +146,7 @@ namespace Volian.Print.Library get { return _MyChangeBarDefinition; } set { _MyChangeBarDefinition = value; } } - public PromsPrinter(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, string backgroundFolder,bool openPDF, bool overWrite, ChangeBarDefinition cbd) + public PromsPrinter(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, string backgroundFolder,bool openPDF, bool overWrite, ChangeBarDefinition cbd, String pdfFile) { _MyItem = myItem; _Rev = rev; @@ -149,6 +157,7 @@ namespace Volian.Print.Library _OpenPDF = openPDF; _OverWrite = overWrite; _MyChangeBarDefinition = cbd; + _PDFFile = pdfFile; } public string Print(string pdfFolder) { @@ -242,14 +251,14 @@ namespace Volian.Print.Library } private string FixFileName(string name) { - return Regex.Replace(name, "[ .,]", "_") + ".pdf"; + return Regex.Replace(name, "[ .,/]", "_") + ".pdf"; } int _StepPageNumber = 0; private VlnSvgPageHelper _MyHelper = null; private string Print(ProcedureInfo myProcedure, string pdfFolder) { OnStatusChanged("Print " + myProcedure.DisplayNumber, PromsPrinterStatusType.Start); - string outputFileName = pdfFolder + "\\" + CreateFileName(myProcedure.DisplayNumber); + string outputFileName = pdfFolder + "\\" + PDFFile; if (!OverWrite && File.Exists(outputFileName)) { if (MessageBox.Show(outputFileName + " exists. Overwrite file?", "File Exists", MessageBoxButtons.YesNo) == DialogResult.No)