QUOTED_IDENTIFIER ON
Show how long it takes to print all procedures For Null values use Arial as a default font. Added Try/Catch to PDFDocument.Close (In case page is empty) Only output End Message if it exists Pagination Fixes
This commit is contained in:
@@ -202,7 +202,14 @@ namespace Volian.Print.Library
|
||||
|
||||
private void CloseDocument(PdfContentByte cb, string fileName)
|
||||
{
|
||||
cb.PdfDocument.Close();
|
||||
try
|
||||
{
|
||||
cb.PdfDocument.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||
}
|
||||
OnStatusChanged("CloseDocument", PromsPrinterStatusType.CloseDocument);
|
||||
if (OpenPDF)
|
||||
System.Diagnostics.Process.Start(fileName);
|
||||
@@ -384,14 +391,17 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// if there's and end message, add it to the appropriate location on the last page of
|
||||
// the word document:
|
||||
float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch.
|
||||
iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont);
|
||||
fnt.Color=new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||
iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt);
|
||||
float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin;
|
||||
float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2;
|
||||
float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
|
||||
Rtf2Pdf.TextAt(cb, para, centerpos, ylocation + 6, 100, 12, "", yBottomMargin);
|
||||
if ((mySection.MyDocStyle.End.Message ?? "") != "")
|
||||
{
|
||||
float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch.
|
||||
iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont);
|
||||
fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||
iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt);
|
||||
float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin;
|
||||
float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2;
|
||||
float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
|
||||
Rtf2Pdf.TextAt(cb, para, centerpos, ylocation + 6, 100, 12, "", yBottomMargin);
|
||||
}
|
||||
}
|
||||
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
|
||||
}
|
||||
|
@@ -119,14 +119,12 @@ namespace Volian.Print.Library
|
||||
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||
{
|
||||
if (Processed) return yPageStart;
|
||||
|
||||
//float localYPageStart = yPageStart;
|
||||
Processed = true;
|
||||
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch;
|
||||
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
||||
|
||||
if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess);
|
||||
|
||||
float retval = yLocation;
|
||||
if (MyItemInfo.IsFigure)
|
||||
{
|
||||
@@ -158,6 +156,7 @@ namespace Volian.Print.Library
|
||||
if (_PartsBelow != null && _PartsBelow.Count > 0) yPageStart = PartsBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
if (_PartsContainer != null && _PartsContainer.Count > 0) yPageStart = PartsContainer.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
|
||||
//if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart);
|
||||
return yPageStart;
|
||||
}
|
||||
|
||||
@@ -350,11 +349,12 @@ namespace Volian.Print.Library
|
||||
float yTopMost = YTopMost;
|
||||
//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
|
||||
yTopMost = Math.Min(yTopMost,YVeryTop);
|
||||
yPageStart = yTopMargin + yTopMost - 2 * SixLinesPerInch;
|
||||
yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch;
|
||||
if (EmptyTopMostPart) yPageStart += SixLinesPerInch;
|
||||
myMsg = docstyle.Continue.Top.Message;
|
||||
if (myMsg != null && myMsg != "")
|
||||
{
|
||||
yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message
|
||||
if (myMsg.IndexOf(@"%d") > -1)
|
||||
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanText.Trim(" .".ToCharArray()));
|
||||
MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
|
||||
@@ -700,7 +700,7 @@ namespace Volian.Print.Library
|
||||
if (breakOrNot == "Yes")
|
||||
{
|
||||
// DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance);
|
||||
DebugPagination.WriteLine("'{0}',{1},'{2}','{3}',{4},{5},{6},{7},{8}", MyItemInfo.ShortPath, instance, message, breakOrNot,
|
||||
DebugPagination.WriteLine("{0},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}",MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ShortPath, instance, message, breakOrNot,
|
||||
MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize));
|
||||
}
|
||||
// Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance);
|
||||
@@ -736,6 +736,10 @@ namespace Volian.Print.Library
|
||||
yTop = yTopNew;
|
||||
MyPageHelper.ParaBreaks.Add(paraBreak);
|
||||
ySpaceOnCurPage = yPageSize - 2 * SixLinesPerInch; // Allow for continue message and blank line.
|
||||
//ySpaceOnCurPage = yPageSize; // Allow for continue message and blank line.
|
||||
//DocStyle docstyle = MyItemInfo.MyDocStyle;
|
||||
//string myMsg = docstyle.Continue.Bottom.Message;
|
||||
//if ((myMsg ?? "") != "") ySpaceOnCurPage -= 2 * SixLinesPerInch; // Allow for continue message and blank line.
|
||||
yLowerLimit = ySpaceOnCurPage / 2;
|
||||
if(_Match16BitPagination)yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP
|
||||
yStart = 0;
|
||||
@@ -798,8 +802,9 @@ namespace Volian.Print.Library
|
||||
foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation
|
||||
{
|
||||
// The top of this step will fit onto page (-yLocation < yWithinMargins)
|
||||
if (-yLocation < yUpperLimit)
|
||||
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
|
||||
if (-yLocation <= yUpperLimit) // Fix for OFN-RJ-23
|
||||
//if (-yLocation < yUpperLimit) // Before
|
||||
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
|
||||
{
|
||||
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
|
||||
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer");
|
||||
@@ -892,11 +897,10 @@ namespace Volian.Print.Library
|
||||
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
|
||||
yoff += SetHeader(this, cb, itemInfo, formatInfo);
|
||||
YOffset = yoff;
|
||||
|
||||
if (itemInfo.IsRNOPart)
|
||||
{
|
||||
// there may be other places that double space, but this supports it for RNOs (the DoubleRNOspace flag)
|
||||
if (rnoLevel > maxRNO && itemInfo.FormatStepData.DoubleSpace) yoff = YOffset = yoff + SixLinesPerInch;
|
||||
if (rnoLevel > 1 && itemInfo.FormatStepData.DoubleSpace) yoff = YOffset = yoff + SixLinesPerInch;
|
||||
}
|
||||
AddMacros(itemInfo, mytab);
|
||||
if (mytab != null)
|
||||
|
Reference in New Issue
Block a user