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:
parent
591e17fa42
commit
d24109fe19
@ -14,6 +14,10 @@ begin
|
|||||||
end
|
end
|
||||||
print 'Adding procedures and functions to ' + db_name()
|
print 'Adding procedures and functions to ' + db_name()
|
||||||
GO
|
GO
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: Table [dbo].[DeleteLog] Script Date: 03/29/2011 17:26:23 ******/
|
/****** Object: Table [dbo].[DeleteLog] Script Date: 03/29/2011 17:26:23 ******/
|
||||||
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DeleteLog]') AND type in (N'U'))
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DeleteLog]') AND type in (N'U'))
|
||||||
|
@ -331,12 +331,15 @@ namespace VEPROMS
|
|||||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||||
// Also check that format allows override.
|
// Also check that format allows override.
|
||||||
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
||||||
|
int n = _DocVersionInfo.Procedures.Count;
|
||||||
|
int i = 0;
|
||||||
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
|
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
|
||||||
{
|
{
|
||||||
MyProcedure = myProc;
|
MyProcedure = myProc;
|
||||||
if (myProc.Sections != null)
|
if (myProc.Sections != null)
|
||||||
{
|
{
|
||||||
SetupForProcedure();
|
SetupForProcedure();
|
||||||
|
this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text);
|
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text);
|
||||||
frmStatus.CloseWhenDone = true;
|
frmStatus.CloseWhenDone = true;
|
||||||
frmStatus.ShowDialog();
|
frmStatus.ShowDialog();
|
||||||
@ -427,7 +430,16 @@ namespace VEPROMS
|
|||||||
private void btnCreatePDF_Click(object sender, EventArgs e)
|
private void btnCreatePDF_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_AllProcedures)
|
if (_AllProcedures)
|
||||||
|
{
|
||||||
|
DateTime dtStart = DateTime.Now;
|
||||||
CreatePDFs();
|
CreatePDFs();
|
||||||
|
if (VlnSettings.DebugMode)
|
||||||
|
{
|
||||||
|
MessageBox.Show(string.Format("{0} Minutes to Print All Procedures"
|
||||||
|
, TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks).TotalMinutes),
|
||||||
|
"Printing Duration", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
CreatePDF();
|
CreatePDF();
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
style |= FontStyle.Underline;
|
style |= FontStyle.Underline;
|
||||||
}
|
}
|
||||||
// for now - check size to be 0 and set to 10 if so, error in fmtxml?
|
// for now - check size to be 0 and set to 10 if so, error in fmtxml?
|
||||||
_WindowsFont = new Font(Family, Size==0?10:(float)Size, style);
|
if (Family == null) // Need to get inherited font
|
||||||
|
_WindowsFont = new Font("Arial", 10, FontStyle.Regular);
|
||||||
|
else
|
||||||
|
_WindowsFont = new Font(Family, Size == 0 ? 10 : (float)Size, style);
|
||||||
}
|
}
|
||||||
return _WindowsFont;
|
return _WindowsFont;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,14 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
private void CloseDocument(PdfContentByte cb, string fileName)
|
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);
|
OnStatusChanged("CloseDocument", PromsPrinterStatusType.CloseDocument);
|
||||||
if (OpenPDF)
|
if (OpenPDF)
|
||||||
System.Diagnostics.Process.Start(fileName);
|
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
|
// if there's and end message, add it to the appropriate location on the last page of
|
||||||
// the word document:
|
// the word document:
|
||||||
float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch.
|
if ((mySection.MyDocStyle.End.Message ?? "") != "")
|
||||||
iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont);
|
{
|
||||||
fnt.Color=new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch.
|
||||||
iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt);
|
iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont);
|
||||||
float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin;
|
fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||||
float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2;
|
iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt);
|
||||||
float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
|
float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin;
|
||||||
Rtf2Pdf.TextAt(cb, para, centerpos, ylocation + 6, 100, 12, "", yBottomMargin);
|
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);
|
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
|
||||||
}
|
}
|
||||||
|
@ -119,14 +119,12 @@ namespace Volian.Print.Library
|
|||||||
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||||
{
|
{
|
||||||
if (Processed) return yPageStart;
|
if (Processed) return yPageStart;
|
||||||
|
//float localYPageStart = yPageStart;
|
||||||
Processed = true;
|
Processed = true;
|
||||||
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||||
if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch;
|
if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch;
|
||||||
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
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);
|
if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess);
|
||||||
|
|
||||||
float retval = yLocation;
|
float retval = yLocation;
|
||||||
if (MyItemInfo.IsFigure)
|
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 (_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 (_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;
|
return yPageStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,11 +349,12 @@ namespace Volian.Print.Library
|
|||||||
float yTopMost = YTopMost;
|
float yTopMost = YTopMost;
|
||||||
//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
|
//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
|
||||||
yTopMost = Math.Min(yTopMost,YVeryTop);
|
yTopMost = Math.Min(yTopMost,YVeryTop);
|
||||||
yPageStart = yTopMargin + yTopMost - 2 * SixLinesPerInch;
|
yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch;
|
||||||
if (EmptyTopMostPart) yPageStart += SixLinesPerInch;
|
if (EmptyTopMostPart) yPageStart += SixLinesPerInch;
|
||||||
myMsg = docstyle.Continue.Top.Message;
|
myMsg = docstyle.Continue.Top.Message;
|
||||||
if (myMsg != null && myMsg != "")
|
if (myMsg != null && myMsg != "")
|
||||||
{
|
{
|
||||||
|
yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message
|
||||||
if (myMsg.IndexOf(@"%d") > -1)
|
if (myMsg.IndexOf(@"%d") > -1)
|
||||||
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanText.Trim(" .".ToCharArray()));
|
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);
|
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")
|
if (breakOrNot == "Yes")
|
||||||
{
|
{
|
||||||
// DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance);
|
// 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));
|
MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize));
|
||||||
}
|
}
|
||||||
// Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance);
|
// Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance);
|
||||||
@ -736,6 +736,10 @@ namespace Volian.Print.Library
|
|||||||
yTop = yTopNew;
|
yTop = yTopNew;
|
||||||
MyPageHelper.ParaBreaks.Add(paraBreak);
|
MyPageHelper.ParaBreaks.Add(paraBreak);
|
||||||
ySpaceOnCurPage = yPageSize - 2 * SixLinesPerInch; // Allow for continue message and blank line.
|
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;
|
yLowerLimit = ySpaceOnCurPage / 2;
|
||||||
if(_Match16BitPagination)yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP
|
if(_Match16BitPagination)yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP
|
||||||
yStart = 0;
|
yStart = 0;
|
||||||
@ -798,8 +802,9 @@ namespace Volian.Print.Library
|
|||||||
foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation
|
foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation
|
||||||
{
|
{
|
||||||
// The top of this step will fit onto page (-yLocation < yWithinMargins)
|
// The top of this step will fit onto page (-yLocation < yWithinMargins)
|
||||||
if (-yLocation < yUpperLimit)
|
if (-yLocation <= yUpperLimit) // Fix for OFN-RJ-23
|
||||||
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
|
//if (-yLocation < yUpperLimit) // Before
|
||||||
|
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
|
||||||
{
|
{
|
||||||
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
|
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
|
||||||
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer");
|
//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)
|
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
|
||||||
yoff += SetHeader(this, cb, itemInfo, formatInfo);
|
yoff += SetHeader(this, cb, itemInfo, formatInfo);
|
||||||
YOffset = yoff;
|
YOffset = yoff;
|
||||||
|
|
||||||
if (itemInfo.IsRNOPart)
|
if (itemInfo.IsRNOPart)
|
||||||
{
|
{
|
||||||
// there may be other places that double space, but this supports it for RNOs (the DoubleRNOspace flag)
|
// 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);
|
AddMacros(itemInfo, mytab);
|
||||||
if (mytab != null)
|
if (mytab != null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user