Add text to checkbox for blank page printing
Improve pagination for SAMG facing page print
This commit is contained in:
@@ -87,6 +87,8 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public class PromsPrinter
|
||||
{
|
||||
public bool NeedSupInfoBreak = false;
|
||||
public E_SupInfoPrintType SupInfoPrintType = E_SupInfoPrintType.None;
|
||||
// used to link supinfo steps in pdf
|
||||
public int SupInfoPdfPageCount = -1;
|
||||
private Dictionary<int, int> _SupInfoPdfPage;
|
||||
@@ -95,6 +97,12 @@ 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)
|
||||
public bool DoingFacingPage
|
||||
{
|
||||
get { return _DoingFacingPage; }
|
||||
set { _DoingFacingPage = value; }
|
||||
}
|
||||
// used to save word sections with resolved ROs (for export file generated from approve)
|
||||
private Dictionary<int, byte[]> _DocReplace;
|
||||
public Dictionary<int, byte[]> DocReplace
|
||||
@@ -268,7 +276,20 @@ namespace Volian.Print.Library
|
||||
{
|
||||
if (_MyItem is ProcedureInfo)
|
||||
{
|
||||
if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
|
||||
if ((_MyItem as ProcedureInfo).ProcHasSupInfoData)
|
||||
{
|
||||
// Use two passes to print facing page supplemental information for SAMGs
|
||||
// First pass gets pagination for the step sections and stores the associated supplemental information ids in
|
||||
// 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.
|
||||
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);
|
||||
}
|
||||
else if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
|
||||
_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier))
|
||||
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
|
||||
else
|
||||
@@ -286,7 +307,7 @@ namespace Volian.Print.Library
|
||||
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
|
||||
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))
|
||||
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))
|
||||
{
|
||||
DirectoryInfo di1 = new DirectoryInfo(pdfFolder + @"\PageNumberPass2");
|
||||
if (!di1.Exists) di1.Create();
|
||||
@@ -297,7 +318,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
fi.MoveTo(di1.FullName + @"\" + fi.Name);
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_MyLog.ErrorFormat("{0} During Save {1}", ex.GetType().FullName, ex.Message);
|
||||
}
|
||||
@@ -698,6 +719,7 @@ namespace Volian.Print.Library
|
||||
bool firstStepSec = true;
|
||||
foreach (SectionInfo mySection in myProcedure.Sections)
|
||||
{
|
||||
NeedSupInfoBreak = true;
|
||||
if (((mySection.MyContent.Number.ToUpper() == "FOLDOUT" && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts)
|
||||
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
|
||||
!= doingFoldout) continue;
|
||||
@@ -853,7 +875,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// If the procedure has supplemental facing pages, but this section does not & it's the first section,
|
||||
// need a blank 'facing page'. Sections after the first will get blank 'facing page' in print's pagination logic
|
||||
if (myProcedure.ProcHasSupInfoData && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages)
|
||||
if (SupInfoPrintType==E_SupInfoPrintType.Merge && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages)
|
||||
{
|
||||
_MyHelper.OnBlankPage = true;
|
||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
||||
@@ -1586,6 +1608,11 @@ namespace Volian.Print.Library
|
||||
//PrintTimer pt = new PrintTimer();
|
||||
iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter;
|
||||
ItemInfo myItemInfo = section as ItemInfo;
|
||||
if (SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
|
||||
{
|
||||
if (section.StepSectPageBreaksForSupInfo == null) section.StepSectPageBreaksForSupInfo = new List<int>();
|
||||
else section.StepSectPageBreaksForSupInfo.Clear();
|
||||
}
|
||||
// 792: 72 * 11 inches - TopRow - Top is high value
|
||||
float _PointsPerPage = 792;
|
||||
float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin;
|
||||
@@ -1607,7 +1634,7 @@ namespace Volian.Print.Library
|
||||
_MyHelper.IsLandscape = false;
|
||||
_MyHelper.ChangeBarDefinition = MyChangeBarDefinition;
|
||||
//pt.Description = "vlnParagrph";
|
||||
vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0,true,this);
|
||||
vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0, true, this);
|
||||
//pt.Description = "After vlnParagrph";
|
||||
//if (myParagraph.MyItemInfo.InList(15906))
|
||||
//{
|
||||
@@ -1620,7 +1647,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// if there is supplemental information associated with this section... generate the pdf. This pdf will be used to place
|
||||
// supplemental information on facing pages
|
||||
if (myParagraph.SupInfoSection != null && myParagraph.SupInfoSection.ChildrenBelow != null && myParagraph.SupInfoSection.ChildrenBelow.Count > 0)
|
||||
if (SupInfoPrintType == E_SupInfoPrintType.Merge && myParagraph.SupInfoSection != null && myParagraph.SupInfoSection.ChildrenBelow != null && myParagraph.SupInfoSection.ChildrenBelow.Count > 0)
|
||||
GenerateSuppInfoPdf(myParagraph.SupInfoSection, yTopMargin, yBottomMargin);
|
||||
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
|
||||
if (myParagraph.MyPlaceKeeper != null)
|
||||
@@ -1706,7 +1733,6 @@ namespace Volian.Print.Library
|
||||
myPageHealper.CreatingSupInfoPage = true;
|
||||
myPageHealper.MyPdfContentByte = cb;
|
||||
myPageHealper.ChangeBarDefinition = MyChangeBarDefinition;
|
||||
myPageHealper.PrintingSupplmentalInformation = true;
|
||||
float yPageStart = yTopMargin;
|
||||
vlnParagraph._yPageStartForSupInfo = yTopMargin;
|
||||
vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
|
||||
@@ -1743,7 +1769,11 @@ namespace Volian.Print.Library
|
||||
PdfReader pdfreader = new PdfReader(SupInfoPdfName);
|
||||
sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1);
|
||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, 0, 0);
|
||||
DoingFacingPage = true;
|
||||
myPageHelper.ResetSvg();
|
||||
NewPage();
|
||||
DoingFacingPage = false;
|
||||
myPageHelper.ResetSvg();
|
||||
pdfreader.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Reference in New Issue
Block a user