Support for SAMGS Supplemental Information
This commit is contained in:
@@ -87,6 +87,14 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public class PromsPrinter
|
||||
{
|
||||
// used to link supinfo steps in pdf
|
||||
public int SupInfoPdfPageCount = -1;
|
||||
private Dictionary<int, int> _SupInfoPdfPage;
|
||||
public Dictionary<int, int> SupInfoPdfPage
|
||||
{
|
||||
get { return _SupInfoPdfPage; }
|
||||
set { _SupInfoPdfPage = 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
|
||||
@@ -687,6 +695,7 @@ namespace Volian.Print.Library
|
||||
int finalMessageSectionID = GetFinalMessageSectionID(myProcedure, doingFoldout);
|
||||
string LastFmtName = null;
|
||||
int lastDocStyle = -1;
|
||||
bool firstStepSec = true;
|
||||
foreach (SectionInfo mySection in myProcedure.Sections)
|
||||
{
|
||||
if (((mySection.MyContent.Number.ToUpper() == "FOLDOUT" && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts)
|
||||
@@ -714,6 +723,7 @@ namespace Volian.Print.Library
|
||||
_MyHelper.AllowAllWatermarks = AllowAllWatermarks;
|
||||
_MyHelper.MyPdfWriter = cb.PdfWriter;
|
||||
_MyHelper.CreatingFoldoutPage = doingFoldout;
|
||||
_MyHelper.CreatingSupInfoPage = false;
|
||||
_MyHelper.MyPdfContentByte = cb;
|
||||
|
||||
if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null);
|
||||
@@ -808,7 +818,7 @@ namespace Volian.Print.Library
|
||||
|
||||
if (mySection.IsAutoTOCSection)
|
||||
{
|
||||
if (cb.PdfWriter.CurrentPageNumber % 2 == 0 && !_MyHelper.CreatingFoldoutPage && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even
|
||||
if (((cb.PdfWriter.CurrentPageNumber % 2 == 0 && !_MyHelper.CreatingFoldoutPage) || myProcedure.ProcHasSupInfoData) && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even
|
||||
{
|
||||
_MyHelper.OnBlankPage = true;
|
||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
||||
@@ -839,6 +849,18 @@ namespace Volian.Print.Library
|
||||
//_MyLog.InfoFormat("NewPage Begin Step Sect blank {0}", cb.PdfWriter.CurrentPageNumber);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
_MyHelper.OnBlankPage = true;
|
||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
||||
NewPage();
|
||||
firstStepSec = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
CreateStepPdf(mySection, cb);
|
||||
}
|
||||
@@ -994,7 +1016,7 @@ namespace Volian.Print.Library
|
||||
OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord);
|
||||
if (doimport2)
|
||||
{
|
||||
if (!didFoldout && cb.PdfWriter.CurrentPageNumber > 1 && _MyFoldoutReader.Count > 0 && InsertBlankPages)
|
||||
if (((!didFoldout && _MyFoldoutReader.Count > 0) || mySection.MyProcedure.ProcHasSupInfoData) && cb.PdfWriter.CurrentPageNumber > 1 && InsertBlankPages)
|
||||
{
|
||||
// only insert a blank page if this section does not have a foldout (but the procedure as a whole does)
|
||||
// and the checkbox on the print dialog to add blank pages is checked
|
||||
@@ -1596,6 +1618,10 @@ namespace Volian.Print.Library
|
||||
float yPageStart = yTopMargin;
|
||||
if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0 || (myItemInfo.ActiveFormat.PlantFormat.FormatData.Express && myItemInfo.MyDocStyle.OptionalSectionContent))
|
||||
{
|
||||
// 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)
|
||||
GenerateSuppInfoPdf(myParagraph.SupInfoSection, yTopMargin, yBottomMargin);
|
||||
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
|
||||
if (myParagraph.MyPlaceKeeper != null)
|
||||
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper); // add this step text to the PlaceKeeper (Calvert Cliffs)
|
||||
@@ -1661,6 +1687,70 @@ namespace Volian.Print.Library
|
||||
//pt.Description = "End";
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
|
||||
private void GenerateSuppInfoPdf(vlnParagraph vlnParagraph, float yTopMargin, float yBottomMargin)
|
||||
{
|
||||
ReaderHelper savMyReaderHelper = MyReaderHelper;
|
||||
PdfContentByte savMyContentByte = MyContentByte;
|
||||
VlnSvgPageHelper savMyHelper = _MyHelper;
|
||||
if (SupInfoPdfPage == null) SupInfoPdfPage = new Dictionary<int, int>();
|
||||
else SupInfoPdfPage.Clear();
|
||||
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + vlnParagraph.MyItemInfo.ItemID.ToString() + @".pdf";
|
||||
PdfContentByte cb = OpenDoc(SupInfoPdfName, PageSize.LETTER);
|
||||
if (cb == null) return;
|
||||
VlnSvgPageHelper myPageHealper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0);
|
||||
cb.PdfWriter.PageEvent = myPageHealper;
|
||||
myPageHealper.AllowAllWatermarks = AllowAllWatermarks;
|
||||
myPageHealper.MyPdfWriter = cb.PdfWriter;
|
||||
myPageHealper.CreatingFoldoutPage = false;
|
||||
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);
|
||||
try
|
||||
{
|
||||
cb.PdfDocument.Close();
|
||||
cb = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||
}
|
||||
_MyHelper = savMyHelper;
|
||||
MyContentByte = savMyContentByte;
|
||||
MyReaderHelper = savMyReaderHelper;
|
||||
}
|
||||
public void DoSupInfoPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int itemid, bool insertBlankPages)
|
||||
{
|
||||
// see if the ID is in the facing page pdf - if so, get the page:
|
||||
if (SupInfoPdfPage == null || SupInfoPdfPage.Count < 1) return;
|
||||
int getpage = 0;
|
||||
if (SupInfoPdfPage.ContainsKey(itemid)) getpage = SupInfoPdfPage[itemid];
|
||||
if (getpage < 0)
|
||||
{
|
||||
myPageHelper.OnBlankPage = true;
|
||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
||||
NewPage();
|
||||
return;
|
||||
}
|
||||
PdfImportedPage sipage = null;
|
||||
try
|
||||
{
|
||||
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf";
|
||||
PdfReader pdfreader = new PdfReader(SupInfoPdfName);
|
||||
sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1);
|
||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, 0, 0);
|
||||
NewPage();
|
||||
pdfreader.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
public void DoFoldoutPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int foldoutindx, bool insertBlankPages)
|
||||
{
|
||||
if (_MyFoldoutSection == null || _MyFoldoutSection.Count==0) return;
|
||||
|
Reference in New Issue
Block a user