This commit is contained in:
Kathy Ruffing 2011-01-19 16:24:32 +00:00
parent fcf38d2bec
commit ea0d4749e2

View File

@ -84,6 +84,10 @@ namespace Volian.Print.Library
} }
public class PromsPrinter public class PromsPrinter
{ {
// the following boolean is to help testing of various formats. If the plant has an alternating foldout
// and you want a blank page, until foldouts are developed, set to true.
// AEP DU1 - do a blank page for foldout
private bool _DoBlankForFoldout = false;
public event PromsPrinterStatusEvent StatusChanged; public event PromsPrinterStatusEvent StatusChanged;
private void OnStatusChanged(object sender, PromsPrintStatusArgs args) private void OnStatusChanged(object sender, PromsPrintStatusArgs args)
{ {
@ -308,6 +312,8 @@ namespace Volian.Print.Library
else else
{ {
myPdfFile = BuildMSWordPDF(mySection); myPdfFile = BuildMSWordPDF(mySection);
try
{
readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null; readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null;
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection); OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
if (mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length != 0) //.SectionConfig.Section_NumPages != "") if (mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length != 0) //.SectionConfig.Section_NumPages != "")
@ -337,6 +343,12 @@ namespace Volian.Print.Library
cb.PdfDocument.NewPage(); cb.PdfDocument.NewPage();
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
} }
}
}
catch (Exception ex)
{
cb.PdfDocument.NewPage(); // can we put out 'error on page'?
} }
} }
} }
@ -390,6 +402,11 @@ namespace Volian.Print.Library
myParagraph.ToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); myParagraph.ToPdf(cb, yTopMargin, yTopMargin, yBottomMargin);
else else
PrintTextMessage(cb, "No Section Content"); PrintTextMessage(cb, "No Section Content");
if (_DoBlankForFoldout && section.IsDefaultSection)
{
cb.PdfDocument.NewPage();
cb.Circle(400, 100, 50);
}
cb.PdfDocument.NewPage(); cb.PdfDocument.NewPage();
OnStatusChanged("StepSection converted to PDF " + section.ShortPath, PromsPrinterStatusType.BuildStep); OnStatusChanged("StepSection converted to PDF " + section.ShortPath, PromsPrinterStatusType.BuildStep);
} }