From 63ea75f998e34c1ef725d6b34142654feaccf192 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 28 Sep 2010 17:06:49 +0000 Subject: [PATCH] --- PROMS/Volian.Print.Library/PromsPrinter.cs | 44 +++++++++++++--------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 94facd7f..3fb9a06a 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -309,9 +309,9 @@ namespace Volian.Print.Library myPdfFile = BuildMSWordPDF(mySection); readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null; OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection); - if (mySection.SectionConfig.Section_NumPages != "") + if (mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length !=0) //.SectionConfig.Section_NumPages != "") { - int sectPageCount = (int)(Math.Ceiling(decimal.Parse(mySection.SectionConfig.Section_NumPages))); + 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++) { int pageNumber = 1 + ii; @@ -344,21 +344,7 @@ namespace Volian.Print.Library _MyHelper.MySvg = null; while (cb.PdfWriter.CurrentPageNumber <= _MyHelper.BackgroundPageCount) { - if (_TextLayer != null) cb.BeginLayer(_TextLayer); - float fontSize = 30; - ColumnText ct = new ColumnText(cb); - iTextSharp.text.Font font = FontFactory.GetFont("Arial", fontSize, new iTextSharp.text.Color(PrintOverride.TextColor)); - Chunk chk = new Chunk("No PROMS2010 Output", font); - float xCenter = cb.PdfDocument.PageSize.Width / 2; - float yCenter = cb.PdfDocument.PageSize.Height / 2; - float width = chk.GetWidthPoint() * 1.01F; - float height = fontSize * 1.5F; - ct.SetSimpleColumn(xCenter - width/2, yCenter - height/2, xCenter + width/2, yCenter + height/2); - Phrase ph = new Phrase(chk); - ct.AddElement(ph); - cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor)); - ct.Go(); - if (_TextLayer != null) cb.EndLayer(); + PrintTextMessage(cb, "No PROMS2010 Output"); cb.PdfDocument.NewPage(); } } @@ -367,6 +353,25 @@ namespace Volian.Print.Library // Return the fileName; return outputFileName; } + + private void PrintTextMessage(PdfContentByte cb, string message) + { + if (_TextLayer != null) cb.BeginLayer(_TextLayer); + float fontSize = 30; + ColumnText ct = new ColumnText(cb); + iTextSharp.text.Font font = FontFactory.GetFont("Arial", fontSize, new iTextSharp.text.Color(PrintOverride.TextColor)); + Chunk chk = new Chunk(message, font); + float xCenter = cb.PdfDocument.PageSize.Width / 2; + float yCenter = cb.PdfDocument.PageSize.Height / 2; + float width = chk.GetWidthPoint() * 1.01F; + float height = fontSize * 1.5F; + ct.SetSimpleColumn(xCenter - width / 2, yCenter - height / 2, xCenter + width / 2, yCenter + height / 2); + Phrase ph = new Phrase(chk); + ct.AddElement(ph); + cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor)); + ct.Go(); + if (_TextLayer != null) cb.EndLayer(); + } private void CreateStepPdf(SectionInfo section, PdfContentByte cb) { iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter; @@ -380,7 +385,10 @@ namespace Volian.Print.Library Rtf2Pdf.Offset = new PointF(24, 2.5F); _MyHelper.ChangeBarDefinition = MyChangeBarDefinition; vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, 0, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat); - myParagraph.ToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); + if (myItemInfo.HasChildren) + myParagraph.ToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); + else + PrintTextMessage(cb, "No Section Content"); cb.PdfDocument.NewPage(); OnStatusChanged("StepSection converted to PDF " + section.ShortPath, PromsPrinterStatusType.BuildStep); }