This commit is contained in:
@@ -270,31 +270,32 @@ namespace Volian.Print.Library
|
||||
//}
|
||||
int _StepPageNumber = 0;
|
||||
private VlnSvgPageHelper _MyHelper = null;
|
||||
private static PdfReader _MyFoldoutReader = null;
|
||||
private static SectionInfo _MyFoldoutSection = null;
|
||||
//private static List<PdfReader> _MyFoldoutReader = null;
|
||||
//private static List<SectionInfo> _MyFoldoutSection = null;
|
||||
//private static PdfReader _MyFoldoutReader = null;
|
||||
//private static SectionInfo _MyFoldoutSection = null;
|
||||
private static List<PdfReader> _MyFoldoutReader = null;
|
||||
private static List<SectionInfo> _MyFoldoutSection = null;
|
||||
private string Print(ProcedureInfo myProcedure, string pdfFolder)
|
||||
{
|
||||
_MyFoldoutReader = null;
|
||||
//if (_MyFoldoutReader != null) _MyFoldoutReader.Clear();
|
||||
//else _MyFoldoutReader = new List<PdfReader>();
|
||||
if (_MyFoldoutReader != null) _MyFoldoutReader.Clear();
|
||||
else _MyFoldoutReader = new List<PdfReader>();
|
||||
|
||||
//if (_MyFoldoutSection != null) _MyFoldoutSection.Clear();
|
||||
//else _MyFoldoutSection = new List<SectionInfo>();
|
||||
if (_MyFoldoutSection != null) _MyFoldoutSection.Clear();
|
||||
else _MyFoldoutSection = new List<SectionInfo>();
|
||||
|
||||
if (myProcedure.Sections != null)
|
||||
{
|
||||
int cnt = 0;
|
||||
foreach (SectionInfo mySection in myProcedure.Sections)
|
||||
{
|
||||
if (mySection.MyContent.Number.ToUpper() == "FOLDOUT"
|
||||
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
|
||||
{
|
||||
// if floating foldouts, need a list of sections & foldoutreaders. Just do first for now.
|
||||
_MyFoldoutSection = mySection;
|
||||
//_MyFoldoutSection.Add(mySection);
|
||||
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, true, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout.pdf");
|
||||
_MyFoldoutReader = foldoutPdf != null ? new PdfReader(foldoutPdf) : null;
|
||||
|
||||
_MyFoldoutSection.Add(mySection);
|
||||
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf");
|
||||
_MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,7 +307,7 @@ namespace Volian.Print.Library
|
||||
if (MessageBox.Show(outputFileName + " exists. Overwrite file?", "File Exists", MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
return null;
|
||||
}
|
||||
return PrintProcedureOrFoldout(myProcedure, false, outputFileName);
|
||||
return PrintProcedureOrFoldout(myProcedure, null, outputFileName);
|
||||
}
|
||||
// Find the last section that has a Final Message defined in its format
|
||||
// Return that section's itemID or a -1 if the Final Message is not defined
|
||||
@@ -329,8 +330,9 @@ namespace Volian.Print.Library
|
||||
get { return _AllowAllWatermarks; }
|
||||
set { _AllowAllWatermarks = value; }
|
||||
}
|
||||
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, bool doingFoldout, string outputFileName)
|
||||
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName)
|
||||
{
|
||||
bool doingFoldout = myFoldoutSection != null;
|
||||
// The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac.
|
||||
// We don't want to use the OverrideLeftMargin when 'Absolute' is used in the genmac.
|
||||
// It's set here because the Volian.Svg.Library cannot call back to Volian.Print.Library to get this value.
|
||||
@@ -356,6 +358,7 @@ namespace Volian.Print.Library
|
||||
if ((mySection.MyContent.Number.ToUpper() == "FOLDOUT"
|
||||
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
|
||||
!= doingFoldout) continue;
|
||||
if (myFoldoutSection != null && myFoldoutSection.ItemID != mySection.ItemID) continue;
|
||||
PrintOverride.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper;
|
||||
PrintOverride.CompressSub = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub;
|
||||
OnStatusChanged((mySection.DisplayNumber ?? "") == "" ? mySection.DisplayText : mySection.DisplayNumber, PromsPrinterStatusType.Progress, progress++);
|
||||
@@ -419,7 +422,7 @@ namespace Volian.Print.Library
|
||||
// get first step to send to floading foldout indx.&& MyItemInfo.FoldoutIndex>-1)
|
||||
ItemInfo firstStep = mySection.Steps[0];
|
||||
if (firstStep.FoldoutIndex() > -1)
|
||||
DoFoldoutPage(cb, "Beginning of Step Section", _TextLayer, _MyHelper);
|
||||
DoFoldoutPage(cb, "Beginning of Step Section", _TextLayer, _MyHelper, firstStep.FoldoutIndex());
|
||||
}
|
||||
CreateStepPdf(mySection, cb);
|
||||
}
|
||||
@@ -489,7 +492,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
int pageNumber = 1 + ii;
|
||||
if (((mySection.MyDocStyle.StructureStyle.Style ?? 0) & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||
DoFoldoutPage(cb, "Word Document", _TextLayer, _MyHelper);
|
||||
DoFoldoutPage(cb, "Word Document", _TextLayer, _MyHelper, 0);
|
||||
if (readerWord != null)
|
||||
{
|
||||
bool doimport2 = true;
|
||||
@@ -508,7 +511,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
float yoff = 0;
|
||||
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
|
||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, 0, yoff);
|
||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff);
|
||||
DebugPagination.WriteLine("{0},'{1}',{2}",
|
||||
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
||||
|
||||
@@ -784,11 +787,11 @@ namespace Volian.Print.Library
|
||||
PrintTextMessage(cb, "Foldout for: " + str, textLayer);
|
||||
cb.PdfDocument.NewPage(); // Temporary for foldout/16bit-32bit page alignment
|
||||
}
|
||||
public static void DoFoldoutPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper)
|
||||
public static void DoFoldoutPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int foldoutindx)
|
||||
{
|
||||
if (_MyFoldoutSection == null) return;
|
||||
if (_MyFoldoutSection == null || _MyFoldoutSection.Count==0) return;
|
||||
SectionInfo saveSect = myPageHelper.MySection;
|
||||
myPageHelper.MySection = _MyFoldoutSection;
|
||||
myPageHelper.MySection = _MyFoldoutSection[foldoutindx];
|
||||
myPageHelper.OnFoldoutPage = true;
|
||||
if (_MyFoldoutReader != null)
|
||||
{
|
||||
@@ -796,7 +799,7 @@ namespace Volian.Print.Library
|
||||
PdfImportedPage fgPage = null;
|
||||
try
|
||||
{
|
||||
fgPage = cb.PdfWriter.GetImportedPage(_MyFoldoutReader,1);
|
||||
fgPage = cb.PdfWriter.GetImportedPage(_MyFoldoutReader[foldoutindx],1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user