Generate Placekeeper logic

This commit is contained in:
2014-05-09 19:18:15 +00:00
parent f120b73883
commit b4a055327a
5 changed files with 397 additions and 30 deletions

View File

@@ -189,22 +189,22 @@ namespace Volian.Print.Library
_OriginalPageBreak = origPgBrk;
_InsertBlankPages = insertBlankPages;
}
public string Print(string pdfFolder)
public string Print(string pdfFolder, bool makePlacekeeper)
{
if (_MyItem is ProcedureInfo)
{
if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier))
return Print(_MyItem as ProcedureInfo, pdfFolder);
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
else
{
// if the plant uses transition modifiers and/or page num in transition format,
// need to do two passes. First pass, sets the pagenumbers for each item,
// 2nd pass fills in the page numbers in transitions.
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder);
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false);
if (retstr == null) return null;
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
return Print(_MyItem as ProcedureInfo, pdfFolder);
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
}
}
return "";
@@ -332,7 +332,7 @@ namespace Volian.Print.Library
set { PromsPrinter._MyFoldoutReader = value; }
}
private static List<SectionInfo> _MyFoldoutSection = null;
private string Print(ProcedureInfo myProcedure, string pdfFolder)
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper)
{
if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>();
@@ -353,7 +353,7 @@ namespace Volian.Print.Library
// if floating foldouts, need a list of sections & foldoutreaders. Just do first for now.
_MyFoldoutSection.Add(mySection);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf");
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false);
_MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null);
cnt++;
}
@@ -367,7 +367,7 @@ namespace Volian.Print.Library
if (MessageBox.Show(outputFileName + " exists. Overwrite file?", "File Exists", MessageBoxButtons.YesNo) == DialogResult.No)
return null;
}
return PrintProcedureOrFoldout(myProcedure, null, outputFileName);
return PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper);
}
// See if the last non Foldout Section has a Final Message.
@@ -399,7 +399,7 @@ namespace Volian.Print.Library
get { return _AllowAllWatermarks; }
set { _AllowAllWatermarks = value; }
}
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName)
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper)
{
bool doingFoldout = myFoldoutSection != null;
// The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac.
@@ -556,6 +556,11 @@ namespace Volian.Print.Library
OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress);
if (DebugPagination.IsOpen) DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber;
CloseDocument(cb, outputFileName);
if (_MyHelper != null && makePlacekeeper)
{
if (_MyHelper.MyPlacekeepers.Count > 0)
new Placekeeper(_MyHelper.MyPlacekeepers);
}
_MyHelper = null;
return outputFileName;
}
@@ -636,9 +641,9 @@ namespace Volian.Print.Library
}
float yoff = 0;
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff);
if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath, pageNumber);
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff);
if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
}
if (ii == sectPageCount - 1)
@@ -1064,9 +1069,13 @@ namespace Volian.Print.Library
float localYPageStart = 0;
float yPageStart = yTopMargin;
if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
{
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
else if(!myItemInfo.MyDocStyle.OptionalSectionContent)
PrintTextMessage(cb, "No Section Content", _TextLayer);
if (myParagraph.MyPlaceKeeper != null)
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper);
}
else if (!myItemInfo.MyDocStyle.OptionalSectionContent)
PrintTextMessage(cb, "No Section Content", _TextLayer);
SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default
ItemInfo nxtItem = section.GetNextItem();
if (nxtItem != null)