B2018-099: Print all & Approve all of large set crashes with out of memory error

This commit is contained in:
2018-06-29 13:24:15 +00:00
parent 8b431d2fe4
commit 03f07f3aeb
4 changed files with 45 additions and 18 deletions

View File

@@ -569,7 +569,7 @@ namespace VEPROMS
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value);//C2018-009 print PROMS version
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
@@ -595,7 +595,7 @@ namespace VEPROMS
// B2016-249 Output Procedure to folder associated with Parent Child
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value);//C2018-009 print PROMS version
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
@@ -624,7 +624,7 @@ namespace VEPROMS
// B2016-249 Output Procedure to folder associated with Parent Child
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked,
cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text,
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value);//C2018-009 print PROMS version
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
@@ -721,7 +721,7 @@ namespace VEPROMS
// B2016-249 Output Procedure to folder associated with Parent Child
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic,Prefix,SaveLinks,RemoveTrailingHardReturnsAndManualPageBreaks,swtbtnPROMSVersion.Value); //C2018-009 print PROMS version
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic,Prefix,SaveLinks,RemoveTrailingHardReturnsAndManualPageBreaks,swtbtnPROMSVersion.Value, false); //C2018-009 print PROMS version
frmStatus.MakePlaceKeeper = swtbtnGeneratePlacekeeper.Value;
frmStatus.MakeContinuousActionSummary = cbxGenerateConActSum.Checked;
if (Automatic && cbxGenerateConActSum.Checked)

View File

@@ -1134,7 +1134,7 @@ namespace VEPROMS
//ProcedureInfo myproc = pi;
//frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
//myproc.ChangeBarDate = myDTS;
frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location, pi.MyDocVersion.DocVersionConfig.Print_AddBlankPagesWhenUsingDuplexFoldouts, true,"",false,false,false);
frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location, pi.MyDocVersion.DocVersionConfig.Print_AddBlankPagesWhenUsingDuplexFoldouts, true,"",false,false,false,MyProcedures.Count > (MyProcedures[0].ProcInfo.MyDocVersion.Procedures.Count/4));
frm.AllowAllWatermarks = true;
frm.CloseWhenDone = !ViewPDF;
frm.DocReplace = new Dictionary<int, byte[]>(); // will hold the Word Attachments with resolved ROs

View File

@@ -75,10 +75,17 @@ namespace VEPROMS
get { return _OnlyShowContinuousActionSummary; }
set { _OnlyShowContinuousActionSummary = value; }
}
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation,bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, bool removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer)
private bool _DidAll = false;
public bool DidAll
{
get { return _DidAll; }
set { _DidAll = value; }
}
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation,bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, bool removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll)
{
Prefix = prefix;
OpenPDF = openPDF;
DidAll = didAll;
InitializeComponent();
// if the version number of PROMS is 1.0, then we are running a Demo version.
// When running a Demo version, force a "Sample" watermark when printing.
@@ -166,8 +173,25 @@ namespace VEPROMS
do
{
int profileDepth = ProfileTimer.Push(">>>> MyPromsPrinter.Print");
// B2018-099: remove cache items for contents, items and parts to prevent out of memory errors when
// doing print all or automated print testing or approval of some or all procedures, i.e. HashSet and use of them below.
HashSet<int> cacheContentInfo = null;
HashSet<int> cacheItemInfo = null;
HashSet<int> cachePartInfo = null;
if (DidAll)
{
cacheContentInfo = ContentInfo.CacheList;
cacheItemInfo = ItemInfo.CacheList;
cachePartInfo = PartInfo.CacheList;
}
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary);
ProfileTimer.Pop(profileDepth);
if (DidAll)
{
ContentInfo.RestoreCacheList(cacheContentInfo);
ItemInfo.RestoreCacheList(cacheItemInfo);
PartInfo.RestoreCacheList(cachePartInfo);
}
}
while (_PdfFile == null && MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
if (_PdfFile == null)