Print Speed-up

This commit is contained in:
Rich 2014-04-10 21:39:17 +00:00
parent 44bc2844eb
commit e8fbd9d30b
6 changed files with 38 additions and 12 deletions

View File

@ -423,6 +423,7 @@ namespace VEPROMS.CSLA.Library
if (itemInfo == null) return; if (itemInfo == null) return;
itemInfo.LoadAllAtOnce = true; itemInfo.LoadAllAtOnce = true;
itemInfo.ActiveParent = itemParent; itemInfo.ActiveParent = itemParent;
itemInfo.MyParent = itemParent as ItemInfo;
// itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo; - possible fix for not accessing correct format // itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo; - possible fix for not accessing correct format
itemInfo.ActiveSection = sectionInfo; itemInfo.ActiveSection = sectionInfo;
itemInfo.MyProcedure = procInfo; itemInfo.MyProcedure = procInfo;
@ -431,8 +432,16 @@ namespace VEPROMS.CSLA.Library
itemInfo.MyContent.LoadNonCachedGrid(); itemInfo.MyContent.LoadNonCachedGrid();
if (itemInfo.MyContent.ContentPartCount > 0) if (itemInfo.MyContent.ContentPartCount > 0)
foreach (PartInfo pi in itemInfo.MyContent.ContentParts) foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
ItemInfo il = null;
foreach (ItemInfo ii in pi.MyItems) foreach (ItemInfo ii in pi.MyItems)
{
SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo); SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo);
ii.MyPrevious = il;
//if (il != null) il.NextItem = ii;
il = ii;
}
}
} }
/// <summary> /// <summary>
/// The following method is used only in print because the 'printed' data is loaded into /// The following method is used only in print because the 'printed' data is loaded into
@ -496,6 +505,7 @@ namespace VEPROMS.CSLA.Library
if (itemInfo == null) return; if (itemInfo == null) return;
itemInfo.LoadAllAtOnce = true; itemInfo.LoadAllAtOnce = true;
itemInfo.ActiveParent = itemParent; itemInfo.ActiveParent = itemParent;
itemInfo.MyParent = itemParent as ItemInfo;
// itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo; // itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo;
itemInfo.ActiveSection = sectionInfo; itemInfo.ActiveSection = sectionInfo;
itemInfo.MyDocVersion = docVersionInfo; itemInfo.MyDocVersion = docVersionInfo;
@ -525,9 +535,13 @@ namespace VEPROMS.CSLA.Library
{ {
foreach (PartInfo pi in itemInfo.MyContent.ContentParts) foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{ {
ItemInfo il = null;
foreach (ItemInfo ii in pi.MyItems) foreach (ItemInfo ii in pi.MyItems)
{ {
SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo, tranLookup); SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo, tranLookup);
ii.MyPrevious = il;
//if (il != null) il.NextItem = ii;
il = ii;
} }
} }
} }
@ -2011,6 +2025,10 @@ namespace VEPROMS.CSLA.Library
} }
return _MyParent; return _MyParent;
} }
set
{
_MyParent = value;
}
} }
#endregion #endregion
#region Lookups and More Related #region Lookups and More Related

View File

@ -130,6 +130,10 @@ namespace VEPROMS.CSLA.Library
if (_MyPrevious == null && _PreviousID != null) _MyPrevious = ItemInfo.Get((int)_PreviousID); if (_MyPrevious == null && _PreviousID != null) _MyPrevious = ItemInfo.Get((int)_PreviousID);
return _MyPrevious; return _MyPrevious;
} }
set
{
_MyPrevious = value;
}
} }
private int _ContentID; private int _ContentID;
public int ContentID public int ContentID

View File

@ -93,6 +93,8 @@ namespace Volian.Base.Library
{ _MyDebugPrint.WriteLine(format, args); } { _MyDebugPrint.WriteLine(format, args); }
public static void Show() public static void Show()
{ _MyDebugPrint.Show(); } { _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
} }
public static class DebugText public static class DebugText
{ {
@ -107,5 +109,7 @@ namespace Volian.Base.Library
{ _MyDebugPrint.WriteLine(format, args); } { _MyDebugPrint.WriteLine(format, args); }
public static void Show() public static void Show()
{ _MyDebugPrint.Show(); } { _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
} }
} }

View File

@ -333,7 +333,7 @@ namespace Volian.Print.Library
//_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination - ItemID = {0}\r\nLocation = '{1}'", MyItemInfo.ItemID, MyItemInfo.ShortPath); //_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination - ItemID = {0}\r\nLocation = '{1}'", MyItemInfo.ItemID, MyItemInfo.ShortPath);
_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination\r\n==>'Forced Pagination',{0},'{1}','{2}'" _MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination\r\n==>'Forced Pagination',{0},'{1}','{2}'"
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath);
DebugPagination.WriteLine("=====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath); if(DebugPagination.IsOpen) DebugPagination.WriteLine("=====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath);
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin); retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin);
} }
private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins, bool manualPageBreak) private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins, bool manualPageBreak)
@ -341,7 +341,7 @@ namespace Volian.Print.Library
if (breakOrNot != "No") if (breakOrNot != "No")
{ {
// DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance); // DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance);
DebugPagination.WriteLine("{0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}", if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}",
MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1), MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1),
MyItemInfo.ShortPath, instance, MyItemInfo.ShortPath, instance,
(manualPageBreak ? "Manual " : "") + message, breakOrNot, (manualPageBreak ? "Manual " : "") + message, breakOrNot,
@ -417,7 +417,7 @@ namespace Volian.Print.Library
//Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release //Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release
if (paraBreak == null) if (paraBreak == null)
{ {
DebugPagination.WriteLine("<<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}" if (DebugPagination.IsOpen) DebugPagination.WriteLine("<<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}"
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, YSize - yTop, ySpaceOnCurPageSave); , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, YSize - yTop, ySpaceOnCurPageSave);
_MyLog.ErrorFormat("<<< ERROR >>> Cannot find a place to break\r\n==>'Cannot Find Place to Break',{0},'{1}','{2}'" _MyLog.ErrorFormat("<<< ERROR >>> Cannot find a place to break\r\n==>'Cannot Find Place to Break',{0},'{1}','{2}'"
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath);

View File

@ -544,12 +544,12 @@ namespace Volian.Print.Library
PrintTextMessage(cb, "No Proms Output", _TextLayer); PrintTextMessage(cb, "No Proms Output", _TextLayer);
cb.PdfDocument.NewPage(); // only have 16bit pages left (for DebugMode) cb.PdfDocument.NewPage(); // only have 16bit pages left (for DebugMode)
//_MyLog.InfoFormat("NewPage 2 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 2 {0}", cb.PdfWriter.CurrentPageNumber);
DebugPagination.WriteLine("{0:D6},'{1}'", if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}'",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "No PROMS Output"); _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "No PROMS Output");
} }
} }
OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress); OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress);
DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber; if (DebugPagination.IsOpen) DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber;
CloseDocument(cb, outputFileName); CloseDocument(cb, outputFileName);
_MyHelper = null; _MyHelper = null;
return outputFileName; return outputFileName;
@ -632,7 +632,7 @@ namespace Volian.Print.Library
float yoff = 0; float yoff = 0;
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin; if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff); AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff);
DebugPagination.WriteLine("{0:D6},'{1}',{2}", if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber); _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
} }
@ -983,7 +983,7 @@ namespace Volian.Print.Library
if (doimport2) if (doimport2)
{// put the saved foldout page into the PDF {// put the saved foldout page into the PDF
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0); AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0);
DebugPagination.WriteLine("{0:D6},'{1}',{2}", if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
myPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "Foldout", 1); myPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "Foldout", 1);
} }
} }

View File

@ -666,7 +666,7 @@ namespace Volian.Print.Library
private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{ {
//DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText); //DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText);
DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset); if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset);
float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless")); float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
if (MyGrid.Height > (yTopMargin - yBottomMargin)) if (MyGrid.Height > (yTopMargin - yBottomMargin))
{ {
@ -678,7 +678,7 @@ namespace Volian.Print.Library
private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{ {
DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText);
//Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content); //Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content);
float retval = yLocation; float retval = yLocation;
// Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2 // Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2
@ -788,7 +788,7 @@ namespace Volian.Print.Library
get get
{ {
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}", return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}",
DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData == null ? "NoStepData" : MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset); DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData == null ? "NoStepData" : MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset);
} }
} }
private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin) private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)
@ -812,7 +812,7 @@ namespace Volian.Print.Library
} }
} }
MyPageHelper.DidFirstPageDocStyle = true; MyPageHelper.DidFirstPageDocStyle = true;
DebugPagination.WriteLine("ResetDocStyleAndValues"); if (DebugPagination.IsOpen) DebugPagination.WriteLine("ResetDocStyleAndValues");
MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection; MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection;
yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin; yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength); yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength);
@ -845,7 +845,7 @@ namespace Volian.Print.Library
float yLocalypagestart = yPageStart; float yLocalypagestart = yPageStart;
// yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph. // yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph.
float yLocation = yPageStart - YTopMost; float yLocation = yPageStart - YTopMost;
DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortPath, XOffset, yLocation, yPageStart, YTopMost); if(DebugText.IsOpen) DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortPath, XOffset, yLocation, yPageStart, YTopMost);
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
bool doSectionTitleContinued = false; // will add " Continued" to the section title if format flag is set bool doSectionTitleContinued = false; // will add " Continued" to the section title if format flag is set