Add text to checkbox for blank page printing

Improve pagination for SAMG facing page print
This commit is contained in:
Kathy Ruffing 2017-05-12 13:50:02 +00:00
parent d8f00ec197
commit bbbcdf946a
7 changed files with 166 additions and 43 deletions

View File

@ -1153,7 +1153,7 @@ namespace VEPROMS
this.cbxBlankPgsForDuplex.Name = "cbxBlankPgsForDuplex"; this.cbxBlankPgsForDuplex.Name = "cbxBlankPgsForDuplex";
this.cbxBlankPgsForDuplex.Size = new System.Drawing.Size(323, 19); this.cbxBlankPgsForDuplex.Size = new System.Drawing.Size(323, 19);
this.cbxBlankPgsForDuplex.TabIndex = 101; this.cbxBlankPgsForDuplex.TabIndex = 101;
this.cbxBlankPgsForDuplex.Text = "Add Blank Pages When Using Duplex Foldouts"; this.cbxBlankPgsForDuplex.Text = "Add Blank Pages For Duplex Foldouts or SAMG Facing Pages";
this.cbxBlankPgsForDuplex.UseVisualStyleBackColor = false; this.cbxBlankPgsForDuplex.UseVisualStyleBackColor = false;
// //
// cbxGeneratePlacekeeper // cbxGeneratePlacekeeper

View File

@ -6885,6 +6885,14 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly
{ {
// Keeps track of itemids for supplemental info steps where their associated steps would have page breaks.
private List<int> _StepSectPageBreaksForSupInfo = null;
public List<int> StepSectPageBreaksForSupInfo
{
get { return _StepSectPageBreaksForSupInfo; }
set { _StepSectPageBreaksForSupInfo = value; }
}
// Determine if this section contains any Supplemental information steps. This is used for print to determine // Determine if this section contains any Supplemental information steps. This is used for print to determine
// whether some of the supinfo processing needs to occur. // whether some of the supinfo processing needs to occur.
private bool? _HasSupInfoSteps = null; private bool? _HasSupInfoSteps = null;

View File

@ -240,5 +240,11 @@ namespace VEPROMS.CSLA.Library
CtrlRight = 7, CtrlRight = 7,
CtrlLeft = 8 CtrlLeft = 8
} }
public enum E_SupInfoPrintType : uint
{
None = 0,
DoPageBreaks = 1,
Merge = 2
}
#endregion #endregion
} }

View File

@ -78,13 +78,13 @@ namespace Volian.Print.Library
ShowPageBreak(1, "Page Break before empty section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); ShowPageBreak(1, "Page Break before empty section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 1; return 1;
} }
// If printing a supinfo part, add an entry to the dictionary that says what page I am on. // If printing a supinfo pdf, see if there is a page break at this supinfo paragraph, i.e. an entry will
if (MyPageHelper.PrintingSupplmentalInformation) // exist in the list that contains the supinfo paragraph pagebreaks that was generated in the first pagebreak pass
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage)
{ {
int retval = 0; int retval = 0;
// came across a user defined preferred page break, increment the page count for the supplemental info pdf & return 1 to break the page. SectionInfo supInfoSect = MyItemInfo.MyActiveSection as SectionInfo;
// the PrefPageBreak is set when creating the paragraphs (see vlnParagraph constructor) if (supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(MyItemInfo.ItemID))
if (PrefPageBreak)
{ {
MyPromsPrinter.SupInfoPdfPageCount++; MyPromsPrinter.SupInfoPdfPageCount++;
retval = 1; retval = 1;
@ -99,6 +99,7 @@ namespace Volian.Print.Library
} }
else if (MyItemInfo.MyDocStyle.SupplementalInformation && MyItemInfo.IsStep) else if (MyItemInfo.MyDocStyle.SupplementalInformation && MyItemInfo.IsStep)
{ {
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null) return 1;
StepConfig sci = MyItemInfo.MyConfig as StepConfig; StepConfig sci = MyItemInfo.MyConfig as StepConfig;
if (sci.Step_PreferredPagebreak) if (sci.Step_PreferredPagebreak)
{ {

View File

@ -87,6 +87,8 @@ namespace Volian.Print.Library
} }
public class PromsPrinter public class PromsPrinter
{ {
public bool NeedSupInfoBreak = false;
public E_SupInfoPrintType SupInfoPrintType = E_SupInfoPrintType.None;
// used to link supinfo steps in pdf // used to link supinfo steps in pdf
public int SupInfoPdfPageCount = -1; public int SupInfoPdfPageCount = -1;
private Dictionary<int, int> _SupInfoPdfPage; private Dictionary<int, int> _SupInfoPdfPage;
@ -95,6 +97,12 @@ namespace Volian.Print.Library
get { return _SupInfoPdfPage; } get { return _SupInfoPdfPage; }
set { _SupInfoPdfPage = value; } 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) // used to save word sections with resolved ROs (for export file generated from approve)
private Dictionary<int, byte[]> _DocReplace; private Dictionary<int, byte[]> _DocReplace;
public Dictionary<int, byte[]> DocReplace public Dictionary<int, byte[]> DocReplace
@ -268,7 +276,20 @@ namespace Volian.Print.Library
{ {
if (_MyItem is ProcedureInfo) 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)) _MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier))
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary); return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
else else
@ -286,7 +307,7 @@ namespace Volian.Print.Library
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary); retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
if (TransPageNumProblems.Count > 0) 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"); DirectoryInfo di1 = new DirectoryInfo(pdfFolder + @"\PageNumberPass2");
if (!di1.Exists) di1.Create(); if (!di1.Exists) di1.Create();
@ -297,7 +318,7 @@ namespace Volian.Print.Library
{ {
fi.MoveTo(di1.FullName + @"\" + fi.Name); fi.MoveTo(di1.FullName + @"\" + fi.Name);
} }
catch(Exception ex) catch (Exception ex)
{ {
_MyLog.ErrorFormat("{0} During Save {1}", ex.GetType().FullName, ex.Message); _MyLog.ErrorFormat("{0} During Save {1}", ex.GetType().FullName, ex.Message);
} }
@ -698,6 +719,7 @@ namespace Volian.Print.Library
bool firstStepSec = true; bool firstStepSec = true;
foreach (SectionInfo mySection in myProcedure.Sections) foreach (SectionInfo mySection in myProcedure.Sections)
{ {
NeedSupInfoBreak = true;
if (((mySection.MyContent.Number.ToUpper() == "FOLDOUT" && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts) if (((mySection.MyContent.Number.ToUpper() == "FOLDOUT" && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts)
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT"))) || (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
!= doingFoldout) continue; != 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, // 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 // 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; _MyHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1)); cb.PdfDocument.Add(new iTextSharp.text.Table(1));
@ -1586,6 +1608,11 @@ namespace Volian.Print.Library
//PrintTimer pt = new PrintTimer(); //PrintTimer pt = new PrintTimer();
iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter; iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter;
ItemInfo myItemInfo = section as ItemInfo; 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 // 792: 72 * 11 inches - TopRow - Top is high value
float _PointsPerPage = 792; float _PointsPerPage = 792;
float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin; float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin;
@ -1607,7 +1634,7 @@ namespace Volian.Print.Library
_MyHelper.IsLandscape = false; _MyHelper.IsLandscape = false;
_MyHelper.ChangeBarDefinition = MyChangeBarDefinition; _MyHelper.ChangeBarDefinition = MyChangeBarDefinition;
//pt.Description = "vlnParagrph"; //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"; //pt.Description = "After vlnParagrph";
//if (myParagraph.MyItemInfo.InList(15906)) //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 // if there is supplemental information associated with this section... generate the pdf. This pdf will be used to place
// supplemental information on facing pages // 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); GenerateSuppInfoPdf(myParagraph.SupInfoSection, yTopMargin, yBottomMargin);
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (myParagraph.MyPlaceKeeper != null) if (myParagraph.MyPlaceKeeper != null)
@ -1706,7 +1733,6 @@ namespace Volian.Print.Library
myPageHealper.CreatingSupInfoPage = true; myPageHealper.CreatingSupInfoPage = true;
myPageHealper.MyPdfContentByte = cb; myPageHealper.MyPdfContentByte = cb;
myPageHealper.ChangeBarDefinition = MyChangeBarDefinition; myPageHealper.ChangeBarDefinition = MyChangeBarDefinition;
myPageHealper.PrintingSupplmentalInformation = true;
float yPageStart = yTopMargin; float yPageStart = yTopMargin;
vlnParagraph._yPageStartForSupInfo = yTopMargin; vlnParagraph._yPageStartForSupInfo = yTopMargin;
vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
@ -1743,7 +1769,11 @@ namespace Volian.Print.Library
PdfReader pdfreader = new PdfReader(SupInfoPdfName); PdfReader pdfreader = new PdfReader(SupInfoPdfName);
sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1); sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1);
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, 0, 0); AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, 0, 0);
DoingFacingPage = true;
myPageHelper.ResetSvg();
NewPage(); NewPage();
DoingFacingPage = false;
myPageHelper.ResetSvg();
pdfreader.Close(); pdfreader.Close();
} }
catch (Exception ex) catch (Exception ex)

View File

@ -222,13 +222,6 @@ namespace Volian.Print.Library
get { return _PrintedSectionPage; } get { return _PrintedSectionPage; }
set { _PrintedSectionPage = value; } set { _PrintedSectionPage = value; }
} }
private bool _PrintingSupplmentalInformation = false;
public bool PrintingSupplmentalInformation
{
get { return _PrintingSupplmentalInformation; }
set { _PrintingSupplmentalInformation = value; }
}
//private bool _AddBlankPagesForDuplexPrinting = false; //private bool _AddBlankPagesForDuplexPrinting = false;
//public bool AddBlankPagesForDuplexPrinting // Tells us if a the option to add a blank page is turn on (for procedures with duplex foldouts) //public bool AddBlankPagesForDuplexPrinting // Tells us if a the option to add a blank page is turn on (for procedures with duplex foldouts)
//{ //{
@ -987,8 +980,8 @@ namespace Volian.Print.Library
{ {
HLSText = hlsText; HLSText = hlsText;
HasHLSTextId = hlsItemId; HasHLSTextId = hlsItemId;
MySection = mySection;
MyPromsPrinter = myPromsPrinter; MyPromsPrinter = myPromsPrinter;
MySection = mySection;
} }
private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection, bool forceLoad) private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection, bool forceLoad)
{ {
@ -1657,6 +1650,7 @@ namespace Volian.Print.Library
{ {
if (section.DisplayText.ToUpper().Contains("<NO TITLE>") && !section.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) printsectlevel = false; if (section.DisplayText.ToUpper().Contains("<NO TITLE>") && !section.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) printsectlevel = false;
} }
if (MyPromsPrinter.DoingFacingPage) printsectlevel = false; // don't put out section title/number if doing SAMG facing pages
if (printsectlevel) if (printsectlevel)
{ {
string stitle = section.DisplayText; string stitle = section.DisplayText;
@ -1690,8 +1684,14 @@ namespace Volian.Print.Library
break; break;
case "{SECTIONLEVELNUMBER}": case "{SECTIONLEVELNUMBER}":
case "[SECTIONLEVELNUMBER]": case "[SECTIONLEVELNUMBER]":
// don't put out section title/number if doing SAMG facing pages
if (!MyPromsPrinter.DoingFacingPage)
{
plstr = plstr.Replace(token, section.DisplayNumber); plstr = plstr.Replace(token, section.DisplayNumber);
_sectLevelNumTtlDiff = (int)pageItem.Row; _sectLevelNumTtlDiff = (int)pageItem.Row;
}
else
plstr = plstr.Replace(token, "");
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.DisplayNumber))); //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.DisplayNumber)));
break; break;
case "{METASECTIONNUMBER}": // This will print the top level section number case "{METASECTIONNUMBER}": // This will print the top level section number

View File

@ -1532,6 +1532,15 @@ namespace Volian.Print.Library
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
DocStyle docstyle = null; DocStyle docstyle = null;
// If SAMG facing page print & doing first pass to generate page break list of supplemental info and
// there was a page break in the step section, but not an associated supinfo item, do the page break when the
// next supinfo item is found:
SectionInfo supInfoSect = MyItemInfo.MyActiveSection as SectionInfo;
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks && MyPromsPrinter.NeedSupInfoBreak && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0)
{
supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
MyPromsPrinter.NeedSupInfoBreak = false;
}
switch (paginate) switch (paginate)
{ {
// .oooooo. .oooo. // .oooooo. .oooo.
@ -1555,6 +1564,21 @@ namespace Volian.Print.Library
yPageStart = _yPageStartForSupInfo - SixLinesPerInch; yPageStart = _yPageStartForSupInfo - SixLinesPerInch;
yLocation = yPageStart - YTopMost; yLocation = yPageStart - YTopMost;
} }
// printing a procedure with section(s) that have supplemental information - determine facing page needed to be merged in:
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
{
MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true);
}
else
{
MyPageHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
MyPromsPrinter.NewPage();
}
}
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS))
yPageStart -= SixLinesPerInch; yPageStart -= SixLinesPerInch;
if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep) if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep)
@ -1573,6 +1597,14 @@ namespace Volian.Print.Library
//`88b ooo d8( 888 o. )88b 888 .o 888 //`88b ooo d8( 888 o. )88b 888 .o 888
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' o888o // `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' o888o
case 1: // Break on High Level Step case 1: // Break on High Level Step
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
{
// page break here, determine if there is caution/note above where the page break actually needs to go:
int aboveSupinfoId = ChildrenAboveHaveSupInfo();
if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0 && aboveSupinfoId > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(aboveSupinfoId);
else if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
else MyPromsPrinter.NeedSupInfoBreak = true;
}
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle; docstyle = MyItemInfo.MyDocStyle;
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin); if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
@ -1619,7 +1651,7 @@ namespace Volian.Print.Library
// If there is supplemental information to be printed on the facing page, then get the id that has supinfo // If there is supplemental information to be printed on the facing page, then get the id that has supinfo
// so that it can be retrieved from the pdf for the supinfos for this section. If there is one, // so that it can be retrieved from the pdf for the supinfos for this section. If there is one,
// use DoSupInfoPage to put out the page, otherwise do a blank page. // use DoSupInfoPage to put out the page, otherwise do a blank page.
if (!MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps) if (MyPromsPrinter.SupInfoPrintType==E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps)
{ {
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1) if (sid != -1)
@ -1662,7 +1694,12 @@ namespace Volian.Print.Library
// 888 .oP"888 `"Y88b. 888ooo888 .dP' // 888 .oP"888 `"Y88b. 888ooo888 .dP'
// `88b ooo d8( 888 o. )88b 888 .o .oP .o // `88b ooo d8( 888 o. )88b 888 .o .oP .o
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' 8888888888 // `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' 8888888888
case 2: // Break within a Step case 2: // Break within a Step'
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
{
if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
else MyPromsPrinter.NeedSupInfoBreak = true;
}
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle; docstyle = MyItemInfo.MyDocStyle;
bool doAlarmBox = false; bool doAlarmBox = false;
@ -1848,6 +1885,11 @@ namespace Volian.Print.Library
// `88b ooo d8( 888 o. )88b 888 .o o. .88P // `88b ooo d8( 888 o. )88b 888 .o o. .88P
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' `8bd88P' // `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' `8bd88P'
case 3: // Break on High Level Step (SevenLinesPerInch) case 3: // Break on High Level Step (SevenLinesPerInch)
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
{
if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
else MyPromsPrinter.NeedSupInfoBreak = true;
}
if (!firstHighLevelStep) if (!firstHighLevelStep)
{ {
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
@ -1874,6 +1916,23 @@ namespace Volian.Print.Library
MyPromsPrinter.NewPage(); MyPromsPrinter.NewPage();
//_MyLog.InfoFormat("NewPage 12 lpi blank {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 12 lpi blank {0}", cb.PdfWriter.CurrentPageNumber);
} }
// If there is supplemental information to be printed on the facing page, then get the id that has supinfo
// so that it can be retrieved from the pdf for the supinfos for this section. If there is one,
// use DoSupInfoPage to put out the page, otherwise do a blank page.
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
{
MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true);
}
else
{
MyPageHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
MyPromsPrinter.NewPage();
}
}
if (MyItemInfo.MyDocStyle.LandscapePageList) if (MyItemInfo.MyDocStyle.LandscapePageList)
{ {
System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0);
@ -2092,6 +2151,16 @@ namespace Volian.Print.Library
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
return yPageStart; return yPageStart;
} }
private int ChildrenAboveHaveSupInfo()
{
if (ChildrenAbove == null || ChildrenAbove.Count < 1) return -1;
foreach (vlnParagraph p in ChildrenAbove)
{
if (p.MyItemInfo.SupInfos != null && p.MyItemInfo.SupInfos.Count > 0) return p.MyItemInfo.SupInfos[0].ItemID;
}
return -1;
}
// Find the step that has supplemental information from this step down page until a preferred page break is found. // Find the step that has supplemental information from this step down page until a preferred page break is found.
// It is used to determine whether there is a supinfo facing page or if there should be a blank page. // It is used to determine whether there is a supinfo facing page or if there should be a blank page.
private int GetIdThatHasSupInfoItems(ItemInfo ii, int startid) private int GetIdThatHasSupInfoItems(ItemInfo ii, int startid)
@ -2980,7 +3049,6 @@ namespace Volian.Print.Library
// Save step text information to be used to create a Continuous Action Summary // Save step text information to be used to create a Continuous Action Summary
BuildContinuousActionSummary(parent, itemInfo); BuildContinuousActionSummary(parent, itemInfo);
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
_MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj); _MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles; ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
@ -3082,7 +3150,7 @@ namespace Volian.Print.Library
doprint = false; doprint = false;
} }
// if printing the supplemental info facing page, don't put out the section title. ToPdf will put out 'Supplemental Information' title. // if printing the supplemental info facing page, don't put out the section title. ToPdf will put out 'Supplemental Information' title.
if (MyPageHelper.CreatingSupInfoPage && itemInfo.IsSection) doprint = false; if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage && itemInfo.IsSection) doprint = false;
if (doprint && itemInfo.IsSection && !itemInfo.MyDocStyle.CancelSectTitle && itemInfo.MyTab.Text.ToUpper() != "FOLDOUT") if (doprint && itemInfo.IsSection && !itemInfo.MyDocStyle.CancelSectTitle && itemInfo.MyTab.Text.ToUpper() != "FOLDOUT")
{ {
doSectTab = true; doSectTab = true;
@ -3163,14 +3231,7 @@ namespace Volian.Print.Library
if (!itemInfo.IsSection || doSectTab) if (!itemInfo.IsSection || doSectTab)
{ {
if (itemInfo.IsSupInfoPart) // get combined tab if on a supinfo facing page: if (itemInfo.IsSupInfoPart) // get combined tab if on a supinfo facing page:
{ mytab = GetSupInfoTab(cb, itemInfo, yoff, mytab, doSectTab, localXOffset);
string strmytab = null;
if (itemInfo.MyParent.IsHigh)
strmytab = itemInfo.MyTab.CleanText;
else
strmytab = ItemInfo.GetCombinedTab(itemInfo.MyParent, itemInfo.MyParent.MyParent.CombinedTab);
mytab = new vlnTab(cb, this, strmytab, strmytab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
}
else if (itemInfo.MyTab.AltPrintTab != null) else if (itemInfo.MyTab.AltPrintTab != null)
mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
else else
@ -3179,6 +3240,11 @@ namespace Volian.Print.Library
if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro); if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro);
} }
} }
else if (itemInfo.IsSupInfoPart) // if it was an empty tab - it may have been a caution/note
{
mytab = GetSupInfoTab(cb, itemInfo, yoff, mytab, doSectTab, XOffset);
PartsLeft.Add(mytab);
}
// if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab // if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab
// at the x location rather than starting the text at the x location: // at the x location rather than starting the text at the x location:
AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); AdjustWidth(itemInfo, maxRNO, formatInfo, mytab);
@ -3235,7 +3301,7 @@ namespace Volian.Print.Library
} }
} }
if (itemInfo.IsSection && MyParent == null && itemInfo.MyDocStyle.SupplementalInformation) if (itemInfo.IsSection && MyParent == null && itemInfo.MyDocStyle.SupplementalInformation && MyPromsPrinter.SupInfoPrintType==E_SupInfoPrintType.Merge)
{ {
_SupInfoSection = new vlnParagraph(this, cb, itemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRightParent, false, pp); _SupInfoSection = new vlnParagraph(this, cb, itemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRightParent, false, pp);
MyPromsPrinter.SupInfoPdfPageCount = -1; MyPromsPrinter.SupInfoPdfPageCount = -1;
@ -3314,12 +3380,11 @@ namespace Volian.Print.Library
} }
} }
if (itemInfo is StepInfo && ((itemInfo as StepInfo).MyConfig as StepConfig).Step_PreferredPagebreak) HasPrefPageBreak = true; if (itemInfo is StepInfo && ((itemInfo as StepInfo).MyConfig as StepConfig).Step_PreferredPagebreak) HasPrefPageBreak = true;
if (loadChildren && itemInfo.SupInfos != null) if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && loadChildren && itemInfo.SupInfos != null)
{ {
SupInfoSection.ChildrenBelow.Add(cb, itemInfo.SupInfos, XOffset, 0, 0, rnoLevel, maxRNO, formatInfo); SupInfoSection.ChildrenBelow.Add(cb, itemInfo.SupInfos, XOffset, 0, 0, rnoLevel, maxRNO, formatInfo);
SupInfoSection.ChildrenBelow[SupInfoSection.ChildrenBelow.Count - 1].PrefPageBreak = HasPrefPageBreak;
HasPrefPageBreak = false;
} }
// Without the following, BGE had gaps in y-direction if the AER/RNO both had cautions/notes. // Without the following, BGE had gaps in y-direction if the AER/RNO both had cautions/notes.
// The only time this needs done is if caution/notes are printed in separate columns in dual // The only time this needs done is if caution/notes are printed in separate columns in dual
// column mode (used the DoubleBoxHLS BGE flag for this - if another plant needs this, make it // column mode (used the DoubleBoxHLS BGE flag for this - if another plant needs this, make it
@ -4024,6 +4089,21 @@ namespace Volian.Print.Library
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter; if (XOffsetCenter != null) XOffset = (float)XOffsetCenter;
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
} }
private vlnTab GetSupInfoTab(PdfContentByte cb, ItemInfo itemInfo, float yoff, vlnTab mytab, bool doSectTab, float localXOffset)
{
string strmytab = null;
if (itemInfo.MyParent.IsHigh)
strmytab = itemInfo.MyTab.CleanText;
else if (itemInfo.MyParent.IsCaution)
strmytab = "Caution";
else if (itemInfo.MyParent.IsNote)
strmytab = "Note";
else
strmytab = ItemInfo.GetCombinedTab(itemInfo.MyParent, itemInfo.MyParent.MyParent.CombinedTab);
mytab = new vlnTab(cb, this, strmytab, strmytab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
return mytab;
}
private static VE_Font _AnnotationFont; private static VE_Font _AnnotationFont;
public static VE_Font AnnotationFont public static VE_Font AnnotationFont
{ {
@ -5142,16 +5222,14 @@ namespace Volian.Print.Library
{ {
if (itemInfo.IsSupInfoPart) if (itemInfo.IsSupInfoPart)
{ {
int addForTab = itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote ? 72 : 36; XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + 54; // add in 3/4 inch (54) to allow for enough space for Note/Caution tab
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + addForTab; // add in an inch to allow for enough space for Note/Caution tab
if (myTab != null) if (myTab != null)
{ {
myTab.XOffset = XOffset - ((myTab == null) ? 0 : myTab.Width) - 12; myTab.XOffset = XOffset - ((myTab == null) ? 0 : myTab.Width) - 12;
if (!itemInfo.MyParent.IsHigh && !itemInfo.MyParent.IsCaution && !itemInfo.MyParent.IsNote) myTab.Width = 2 * myTab.Width; myTab.Width = 2.5f * myTab.Width;
} }
return; return;
} }
float tabWidth = (myTab == null) ? 0 : myTab.Width; float tabWidth = (myTab == null) ? 0 : myTab.Width;
if (itemInfo.IsStepSection) if (itemInfo.IsStepSection)
{ {