This commit is contained in:
@@ -199,8 +199,8 @@ namespace Volian.Print.Library
|
||||
// if the HLS is part of a Smart Template (i.e. WCNCKL table), don't add in an extra line because
|
||||
// that makes pagination work incorrectly because the Smart Template has a 'table' line after the
|
||||
// text.
|
||||
BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
//BuildPageBreakList(yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate?0:SixLinesPerInch), yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
//BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
BuildPageBreakList(yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate?0:SixLinesPerInch), yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
return 0; // Stay on this page
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -369,7 +369,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
// Now do the bottom line for this item.
|
||||
Paragraph crossLine = new Paragraph(bottomOfTable ? bx.BXLMID : bx.BXMID, iSymblFont);
|
||||
float yloc = yPageStart - this.YBottomMost + 15;
|
||||
float yloc = yPageStart - this.YBottomMost + 18;
|
||||
Rtf2Pdf.TextAt(cb, leftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin);
|
||||
float hPos = float.Parse(vertPos[0]) + csize;
|
||||
int doHorizCnt = 0;
|
||||
@@ -609,7 +609,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
// Only do foldout page if not done for section break, i.e. check the there's a previous step.
|
||||
if (MyItemInfo.MyPrevious != null && MyItemInfo.FoldoutIndex()>-1)
|
||||
PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper);
|
||||
PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex());
|
||||
yPageStart = yTopMargin + YTopMost;
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
MyPageHelper.YMultiplier = 1;
|
||||
@@ -650,7 +650,7 @@ namespace Volian.Print.Library
|
||||
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
|
||||
DebugText.WriteLine("Paginate2");
|
||||
if (MyItemInfo.FoldoutIndex()>-1)
|
||||
PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper); // temporary foldout
|
||||
PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex()); // temporary foldout
|
||||
// If there is a box, adjust the yTopMost to include it.
|
||||
float yTopMost = YTopMost;
|
||||
//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
|
||||
@@ -689,7 +689,7 @@ namespace Volian.Print.Library
|
||||
MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null);
|
||||
}
|
||||
if (MyItemInfo.FoldoutIndex() > -1)
|
||||
PromsPrinter.DoFoldoutPage(cb, "HLS (7 lpi) break", MyPageHelper.TextLayer, MyPageHelper);
|
||||
PromsPrinter.DoFoldoutPage(cb, "HLS (7 lpi) break", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex());
|
||||
}
|
||||
if (MyItemInfo.MyParent != null && MyItemInfo.MyParent.IsStepSection &&
|
||||
MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
|
||||
@@ -1194,20 +1194,17 @@ namespace Volian.Print.Library
|
||||
PartsAbove.Add(new vlnMacro(xoff, yoff, macro));
|
||||
}
|
||||
}
|
||||
// If WCN checklists, the substeps are printed in a row, need to keep track of the 'longest' in
|
||||
// If checklists, the substeps are printed in a row, need to keep track of the 'longest' in
|
||||
// y direction (bottommost) across the row.
|
||||
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (TheStepLevel(itemInfo) > 0))
|
||||
{
|
||||
// do I need to get max of savCheckListBottomMost & (yoff+Height+SixLinesPerInch)
|
||||
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (TheStepLevel(itemInfo) >= 0))
|
||||
savCheckListBottomMost = yoff + Height + SixLinesPerInch;
|
||||
}
|
||||
// Get Y offset for regular steps, or if section title is output or if not within row (not last column of
|
||||
// text) for wcn checklist, i.e.
|
||||
if ((!itemInfo.IsStepSection && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step
|
||||
|| (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
|
||||
&& !MyItemInfo.MyDocStyle.CancelSectTitle
|
||||
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout)
|
||||
// In WCN Checklist: I don't have children or if I have children the first child doesn't alignwithparent.
|
||||
// In Checklist: I don't have children or if I have children the first child doesn't alignwithparent.
|
||||
|| (!itemInfo.IsStepSection && itemInfo.MyHLS.FormatStepData.UseSmartTemplate
|
||||
&& ((itemInfo.Steps == null || itemInfo.Steps.Count == 0)
|
||||
|| !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)))
|
||||
@@ -1307,9 +1304,10 @@ namespace Volian.Print.Library
|
||||
}
|
||||
YBottomMost = yoff;
|
||||
|
||||
// For WCN Checklist, the substeps are in rows of data. The YBottomMost is the bottom most for
|
||||
// For Checklist, the substeps are in rows of data. The YBottomMost is the bottom most for
|
||||
// the row.
|
||||
if (savCheckListBottomMost != 0 && savCheckListBottomMost > YBottomMost) YBottomMost = savCheckListBottomMost;
|
||||
if (savCheckListBottomMost != 0 && savCheckListBottomMost > YBottomMost)
|
||||
YBottomMost = savCheckListBottomMost;
|
||||
}
|
||||
|
||||
private string GetMacroName(string str)
|
||||
@@ -2101,7 +2099,7 @@ namespace Volian.Print.Library
|
||||
int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null;
|
||||
float? widOvrd = 0;
|
||||
float xwid = 0;
|
||||
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo))>0)
|
||||
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo)) > 0)
|
||||
widOvrd = xwid;
|
||||
else
|
||||
widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;
|
||||
|
Reference in New Issue
Block a user