Fixed error that caused file names to be in lower case when creating pdf
Created error handler to warn user when trying to view pdf file already open
This commit is contained in:
parent
1ad17cb080
commit
a1e91b689d
@ -128,7 +128,16 @@ namespace Volian.Print.Library
|
||||
// Try to open a file for creating the PDF.
|
||||
while (result == false)
|
||||
{
|
||||
string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf");
|
||||
string fileName = _FileName;
|
||||
int loc = fileName.IndexOf(".");
|
||||
if (loc > -1)
|
||||
{
|
||||
string fname = fileName.Substring(0, loc);
|
||||
fileName = fname + suffix + ".pdf";
|
||||
}
|
||||
else
|
||||
fileName = fileName + suffix + ".pdf";
|
||||
// string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf");
|
||||
try
|
||||
{
|
||||
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));
|
||||
|
@ -238,7 +238,14 @@ namespace Volian.Print.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Could not create " + outputFileName + ". If it is open, close and retry.", "Error on CreatePdf");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Could not create");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(outputFileName + ".");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("If it is open, close and retry.");
|
||||
MessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
//MessageBox.Show("Could not create " + outputFileName + ". If it is open, close and retry.", "Error on CreatePdf");
|
||||
return null;
|
||||
}
|
||||
document.Open();
|
||||
|
Loading…
x
Reference in New Issue
Block a user