B2020-159: Pagination Problems (Forced Pagination) reported to user via dialog

This commit is contained in:
2020-12-03 16:28:15 +00:00
parent b2419c1f5c
commit fdead6e998
2 changed files with 66 additions and 8 deletions

View File

@@ -97,7 +97,7 @@ namespace Volian.Print.Library
get { return _SupInfoPdfPage; }
set { _SupInfoPdfPage = value; }
}
private bool _DoingFacingPage = false; // used to flag actual pdf generation of facing page within final print (so no section titles get printed)
private bool _DoingFacingPage = false; // used to flag actual pdf generation of facing page within final print (so no section titles get printed)
public bool DoingFacingPage
{
get { return _DoingFacingPage; }
@@ -201,7 +201,7 @@ namespace Volian.Print.Library
get { return _MyChangeBarDefinition; }
set { _MyChangeBarDefinition = value; }
}
private bool _OriginalPageBreak; // use 16bit page breaks.
private bool _OriginalPageBreak; // use 16bit page breaks.
public bool OriginalPageBreak
{
get { return _OriginalPageBreak; }
@@ -213,12 +213,40 @@ namespace Volian.Print.Library
get { return _InsertBlankPages; }
set { _InsertBlankPages = value; }
}
private bool _BatchPrint = true; // flags that a batch-type print is occurring, i.e. AllProcedures or Automatic testing
private bool _BatchPrint = true; // flags that a batch-type print is occurring, i.e. AllProcedures or Automatic testing
public bool BatchPrint
{
get { return _BatchPrint; }
set { _BatchPrint = value; }
}
// B2020-159: When printing, if forced pagination errors occurred (see Pagination.cs), put up a dialog with
// the places they occurred. Do not do this is running baseline/automatic print testing.
private static List<string> _ForcedPaginations = null;
public static List<string> ForcedPaginations
{
get { return PromsPrinter._ForcedPaginations; }
set { PromsPrinter._ForcedPaginations = value; }
}
public static DialogResult ReportForcedPaginations()
{
if (ForcedPaginations != null && ForcedPaginations.Count > 0)
{
string pnProbl = null;
foreach (string pstr in ForcedPaginations)
pnProbl = pnProbl + "\r\n" + pstr;
Clipboard.SetText(pnProbl);
return FlexibleMessageBox.Show(
"PROMS has identified location(s) in the PDF file that was created that may not have paginated correctly."
+ "\r\nOn or around the following pages should be reviewed to ensure that the procedure is correct."
+ "\r\nVerify that there is no missing text on the page(s) designated."
+ "\r\nIf not correct, the procedure writer will have to modify the procedure content or add hard returns."
+ "\r\nContact Volian if assistance is needed."
+ "\r\nThe following list was placed on the Windows Clipboard."
+ "\r\n\r\nPDF File\t\tSection/Step\t\t\tPDF Page No.\r\n" + pnProbl,
"Forced Pagination", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return DialogResult.OK;
}
private static List<string> _TransPageNumProblems = null;
public static List<string> TransPageNumProblems
{
@@ -342,16 +370,30 @@ namespace Volian.Print.Library
// the list StepSectPageBreaksForSupInfo off of the section object
// Second pass prints the supplemental information pdfs using the list generated in the first pass to know where to do the
// supplemental information page breaks & then merges in those pages when printing the step sections.
SectionInfo.ResetLookupStepSectPageBreaks(); // B2017-192: Reset lists for tracking page breaks
SectionInfo.ResetLookupStepSectPageBreaks(); // B2017-192: Reset lists for tracking page breaks
SectionInfo.ResetLookupStepSectPageBreaksForSupInfo();
SupInfoPrintType = E_SupInfoPrintType.DoPageBreaks;
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false, false);
if (retstr == null) return null;
SupInfoPrintType = E_SupInfoPrintType.Merge;
return Print(_MyItem as ProcedureInfo, pdfFolder, false, false);
string tmps = Print(_MyItem as ProcedureInfo, pdfFolder, false, false);
if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{
ReportForcedPaginations();
ForcedPaginations.Clear();
}
return tmps;
}
else // B2017-186 Neither Facing Pages or Page Number Transitions
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
{
string tmpss = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{
ReportForcedPaginations();
ForcedPaginations.Clear();
}
return tmpss;
}
}
else // B2017-186 Page Number Transitions
{
@@ -380,6 +422,12 @@ namespace Volian.Print.Library
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
if (! BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{
ReportForcedPaginations();
ForcedPaginations.Clear();
}
if (TransPageNumProblems.Count > 0)
{
if (BatchPrint || (MessageBox.Show("Page Number Transitions may be fixed if a second pass is performed. Do you want to perform a second pass?", "Page Number Transition Errors", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
@@ -685,6 +733,7 @@ namespace Volian.Print.Library
private static List<SectionInfo> _MyFoldoutSection = null;
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary)
{
if (_ForcedPaginations != null) _ForcedPaginations.Clear();
int profileDepth = ProfileTimer.Push(">>>> PromsPrinter.Print");
if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>();