|
|
|
@ -179,6 +179,8 @@ namespace Volian.Print.Library
|
|
|
|
|
get { return _PDFFile; }
|
|
|
|
|
set { _PDFFile = value; }
|
|
|
|
|
}
|
|
|
|
|
// C2024-003 parameter contains parent section itemid, child section itemid, issubsection flag.
|
|
|
|
|
// C2024-003 values needed to print section.
|
|
|
|
|
private int[] _prtSectID = new int[] { -1, -1, 0 };
|
|
|
|
|
public int[] PrtSectID
|
|
|
|
|
{
|
|
|
|
@ -341,6 +343,7 @@ namespace Volian.Print.Library
|
|
|
|
|
_BatchPrint = batchPrint;
|
|
|
|
|
_MyReaderHelper = new ReaderHelper(this);
|
|
|
|
|
_SaveLinks = saveLinks;
|
|
|
|
|
// C2024-003 parameter contains parent section itemid, child section itemid, issubsection flag.
|
|
|
|
|
_prtSectID = PrtSectID;
|
|
|
|
|
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
|
|
|
|
|
if (removeTrailngHardReturnsAndManualPageBreaks == 1 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveTrailingHardReturnsAndSpaces = new List<int>();
|
|
|
|
@ -349,16 +352,7 @@ namespace Volian.Print.Library
|
|
|
|
|
_DidAll = didAll;
|
|
|
|
|
_MergeNotIncluded = false;
|
|
|
|
|
_MergedPdf = mergedPdf;
|
|
|
|
|
//if(Convert.ToBoolean(PrtSectID[0]))
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
//_prtSectID = PrtSectID;
|
|
|
|
|
//_MyReaderHelper.LoadTree(myItem);
|
|
|
|
|
}
|
|
|
|
|
// Pass 1 PDF Name
|
|
|
|
|
private string _BeforePageNumberPdf = null;
|
|
|
|
@ -381,7 +375,7 @@ namespace Volian.Print.Library
|
|
|
|
|
{
|
|
|
|
|
if (_MyItem is ProcedureInfo)
|
|
|
|
|
{
|
|
|
|
|
_prtSectID = PrtSectID;
|
|
|
|
|
_prtSectID = PrtSectID; // C2024-003 parameter contains parent section itemid, child section itemid, issubsection flag.
|
|
|
|
|
ProcedureConfig pcfg = (ProcedureConfig)(_MyItem as ProcedureInfo).MyConfig;
|
|
|
|
|
if (DidAll && pcfg.Print_NotInMergeAll) // will be merging a pdf, so don't print this procedure if user set that on procedure propertures
|
|
|
|
|
{
|
|
|
|
@ -813,7 +807,7 @@ namespace Volian.Print.Library
|
|
|
|
|
VlnItextFont.RegisterFontFolder(); //B2019-174 register the font folder so that symbols will display on auto TOC
|
|
|
|
|
if (myProcedure.Sections != null)
|
|
|
|
|
{
|
|
|
|
|
SectionInfo CurSection = null;
|
|
|
|
|
SectionInfo CurSection = null; // C2024-003 detrimine if the user in printing a sub section.
|
|
|
|
|
if (Convert.ToBoolean(PrtSectID[2])) // If section is a CurSection retrieved the CurSection.
|
|
|
|
|
{
|
|
|
|
|
foreach (SectionInfo si2 in myProcedure.Sections)
|
|
|
|
@ -833,12 +827,12 @@ namespace Volian.Print.Library
|
|
|
|
|
int cnt = 0;
|
|
|
|
|
foreach (SectionInfo mySection in myProcedure.Sections)
|
|
|
|
|
{
|
|
|
|
|
if (PrtSectID[0] == -1 || (PrtSectID[0] > -1 && mySection.ItemID == PrtSectID[0]))
|
|
|
|
|
if (PrtSectID[0] == -1 || (PrtSectID[0] > -1 && mySection.ItemID == PrtSectID[0])) // C2024-003 check if the user is printing a section
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!Convert.ToBoolean(PrtSectID[2])) // If section is not a Sub Section assign the iteration variable to CurSection
|
|
|
|
|
if (!Convert.ToBoolean(PrtSectID[2])) // If section is not a Sub Section assign the iteration variable to CurSection. CurSection contains any type of section.
|
|
|
|
|
{
|
|
|
|
|
CurSection = mySection;
|
|
|
|
|
CurSection = mySection; // if section is not a sub section.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!CurSection.MyDocStyle.IsStepSection && !CurSection.IsAutoTOCSection)
|
|
|
|
@ -983,7 +977,8 @@ namespace Volian.Print.Library
|
|
|
|
|
string clr = pc.GetValue("PSI", "WATERMARKOVERRIDECLR");
|
|
|
|
|
if (clr != null && clr != "") WatermarkOverrideColor = clr.ToUpper().Contains("DEFAULT") ? "BLUE" : clr;
|
|
|
|
|
}
|
|
|
|
|
SectionInfo CurSection = null;
|
|
|
|
|
|
|
|
|
|
SectionInfo CurSection = null; // C2024-003 detrimine if the user is printing a sub section.1639
|
|
|
|
|
if (Convert.ToBoolean(PrtSectID[2]))
|
|
|
|
|
{
|
|
|
|
|
foreach (SectionInfo si2 in myProcedure.Sections)
|
|
|
|
@ -1636,7 +1631,8 @@ namespace Volian.Print.Library
|
|
|
|
|
// C2018-004 create meta file for baseline compares
|
|
|
|
|
Volian.Base.Library.BaselineMetaFile.WriteLine("TOC Ystart {0} LeftMar {1} ScNmPos {2} ScTtlPos {3} ScPgPos {4}", yPageStart, leftMargin, secNumPos, secTitlePos, secPagePos);
|
|
|
|
|
bool inGroup = false;
|
|
|
|
|
SectionInfo CurSection = null;
|
|
|
|
|
|
|
|
|
|
SectionInfo CurSection = null; // C2024-003 detrimine determine if the user in printing a sub section.
|
|
|
|
|
if (Convert.ToBoolean(PrtSectID[2]))
|
|
|
|
|
{
|
|
|
|
|
foreach (SectionInfo si2 in ii.Sections)
|
|
|
|
@ -3019,8 +3015,8 @@ namespace Volian.Print.Library
|
|
|
|
|
private void LoadSectionTree(ItemInfo ii)
|
|
|
|
|
{
|
|
|
|
|
if (ii.Sections == null) return; // B2021-067 crash on null reference
|
|
|
|
|
SectionInfo SubSection = null;
|
|
|
|
|
if (Convert.ToBoolean(MyPromsPrinter.PrtSectID[2])) // If section is a sub section
|
|
|
|
|
SectionInfo CurSection = null;
|
|
|
|
|
if (Convert.ToBoolean(MyPromsPrinter.PrtSectID[2])) // C2024-003 determine if the user is printing a sub section. If so assign it to CurSection.
|
|
|
|
|
{
|
|
|
|
|
foreach (SectionInfo si2 in ii.Sections)
|
|
|
|
|
{
|
|
|
|
@ -3028,9 +3024,10 @@ namespace Volian.Print.Library
|
|
|
|
|
{
|
|
|
|
|
foreach (SectionInfo subsi in si2.Sections)
|
|
|
|
|
{
|
|
|
|
|
if (subsi.ItemID == MyPromsPrinter.PrtSectID[0])
|
|
|
|
|
if (subsi.ItemID == MyPromsPrinter.PrtSectID[1])
|
|
|
|
|
{
|
|
|
|
|
SubSection = subsi;
|
|
|
|
|
CurSection = subsi;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3040,13 +3037,17 @@ namespace Volian.Print.Library
|
|
|
|
|
foreach (SectionInfo si in ii.Sections)
|
|
|
|
|
if (MyPromsPrinter.PrtSectID[0] == -1 || (MyPromsPrinter.PrtSectID[0] > -1 && si.ItemID == MyPromsPrinter.PrtSectID[0]))
|
|
|
|
|
{
|
|
|
|
|
if (si.IsStepSection)
|
|
|
|
|
if (!Convert.ToBoolean(MyPromsPrinter.PrtSectID[2])) // If section is not a Sub Section assign the iteration variable to CurSection
|
|
|
|
|
{
|
|
|
|
|
if (si.Sections != null) LoadSectionTree(si);
|
|
|
|
|
CurSection = si;
|
|
|
|
|
}
|
|
|
|
|
if (CurSection.IsStepSection)
|
|
|
|
|
{
|
|
|
|
|
if (CurSection.Sections != null) LoadSectionTree(CurSection);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MyPdfFile = _MyPromsPrinter.BuildMSWordPDF(si);
|
|
|
|
|
MyPdfFile = _MyPromsPrinter.BuildMSWordPDF(CurSection);
|
|
|
|
|
if (MyPdfFile != null)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
@ -3055,18 +3056,18 @@ namespace Volian.Print.Library
|
|
|
|
|
if (fi.Length == 0) // B2017-218 Handle invalid word sections
|
|
|
|
|
{
|
|
|
|
|
if (!PromsPrinter.BaselineTesting) //B2018-071 Output a message box unless baseline testing is being performed.
|
|
|
|
|
MessageBox.Show(si.DisplayNumber + " " + si.DisplayText + " is not valid", "Invalid Word Section", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
|
|
MessageBox.Show(CurSection.DisplayNumber + " " + CurSection.DisplayText + " is not valid", "Invalid Word Section", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
MyReader = MyPdfFile != null ? new PdfReader(MyPdfFile) : null;
|
|
|
|
|
string key = string.Empty;
|
|
|
|
|
for (int i = 1; i <= MyReader.NumberOfPages; i++)
|
|
|
|
|
{
|
|
|
|
|
key = string.Format("{0}.{1}", si.ItemID, i);
|
|
|
|
|
key = string.Format("{0}.{1}", CurSection.ItemID, i);
|
|
|
|
|
dicPage.Add(key, MyPromsPrinter.MyContentByte.PdfWriter.GetImportedPage(MyReader, i));
|
|
|
|
|
iTextSharp.text.Rectangle rectgl = MyReader.GetPageSizeWithRotation(i);
|
|
|
|
|
// If the word page is set to landscape, but the document style is not landscape, then flip the height and width (put back to portrait)
|
|
|
|
|
if (!((si.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_WordContentLandscaped) == E_DocStructStyle.DSS_WordContentLandscaped) && rectgl.Height < rectgl.Width)
|
|
|
|
|
if (!((CurSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_WordContentLandscaped) == E_DocStructStyle.DSS_WordContentLandscaped) && rectgl.Height < rectgl.Width)
|
|
|
|
|
rectgl = new iTextSharp.text.Rectangle(rectgl.Height, rectgl.Width);
|
|
|
|
|
dicSize.Add(key, rectgl);
|
|
|
|
|
//dicSize.Add(key, MyReader.GetPageSizeWithRotation(i));
|
|
|
|
@ -3076,7 +3077,7 @@ namespace Volian.Print.Library
|
|
|
|
|
{
|
|
|
|
|
if (_MyPromsPrinter.DocReplace == null)
|
|
|
|
|
MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
_MyLog.Warn(string.Format("Error in LoadSectionTree [{0}],{1}.{2}", si.ItemID, si.DisplayNumber, si.DisplayText), ex);
|
|
|
|
|
_MyLog.Warn(string.Format("Error in LoadSectionTree [{0}],{1}.{2}", CurSection.ItemID, CurSection.DisplayNumber, CurSection.DisplayText), ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|