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 committed 2015-03-06 11:50:27 +00:00
1 parent 73143c199c
commit f97433e12a
2 files changed
+17 -1

No files matched your search

@@ -1239,7 +1239,7 @@ namespace VEPROMS.CSLA.Library
} }
private static string GetFileName(ItemInfo sect) 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; return fileName;
} }
public static RectangleF CreatePlot(string pngFile, string xyPlot, float resolution, System.Windows.Forms.Form myForm) public static RectangleF CreatePlot(string pngFile, string xyPlot, float resolution, System.Windows.Forms.Form myForm)
@@ -249,6 +249,8 @@ namespace Volian.Print.Library
// re-evaluated. // re-evaluated.
if (page.Height < page.Width) if (page.Height < page.Width)
image.RotationDegrees = 90F; image.RotationDegrees = 90F;
//if (page.Height < page.Width)
// image.RotationDegrees = 90F;
image.SetAbsolutePosition(xOff, yOff); image.SetAbsolutePosition(xOff, yOff);
cb.AddImage(image); cb.AddImage(image);
cb.EndLayer(); cb.EndLayer();
@@ -438,6 +440,7 @@ namespace Volian.Print.Library
// Setup a pdf Document for printing // Setup a pdf Document for printing
OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before); OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before);
PdfContentByte cb = OpenDoc(outputFileName); PdfContentByte cb = OpenDoc(outputFileName);
SetupProperties(cb.PdfDocument, myProcedure);
if (cb == null) if (cb == null)
{ {
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
@@ -653,6 +656,14 @@ namespace Volian.Print.Library
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
return outputFileName; 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; private Placekeeper _MyPlacekeeper = null;
public Placekeeper MyPlacekeeper public Placekeeper MyPlacekeeper
@@ -718,6 +729,11 @@ namespace Volian.Print.Library
try try
{ {
fgPage = cb.PdfWriter.GetImportedPage(readerWord, ii + 1); 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) catch (Exception ex)
{ {