Changed the name of the temporary file used for MSWord PDFs. Gave it a PDF extensison so that it caan be more easily opened.

Add useful information to the PDF file properties so that the verssion of the code used to create the PDF can be identified.
This commit is contained in:
Rich 2015-03-06 11:50:27 +00:00
parent 73143c199c
commit f97433e12a
2 changed files with 41 additions and 25 deletions

View File

@ -1239,7 +1239,7 @@ namespace VEPROMS.CSLA.Library
}
private static string GetFileName(ItemInfo sect)
{
string fileName = VlnSettings.TemporaryFolder + @"\Doc " + sect.MyContent.MyEntry.DocID.ToString(); // +" " + (sect.DisplayNumber == "" ? sect.DisplayText : sect.DisplayNumber);
string fileName = VlnSettings.TemporaryFolder + @"\Doc_" + sect.MyContent.MyEntry.DocID.ToString()+".Pdf"; // +" " + (sect.DisplayNumber == "" ? sect.DisplayText : sect.DisplayNumber);
return fileName;
}
public static RectangleF CreatePlot(string pngFile, string xyPlot, float resolution, System.Windows.Forms.Form myForm)

View File

@ -249,6 +249,8 @@ namespace Volian.Print.Library
// re-evaluated.
if (page.Height < page.Width)
image.RotationDegrees = 90F;
//if (page.Height < page.Width)
// image.RotationDegrees = 90F;
image.SetAbsolutePosition(xOff, yOff);
cb.AddImage(image);
cb.EndLayer();
@ -438,6 +440,7 @@ namespace Volian.Print.Library
// Setup a pdf Document for printing
OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before);
PdfContentByte cb = OpenDoc(outputFileName);
SetupProperties(cb.PdfDocument, myProcedure);
if (cb == null)
{
ProfileTimer.Pop(profileDepth);
@ -653,6 +656,14 @@ namespace Volian.Print.Library
ProfileTimer.Pop(profileDepth);
return outputFileName;
}
private void SetupProperties(PdfDocument document, ProcedureInfo myProcedure)
{
document.AddTitle(string.Format("{0} {1}",myProcedure.DisplayNumber,myProcedure.DisplayText));
document.AddSubject(myProcedure.SearchDVPath);
document.AddCreator(string.Format("{0} {1}",Application.ProductName, Application.ProductVersion));
document.AddAuthor(Volian.Base.Library.VlnSettings.UserID);
}
private Placekeeper _MyPlacekeeper = null;
public Placekeeper MyPlacekeeper
@ -718,6 +729,11 @@ namespace Volian.Print.Library
try
{
fgPage = cb.PdfWriter.GetImportedPage(readerWord, ii + 1);
//if (ii + 2 < readerWord.NumberOfPages)
//{
// iTextSharp.text.Rectangle rc = readerWord.GetPageSizeWithRotation(ii + 2);
// cb.PdfDocument.SetPageSize(rc);
//}
}
catch (Exception ex)
{