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:
parent
73143c199c
commit
f97433e12a
@ -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)
|
||||||
{
|
{
|
||||||
@ -769,33 +785,33 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
|
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
|
||||||
}
|
}
|
||||||
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
|
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
|
||||||
if (mySection.MyDocStyle.LandscapePageList)// && mySection.MyDocStyle.Layout.PageWidth > mySection.MyDocStyle.Layout.PageLength)
|
if (mySection.MyDocStyle.LandscapePageList)// && mySection.MyDocStyle.Layout.PageWidth > mySection.MyDocStyle.Layout.PageLength)
|
||||||
_MyHelper.IsLandscape = true;
|
_MyHelper.IsLandscape = true;
|
||||||
else
|
else
|
||||||
_MyHelper.IsLandscape = false;
|
_MyHelper.IsLandscape = false;
|
||||||
cb.PdfDocument.NewPage(); // Word Document
|
cb.PdfDocument.NewPage(); // Word Document
|
||||||
//_MyLog.InfoFormat("NewPage 3 {0}", cb.PdfWriter.CurrentPageNumber);
|
//_MyLog.InfoFormat("NewPage 3 {0}", cb.PdfWriter.CurrentPageNumber);
|
||||||
|
|
||||||
// if this document style has another style that is for pages other than first, we need to
|
// if this document style has another style that is for pages other than first, we need to
|
||||||
// reset the document style off of this section AND reset docstyle values used.
|
// reset the document style off of this section AND reset docstyle values used.
|
||||||
_MyHelper.DidFirstPageDocStyle = true;
|
_MyHelper.DidFirstPageDocStyle = true;
|
||||||
|
|
||||||
// Calvert has a case in their stp landscape word docs where a ' (Continued)' message
|
// Calvert has a case in their stp landscape word docs where a ' (Continued)' message
|
||||||
// appears in their pagelist item for printing the section title, {ATTACHTITLECONT} pagelist
|
// appears in their pagelist item for printing the section title, {ATTACHTITLECONT} pagelist
|
||||||
// However, other sections use this token, but do NOT have the continue message - so
|
// However, other sections use this token, but do NOT have the continue message - so
|
||||||
// the docstyle was added to flag the difference between them (STP-Landscape Attachments has it,
|
// the docstyle was added to flag the difference between them (STP-Landscape Attachments has it,
|
||||||
// STP-Attachments do not)
|
// STP-Attachments do not)
|
||||||
if (resetSvgForCont && (mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListAddSectCont) == E_DocStructStyle.DSS_PageListAddSectCont)
|
if (resetSvgForCont && (mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListAddSectCont) == E_DocStructStyle.DSS_PageListAddSectCont)
|
||||||
{
|
{
|
||||||
_MyHelper.ResetSvg();
|
_MyHelper.ResetSvg();
|
||||||
resetSvgForCont = false; // only need to reset it once (for all pages after 1st page)
|
resetSvgForCont = false; // only need to reset it once (for all pages after 1st page)
|
||||||
}
|
}
|
||||||
|
|
||||||
//DebugPagination.WriteLine("CreateWordDocPdf");
|
//DebugPagination.WriteLine("CreateWordDocPdf");
|
||||||
if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
|
if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
|
||||||
_MyHelper.MySection = mySection; // this resets the docstyle/pagestyle in pagehelper
|
_MyHelper.MySection = mySection; // this resets the docstyle/pagestyle in pagehelper
|
||||||
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user