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
{
// 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;
private void OnStatusChanged(object sender, PromsPrintStatusArgs args)
{
@ -308,36 +312,44 @@ namespace Volian.Print.Library
else
{
myPdfFile = BuildMSWordPDF(mySection);
readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null;
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
if (mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length !=0) //.SectionConfig.Section_NumPages != "")
try
{
int sectPageCount = (int)(Math.Ceiling(mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length)); //decimal.Parse(mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length)));
for (int ii = 0; ii < sectPageCount; ii++)
readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null;
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
if (mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length != 0) //.SectionConfig.Section_NumPages != "")
{
int pageNumber = 1 + ii;
if (readerWord != null)
int sectPageCount = (int)(Math.Ceiling(mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length)); //decimal.Parse(mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length)));
for (int ii = 0; ii < sectPageCount; ii++)
{
bool doimport2 = true;
PdfImportedPage fgPage = null;
try
int pageNumber = 1 + ii;
if (readerWord != null)
{
fgPage = cb.PdfWriter.GetImportedPage(readerWord, ii + 1);
bool doimport2 = true;
PdfImportedPage fgPage = null;
try
{
fgPage = cb.PdfWriter.GetImportedPage(readerWord, ii + 1);
}
catch (Exception ex)
{
Console.WriteLine(ex);
doimport2 = false;
}
OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord);
if (doimport2) AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, 0, 0);
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
}
catch (Exception ex)
{
Console.WriteLine(ex);
doimport2 = false;
}
OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord);
if (doimport2) AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, 0, 0);
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
cb.PdfDocument.NewPage();
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
}
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
cb.PdfDocument.NewPage();
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
}
}
catch (Exception ex)
{
cb.PdfDocument.NewPage(); // can we put out 'error on page'?
}
}
}
if (_MyHelper.BackgroundFile != null)
@ -390,6 +402,11 @@ namespace Volian.Print.Library
myParagraph.ToPdf(cb, yTopMargin, yTopMargin, yBottomMargin);
else
PrintTextMessage(cb, "No Section Content");
if (_DoBlankForFoldout && section.IsDefaultSection)
{
cb.PdfDocument.NewPage();
cb.Circle(400, 100, 50);
}
cb.PdfDocument.NewPage();
OnStatusChanged("StepSection converted to PDF " + section.ShortPath, PromsPrinterStatusType.BuildStep);
}