Development #196

Merged
djankowski merged 11 commits from Development into master 2024-01-03 10:54:23 -05:00
9 changed files with 1921 additions and 1754 deletions

Binary file not shown.

View File

@ -1091,6 +1091,11 @@ namespace VEPROMS
DoCreatePDF(); DoCreatePDF();
} }
public void QPCreatePDF()
{
DoCreatePDF();
}
private void DoCreatePDF() private void DoCreatePDF()
{ {
if (_AllProcedures) if (_AllProcedures)

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@ using DescriptiveEnum;
using Volian.Base.Library; using Volian.Base.Library;
using Volian.Print.Library; using Volian.Print.Library;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using System.Diagnostics;
[assembly: log4net.Config.XmlConfigurator(Watch = true)] [assembly: log4net.Config.XmlConfigurator(Watch = true)]
@ -512,6 +513,7 @@ namespace VEPROMS
ItemInfo.ItemDeleted += new ItemInfoEvent(RefreshDisplayHistory); ItemInfo.ItemDeleted += new ItemInfoEvent(RefreshDisplayHistory);
tv.PrintProcedure += new vlnTreeViewEvent(tv_PrintProcedure); tv.PrintProcedure += new vlnTreeViewEvent(tv_PrintProcedure);
tv.QPrintProcedure += new vlnTreeViewEvent(tv_QPrintProcedure);
tv.PrintAllProcedures += new vlnTreeViewEvent(tv_PrintAllProcedures); tv.PrintAllProcedures += new vlnTreeViewEvent(tv_PrintAllProcedures);
tv.ApproveProcedure += new vlnTreeViewEvent(tv_ApproveProcedure); tv.ApproveProcedure += new vlnTreeViewEvent(tv_ApproveProcedure);
tv.ApproveAllProcedures += new vlnTreeViewEvent(tv_ApproveAllProcedures); tv.ApproveAllProcedures += new vlnTreeViewEvent(tv_ApproveAllProcedures);
@ -1152,6 +1154,40 @@ namespace VEPROMS
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0; pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
} }
void tv_QPrintProcedure(object sender, vlnTreeEventArgs args) // Quick Print
{
try
{
ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
if (pi == null) return;
tc.SaveCurrentEditItem(pi);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
using (DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi))
{
prnDlg.SelectedSlave = args.UnitIndex;
prnDlg.MySessionInfo = MySessionInfo;
prnDlg.SetupForProcedure(); // Setup filename
prnDlg.QPCreatePDF(); // Create Print report
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
}
catch(Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Could not create PDF Print");
sb.AppendLine();
MessageBox.Show(sb.ToString(), "Error when creating PDF Print", MessageBoxButtons.OK, MessageBoxIcon.Warning);
_MyLog.Warn("Failed to create PDF print", ex);
}
}
void tv_CreateContinuousActionSummary(object sender, vlnTreeEventArgs args) void tv_CreateContinuousActionSummary(object sender, vlnTreeEventArgs args)
{ {
DialogResult dr = System.Windows.Forms.DialogResult.Yes; DialogResult dr = System.Windows.Forms.DialogResult.Yes;
@ -4861,11 +4897,26 @@ namespace VEPROMS
_MyLog.Error(str, ex); _MyLog.Error(str, ex);
} }
} }
}
#region (Lock stuff / used for multi-user support) private void btnShowErrFld_Click(object sender, EventArgs e)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
path = path + @"\Documents\VEPROMS";
if (Directory.Exists(path))
{
Process.Start("explorer.exe", path);
}
}
public class TabItemsToClose : Stack<DisplayTabItem> private void btnHelp_Click(object sender, EventArgs e)
{
}
}
#region (Lock stuff / used for multi-user support)
public class TabItemsToClose : Stack<DisplayTabItem>
{ {
public void PushDTI(DisplayTabItem dti) public void PushDTI(DisplayTabItem dti)
{ {

View File

@ -188,6 +188,11 @@
llg/yF+gIjK+CZq8XgAAAABJRU5ErkJggg== llg/yF+gIjK+CZq8XgAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="btnShowErrFld.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAANUlEQVR4nGNgoBR8ahL8jw1/bBTooMiAT8Qa8gmPAUQZ8n+Z3n9KMMOoAf9Hw0CPCmEw4AAA71z+QhwwNhoAAAAASUVORK5CYII=
</value>
</data>
<data name="office2007StartButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="office2007StartButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
R0lGODlhGwAVAIcAANmsrP7+/tqtrdmrq9Wjo9uwsNmtrf79/dSgoP/+/tShodalpdqsrN20tN64uNqv R0lGODlhGwAVAIcAANmsrP7+/tqtrdmrq9Wjo9uwsNmtrf79/dSgoP/+/tShodalpdqsrN20tN64uNqv
@ -450,7 +455,7 @@
<value>164, 17</value> <value>164, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>64</value> <value>25</value>
</metadata> </metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

View File

@ -1458,6 +1458,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _NoBlankLastNoteCautionWarn, "@NoBlankLastNoteCautionWarn"); return LazyLoad(ref _NoBlankLastNoteCautionWarn, "@NoBlankLastNoteCautionWarn");
} }
} }
private LazyLoad<bool> _NoteCautionCenterOneAllTypes; // F2023-126: Vogtle Alarms - center single line caution/note if more than one type exist off step
public bool NoteCautionCenterOneAllTypes
{
get
{
return LazyLoad(ref _NoteCautionCenterOneAllTypes, "@NoteCautionCenterOneAllTypes");
}
}
private LazyLoad<bool> _ChkBoxToGeneratePointListText; // C2021-063 Barakah Alarm: check box to generate Alarm Point List Text private LazyLoad<bool> _ChkBoxToGeneratePointListText; // C2021-063 Barakah Alarm: check box to generate Alarm Point List Text
public bool ChkBoxToGeneratePointListText public bool ChkBoxToGeneratePointListText
{ {

View File

@ -501,6 +501,11 @@ namespace Volian.Controls.Library
{ {
if (PrintProcedure != null) PrintProcedure(sender, args); if (PrintProcedure != null) PrintProcedure(sender, args);
} }
public event vlnTreeViewEvent QPrintProcedure;
private void OnQPrintProcedure(object sender, vlnTreeEventArgs args)
{
if (QPrintProcedure != null) QPrintProcedure(sender, args);
}
public event vlnTreeViewEvent PrintAllProcedures; public event vlnTreeViewEvent PrintAllProcedures;
private void OnPrintAllProcedures(object sender, vlnTreeEventArgs args) private void OnPrintAllProcedures(object sender, vlnTreeEventArgs args)
{ {
@ -831,6 +836,7 @@ namespace Volian.Controls.Library
MenuItem micas = new MenuItem("Create Continuous Action Summary"); MenuItem micas = new MenuItem("Create Continuous Action Summary");
MenuItem mitcas = new MenuItem("Create Time Critical Action Summary"); //F2022-024 added menu option MenuItem mitcas = new MenuItem("Create Time Critical Action Summary"); //F2022-024 added menu option
MenuItem mip = new MenuItem("Print"); MenuItem mip = new MenuItem("Print");
MenuItem miqp = new MenuItem("Quick Print");
MenuItem mia = new MenuItem("Approve"); MenuItem mia = new MenuItem("Approve");
int k = 0; int k = 0;
foreach (string s in pri.MyDocVersion.UnitNames) foreach (string s in pri.MyDocVersion.UnitNames)
@ -841,6 +847,9 @@ namespace Volian.Controls.Library
MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mp.Enabled = procAppl; mp.Enabled = procAppl;
mp.Tag = k; mp.Tag = k;
MenuItem mqp = miqp.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mqp.Enabled = procAppl;
mqp.Tag = k;
MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
ma.Enabled = procAppl; ma.Enabled = procAppl;
ma.Tag = k; ma.Tag = k;
@ -854,6 +863,7 @@ namespace Volian.Controls.Library
cm.MenuItems.Add(micas); cm.MenuItems.Add(micas);
cm.MenuItems.Add(mitcas); cm.MenuItems.Add(mitcas);
cm.MenuItems.Add(mip); cm.MenuItems.Add(mip);
cm.MenuItems.Add(miqp);
AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri); AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri);
cm.MenuItems.Add(mia); cm.MenuItems.Add(mia);
AddApprovedRevisionsMultiUnit(cm.MenuItems, pri); AddApprovedRevisionsMultiUnit(cm.MenuItems, pri);
@ -863,6 +873,8 @@ namespace Volian.Controls.Library
cm.MenuItems.Add("Create Continuous Action Summary", new EventHandler(mi_Click)); cm.MenuItems.Add("Create Continuous Action Summary", new EventHandler(mi_Click));
cm.MenuItems.Add("Create Time Critical Action Summary", new EventHandler(mi_Click)); cm.MenuItems.Add("Create Time Critical Action Summary", new EventHandler(mi_Click));
cm.MenuItems.Add("Print", new EventHandler(mi_Click)); cm.MenuItems.Add("Print", new EventHandler(mi_Click));
cm.MenuItems.Add("Quick Print", new EventHandler(mi_Click));
//MenuItem miqp = new MenuItem("Print");
AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri); AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri);
cm.MenuItems.Add("Approve", new EventHandler(mi_Click)); cm.MenuItems.Add("Approve", new EventHandler(mi_Click));
//_MyLog.WarnFormat("Context Menu 1 before - {0}", GC.GetTotalMemory(true)); //_MyLog.WarnFormat("Context Menu 1 before - {0}", GC.GetTotalMemory(true));
@ -877,19 +889,24 @@ namespace Volian.Controls.Library
if (pri.MyDocVersion.MultiUnitCount > 1) if (pri.MyDocVersion.MultiUnitCount > 1)
{ {
MenuItem mip = new MenuItem("Print"); MenuItem mip = new MenuItem("Print");
MenuItem miqp = new MenuItem("Quick Print");
int k = 0; int k = 0;
foreach (string s in pri.MyDocVersion.UnitNames) foreach (string s in pri.MyDocVersion.UnitNames)
{ {
k++; k++;
MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mp.Tag = k; mp.Tag = k;
MenuItem mqp = miqp.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mqp.Tag = k;
} }
cm.MenuItems.Add(mip); cm.MenuItems.Add(mip);
cm.MenuItems.Add(miqp);
AddApprovedRevisionsMultiUnit(cm.MenuItems, pri); AddApprovedRevisionsMultiUnit(cm.MenuItems, pri);
} }
else else
{ {
cm.MenuItems.Add("Print", new EventHandler(mi_Click)); cm.MenuItems.Add("Print", new EventHandler(mi_Click));
cm.MenuItems.Add("Quick Print", new EventHandler(mi_Click));
AddApprovedRevisions(cm.MenuItems, pri); AddApprovedRevisions(cm.MenuItems, pri);
} }
} }
@ -1727,6 +1744,9 @@ namespace Volian.Controls.Library
case "Print": case "Print":
OnPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); OnPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break; break;
case "Quick Print":
OnQPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break;
case "Print All Procedures for": case "Print All Procedures for":
OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0,mi.Text,(int)mi.Tag)); OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0,mi.Text,(int)mi.Tag));
break; break;
@ -1967,6 +1987,9 @@ namespace Volian.Controls.Library
case "Print": case "Print":
OnPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); OnPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
break; break;
case "Quick Print":
OnQPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
break;
case "Print All Procedures": case "Print All Procedures":
OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
break; break;

View File

@ -19,7 +19,7 @@ using JR.Utils.GUI.Forms;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public delegate void PromsPrinterStatusEvent(object sender,PromsPrintStatusArgs args); public delegate void PromsPrinterStatusEvent(object sender, PromsPrintStatusArgs args);
public class PromsPrintStatusArgs public class PromsPrintStatusArgs
{ {
private string _MyStatus; private string _MyStatus;
@ -291,7 +291,7 @@ namespace Volian.Print.Library
get { return _MyReaderHelper; } get { return _MyReaderHelper; }
set { _MyReaderHelper = value; } set { _MyReaderHelper = value; }
} }
private string _BlankPageText; // C2019-004: Allow user to define duplex blank page text private string _BlankPageText; // C2019-004: Allow user to define duplex blank page text
public string BlankPageText public string BlankPageText
{ {
get { return _BlankPageText; } get { return _BlankPageText; }
@ -299,7 +299,7 @@ namespace Volian.Print.Library
} }
// use DidAll & MergeNotIncuded to know that printing all (not single) was done. Used w/ merge code to know when to return, i.e. not include in merged pdf // use DidAll & MergeNotIncuded to know that printing all (not single) was done. Used w/ merge code to know when to return, i.e. not include in merged pdf
private bool _DidAll; private bool _DidAll;
public bool DidAll // value passed in from frmPdfStatusForm public bool DidAll // value passed in from frmPdfStatusForm
{ {
get { return _DidAll; } get { return _DidAll; }
set { _DidAll = value; } set { _DidAll = value; }
@ -336,7 +336,7 @@ namespace Volian.Print.Library
_MyReaderHelper = new ReaderHelper(this); _MyReaderHelper = new ReaderHelper(this);
_SaveLinks = saveLinks; _SaveLinks = saveLinks;
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
if (removeTrailngHardReturnsAndManualPageBreaks == 1 || removeTrailngHardReturnsAndManualPageBreaks == 3 ) RemoveTrailingHardReturnsAndSpaces = new List<int>(); if (removeTrailngHardReturnsAndManualPageBreaks == 1 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveTrailingHardReturnsAndSpaces = new List<int>();
if (removeTrailngHardReturnsAndManualPageBreaks == 2 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveManualPageBreaks = new List<int>(); if (removeTrailngHardReturnsAndManualPageBreaks == 2 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveManualPageBreaks = new List<int>();
_BlankPageText = blankPageText; _BlankPageText = blankPageText;
_DidAll = didAll; _DidAll = didAll;
@ -366,7 +366,7 @@ namespace Volian.Print.Library
if (_MyItem is ProcedureInfo) if (_MyItem is ProcedureInfo)
{ {
ProcedureConfig pcfg = (ProcedureConfig)(_MyItem as ProcedureInfo).MyConfig; 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 if (DidAll && pcfg.Print_NotInMergeAll) // will be merging a pdf, so don't print this procedure if user set that on procedure propertures
{ {
_MergeNotIncluded = true; _MergeNotIncluded = true;
return null; return null;
@ -399,7 +399,7 @@ namespace Volian.Print.Library
} }
else // B2017-186 Neither Facing Pages or Page Number Transitions else // B2017-186 Neither Facing Pages or Page Number Transitions
{ {
string tmpss = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary); string tmpss = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary);
if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{ {
ReportForcedPaginations(); ReportForcedPaginations();
@ -435,7 +435,7 @@ namespace Volian.Print.Library
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo); ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this); _MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary); retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary);
if (! BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{ {
ReportForcedPaginations(); ReportForcedPaginations();
ForcedPaginations.Clear(); ForcedPaginations.Clear();
@ -538,7 +538,7 @@ namespace Volian.Print.Library
_PROMSVersionLayer.SetPrint("PROMS Version", true); _PROMSVersionLayer.SetPrint("PROMS Version", true);
} }
} }
public static int ProcPageCount = -1; // Used to count page numbers in each pdf. This will be used if/when pdfs are merged together. public static int ProcPageCount = -1; // Used to count page numbers in each pdf. This will be used if/when pdfs are merged together.
private void CloseDocument(string fileName) private void CloseDocument(string fileName)
{ {
int profileDepth = ProfileTimer.Push(">>>> CloseDocument"); int profileDepth = ProfileTimer.Push(">>>> CloseDocument");
@ -565,7 +565,7 @@ namespace Volian.Print.Library
set set
{ {
_MyContentByte = value; _MyContentByte = value;
if(value != null)MyReaderHelper.LoadTree(MyItem); if (value != null) MyReaderHelper.LoadTree(MyItem);
} }
} }
public void NewPage() public void NewPage()
@ -585,22 +585,22 @@ namespace Volian.Print.Library
{ {
SectionInfo currentSection = _MyHelper.MySection; SectionInfo currentSection = _MyHelper.MySection;
SectionInfo nextSection = GetNextSection(currentSection); // _MyHelper.MySection.NextItem as SectionInfo; SectionInfo nextSection = GetNextSection(currentSection); // _MyHelper.MySection.NextItem as SectionInfo;
//SectionConfig sc = (nextSection ?? currentSection).MyConfig as SectionConfig; //SectionConfig sc = (nextSection ?? currentSection).MyConfig as SectionConfig;
// If we are changing to a different section, then get the config from the nextSection // If we are changing to a different section, then get the config from the nextSection
// else we are still printing in the same section so get the config from the current section // else we are still printing in the same section so get the config from the current section
SectionConfig sc = ((!sectionChange || nextSection == null)? currentSection.MyConfig : nextSection.MyConfig) as SectionConfig; SectionConfig sc = ((!sectionChange || nextSection == null) ? currentSection.MyConfig : nextSection.MyConfig) as SectionConfig;
bool wordMargins = (sc != null && sc.Section_WordMargin == "Y"); bool wordMargins = (sc != null && sc.Section_WordMargin == "Y");
if (wordMargins) if (wordMargins)
{ {
if (nextSection != null && (sectionChange) && !nextSection.IsStepSection) //change to a word section if (nextSection != null && (sectionChange) && !nextSection.IsStepSection) //change to a word section
{ {
LastWordSection = nextSection; LastWordSection = nextSection;
_PageCountOfWordSection = 1; _PageCountOfWordSection = 1;
MyReaderHelper.MySectionInfo = LastWordSection; MyReaderHelper.MySectionInfo = LastWordSection;
//ShowNeedForPageSize(); //ShowNeedForPageSize();
rct = MyReaderHelper.GetSize(LastWordSection, 1); rct = MyReaderHelper.GetSize(LastWordSection, 1);
} }
else if (!currentSection.IsStepSection) //current section is a word section else if (!currentSection.IsStepSection) //current section is a word section
{ {
if (currentSection != LastWordSection) if (currentSection != LastWordSection)
{ {
@ -608,7 +608,7 @@ namespace Volian.Print.Library
_PageCountOfWordSection = 1; _PageCountOfWordSection = 1;
} }
else else
if (!_MyHelper.OnBlankPage) _PageCountOfWordSection++; // B2018-049: supplemental printing throws off page sizes if (!_MyHelper.OnBlankPage) _PageCountOfWordSection++; // B2018-049: supplemental printing throws off page sizes
MyReaderHelper.MySectionInfo = LastWordSection; MyReaderHelper.MySectionInfo = LastWordSection;
//ShowNeedForPageSize(); //ShowNeedForPageSize();
rct = MyReaderHelper.GetSize(LastWordSection, _PageCountOfWordSection); rct = MyReaderHelper.GetSize(LastWordSection, _PageCountOfWordSection);
@ -622,7 +622,7 @@ namespace Volian.Print.Library
if (currentSection.IsStepSection) if (currentSection.IsStepSection)
Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", rct); Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", rct);
else else
Volian.Base.Library.BaselineMetaFile.WriteLine("UseWordMargins={0} {1} ", (wordMargins)?"Y":"N", rct); Volian.Base.Library.BaselineMetaFile.WriteLine("UseWordMargins={0} {1} ", (wordMargins) ? "Y" : "N", rct);
//Console.WriteLine("\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t{4}" //Console.WriteLine("\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t{4}"
// , currentSection == null ? "" : currentSection.DisplayNumber + " " + currentSection.DisplayText // , currentSection == null ? "" : currentSection.DisplayNumber + " " + currentSection.DisplayText
// , nextSection == null ? "" : nextSection.DisplayNumber + " " + nextSection.DisplayText // , nextSection == null ? "" : nextSection.DisplayNumber + " " + nextSection.DisplayText
@ -682,44 +682,82 @@ namespace Volian.Print.Library
// Console.WriteLine("To {0}.{1} Page: {2}",LastWordSection.DisplayNumber,LastWordSection.DisplayText,_PageCountOfWordSection); // Console.WriteLine("To {0}.{1} Page: {2}",LastWordSection.DisplayNumber,LastWordSection.DisplayText,_PageCountOfWordSection);
// PreviousWordSection = LastWordSection; // PreviousWordSection = LastWordSection;
//} //}
private PdfContentByte OpenDoc(string outputFileName, iTextSharp.text.Rectangle rect) private PdfContentByte OpenDoc(ref string outputFileName, iTextSharp.text.Rectangle rect)
{ {
PdfWriter writer=null;
iTextSharp.text.Document document = new iTextSharp.text.Document(rect);
try try
{ {
writer = PdfWriter.GetInstance(document, new FileStream(outputFileName, FileMode.Create)); PdfWriter writer = null;
// PDFA1B does not allow layers, so this is disabled for now iTextSharp.text.Document document = new iTextSharp.text.Document(rect);
// If enabled, CreateLayers will need to be skipped.
//writer.PDFXConformance = PdfWriter.PDFA1B; try
{
if (File.Exists(outputFileName))
{
String tmpExt = System.IO.Path.GetExtension(outputFileName);
String tmpPTH = System.IO.Path.GetDirectoryName(outputFileName);
String tmpFN = System.IO.Path.GetFileName(outputFileName);
String tmpFNNoExt = System.IO.Path.GetFileNameWithoutExtension(outputFileName);
var files = new HashSet<string>(Directory.GetFiles(tmpPTH, "*.pdf"));
//string baseName = Path.Combine(scpath, "Screenshot_");
string filename;
int i = 0;
do
{
filename = tmpPTH + @"\" + tmpFNNoExt + "_" + ++i + ".pdf";
} while (files.Contains(filename));
outputFileName = filename;
}
writer = PdfWriter.GetInstance(document, new FileStream(outputFileName, FileMode.Create));
// PDFA1B does not allow layers, so this is disabled for now
// If enabled, CreateLayers will need to be skipped.
//writer.PDFXConformance = PdfWriter.PDFA1B;
}
catch (Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Could not create");
sb.AppendLine();
sb.AppendLine(outputFileName + ".");
sb.AppendLine();
sb.AppendLine("If it is open, close and retry.");
MessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//MessageBox.Show("Could not create " + outputFileName + ". If it is open, close and retry.", "Error on CreatePdf");
return MyContentByte = null;
}
document.Open();
// Create Layers
CreateLayers(writer.DirectContent);
MSWordToPDF.DebugStatus = DebugOutput ? 1 : 0;
PrintOverride.Reset();
if (DebugOutput)
{
PrintOverride.TextColor = System.Drawing.Color.Red;
PrintOverride.SvgColor = System.Drawing.Color.LawnGreen;
PrintOverride.BoxColor = System.Drawing.Color.Red;
PrintOverride.ChangeBarColor = System.Drawing.Color.Red;
PrintOverride.DebugColor = System.Drawing.Color.CadetBlue;
}
MyContentByte = writer.DirectContent;
return MyContentByte;
} }
catch (Exception ex) catch (Exception ex)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine("Could not create"); sb.AppendLine("Error occured when creating Print PDF");
sb.AppendLine(); sb.AppendLine();
sb.AppendLine(outputFileName + "."); sb.AppendLine(outputFileName + ".");
sb.AppendLine(); sb.AppendLine();
sb.AppendLine("If it is open, close and retry."); sb.AppendLine("If it is open, close and retry.");
MessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(sb.ToString(), "Error Creating PDF", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//MessageBox.Show("Could not create " + outputFileName + ". If it is open, close and retry.", "Error on CreatePdf"); //MessageBox.Show("Could not create " + outputFileName + ". If it is open, close and retry.", "Error on CreatePdf");
return MyContentByte = null; return MyContentByte = null;
} }
document.Open();
// Create Layers
CreateLayers(writer.DirectContent);
MSWordToPDF.DebugStatus = DebugOutput ? 1 : 0;
PrintOverride.Reset();
if (DebugOutput)
{
PrintOverride.TextColor = System.Drawing.Color.Red;
PrintOverride.SvgColor = System.Drawing.Color.LawnGreen;
PrintOverride.BoxColor = System.Drawing.Color.Red;
PrintOverride.ChangeBarColor = System.Drawing.Color.Red;
PrintOverride.DebugColor = System.Drawing.Color.CadetBlue;
}
MyContentByte = writer.DirectContent;
return MyContentByte;
} }
//private string CreateFileName(string procNumber, string sectNumber, string sectTitle) //private string CreateFileName(string procNumber, string sectNumber, string sectTitle)
//{ //{
@ -823,7 +861,7 @@ namespace Volian.Print.Library
get { return _AllowAllWatermarks; } get { return _AllowAllWatermarks; }
set { _AllowAllWatermarks = value; } set { _AllowAllWatermarks = value; }
} }
private string _WatermarkOverrideColor = "BLUE"; // C2021-019: Override watermark color private string _WatermarkOverrideColor = "BLUE"; // C2021-019: Override watermark color
public string WatermarkOverrideColor public string WatermarkOverrideColor
{ {
get { return _WatermarkOverrideColor; } get { return _WatermarkOverrideColor; }
@ -838,7 +876,7 @@ namespace Volian.Print.Library
// B2023-024 PROMS was using old cached PDF data when printing Word sections. // B2023-024 PROMS was using old cached PDF data when printing Word sections.
if (doingFoldout) if (doingFoldout)
{ {
PdfInfo.RemovePDFFromCache((ItemInfo) myFoldoutSection); // remove cached PDF info to force getting of new data PdfInfo.RemovePDFFromCache((ItemInfo)myFoldoutSection); // remove cached PDF info to force getting of new data
if (File.Exists(outputFileName)) if (File.Exists(outputFileName))
File.Delete(outputFileName); // delete the temporary FOLDOUT file File.Delete(outputFileName); // delete the temporary FOLDOUT file
} }
@ -857,7 +895,7 @@ namespace Volian.Print.Library
bool wordMargins = (sc != null && sc.Section_WordMargin == "Y"); bool wordMargins = (sc != null && sc.Section_WordMargin == "Y");
if (wordMargins) if (wordMargins)
{ {
string pdfFile =BuildMSWordPDF(si); string pdfFile = BuildMSWordPDF(si);
try try
{ {
PdfReader reader = new PdfReader(pdfFile); PdfReader reader = new PdfReader(pdfFile);
@ -866,21 +904,21 @@ namespace Volian.Print.Library
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
_MyLog.Warn(string.Format("Error of ReadPDf [{0}],{1}.{2}",si.ItemID,si.DisplayNumber,si.DisplayText),ex); _MyLog.Warn(string.Format("Error of ReadPDf [{0}],{1}.{2}", si.ItemID, si.DisplayNumber, si.DisplayText), ex);
throw new Exception("Error in readPDF", ex); throw new Exception("Error in readPDF", ex);
} }
} }
} }
PdfContentByte cb = OpenDoc(outputFileName, rct); PdfContentByte cb = OpenDoc(ref outputFileName, rct);
if (cb == null) if (cb == null)
{ {
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
return null; return null;
} }
SetupProperties(cb.PdfDocument, myProcedure); SetupProperties(cb.PdfDocument, myProcedure);
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before); OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
NewPage(); // Start of print NewPage(); // Start of print
//_MyLog.InfoFormat("NewPage 1 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 1 {0}", cb.PdfWriter.CurrentPageNumber);
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
if (myProcedure.Sections == null) if (myProcedure.Sections == null)
{ {
@ -906,7 +944,7 @@ namespace Volian.Print.Library
{ {
// B2020-115 Calculate maximum available space on a page for figures // B2020-115 Calculate maximum available space on a page for figures
vlnParagraph.hMax = ((float)mySection.MyDocStyle.Layout.PageLength); vlnParagraph.hMax = ((float)mySection.MyDocStyle.Layout.PageLength);
vlnParagraph.wMax = ((float) mySection.MyDocStyle.Layout.PageWidth)- ((float) mySection.MyDocStyle.Layout.LeftMargin - 12); vlnParagraph.wMax = ((float)mySection.MyDocStyle.Layout.PageWidth) - ((float)mySection.MyDocStyle.Layout.LeftMargin - 12);
NeedSupInfoBreak = true; NeedSupInfoBreak = true;
bool isFoldoutSection = (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y"; //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box bool isFoldoutSection = (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y"; //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box
if (((isFoldoutSection && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts) if (((isFoldoutSection && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts)
@ -961,7 +999,7 @@ namespace Volian.Print.Library
} }
x += 72F * VlnSettings.GetCommandFloat("X", 0); x += 72F * VlnSettings.GetCommandFloat("X", 0);
y -= 72F * VlnSettings.GetCommandFloat("Y", 0); y -= 72F * VlnSettings.GetCommandFloat("Y", 0);
_MyHelper.BackgroundOffset = new PointF(x,y); _MyHelper.BackgroundOffset = new PointF(x, y);
_MyHelper.BackgroundPageOffset = 0; _MyHelper.BackgroundPageOffset = 0;
} }
_MyHelper.WatermarkLayer = _WatermarkLayer; _MyHelper.WatermarkLayer = _WatermarkLayer;
@ -977,7 +1015,7 @@ namespace Volian.Print.Library
//_MyHelper.DoZoomOMatic = DebugOutput; //_MyHelper.DoZoomOMatic = DebugOutput;
_MyHelper.OriginalPageBreak = OriginalPageBreak; _MyHelper.OriginalPageBreak = OriginalPageBreak;
_MyHelper.PROMSVersion = _PromsVersion; //C2018-009 print PROMS version _MyHelper.PROMSVersion = _PromsVersion; //C2018-009 print PROMS version
_MyHelper.WatermarkColor = WatermarkOverrideColor; // C2021-019: save the override for the watermark color _MyHelper.WatermarkColor = WatermarkOverrideColor; // C2021-019: save the override for the watermark color
OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent); OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent);
} }
else else
@ -1073,7 +1111,7 @@ namespace Volian.Print.Library
{ {
// If the procedure has supplemental facing pages, but this section does not & it's the first section, // 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 // need a blank 'facing page'. Sections after the first will get blank 'facing page' in print's pagination logic
if (SupInfoPrintType==E_SupInfoPrintType.Merge && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages) if (SupInfoPrintType == E_SupInfoPrintType.Merge && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages)
{ {
InsertBlankPage(cb); InsertBlankPage(cb);
} }
@ -1112,14 +1150,14 @@ namespace Volian.Print.Library
{ {
// Setting the default font to Arial since that is what Calvert is currently using for their Placekeeper pages // Setting the default font to Arial since that is what Calvert is currently using for their Placekeeper pages
VE_Font pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // default font info. VE_Font pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // default font info.
// Ideally, we should grab the font from the DocStyle used for the Placekeeper. // Ideally, we should grab the font from the DocStyle used for the Placekeeper.
// Note that Calvert has two Placekeeper docSyles (EOPs and AOPs) in the same format. // Note that Calvert has two Placekeeper docSyles (EOPs and AOPs) in the same format.
// Both Placekeeper DocStyles use Arial 11 pt font, so there is no need to grab it from the format file. // Both Placekeeper DocStyles use Arial 11 pt font, so there is no need to grab it from the format file.
//foreach (DocStyle ds in _MyHelper.MySection.ActiveFormat.PlantFormat.DocStyles.DocStyleList) //foreach (DocStyle ds in _MyHelper.MySection.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
//{ // note that this will get the last Placekeeper font setting //{ // note that this will get the last Placekeeper font setting
// if (ds.StructureStyle.Style == E_DocStructStyle.Placekeeper) // if (ds.StructureStyle.Style == E_DocStructStyle.Placekeeper)
// pkFont = ds.Font; // pkFont = ds.Font;
//} //}
if (_MyHelper.MyPlacekeepers.Count > 0) if (_MyHelper.MyPlacekeepers.Count > 0)
MyPlacekeeper = new Placekeeper(_MyHelper.MyPlacekeepers, pkFont); MyPlacekeeper = new Placekeeper(_MyHelper.MyPlacekeepers, pkFont);
} }
@ -1149,7 +1187,7 @@ namespace Volian.Print.Library
{ {
_MyHelper.OnBlankPage = true; _MyHelper.OnBlankPage = true;
string baselinemsg = "==Insert Blank Page=="; string baselinemsg = "==Insert Blank Page==";
if (_BlankPageText != null && _BlankPageText != "") // C2019-004: Allow user to define duplex blank page text if (_BlankPageText != null && _BlankPageText != "") // C2019-004: Allow user to define duplex blank page text
{ {
if (_MyHelper.IsLandscape) // rotate the blank page message on landscaped pages if (_MyHelper.IsLandscape) // rotate the blank page message on landscaped pages
{ {
@ -1174,9 +1212,9 @@ namespace Volian.Print.Library
private void SetupProperties(PdfDocument document, ProcedureInfo myProcedure) private void SetupProperties(PdfDocument document, ProcedureInfo myProcedure)
{ {
document.AddTitle(string.Format("{0} {1}",myProcedure.DisplayNumber,myProcedure.DisplayText)); document.AddTitle(string.Format("{0} {1}", myProcedure.DisplayNumber, myProcedure.DisplayText));
document.AddSubject(myProcedure.SearchDVPath); document.AddSubject(myProcedure.SearchDVPath);
document.AddCreator(string.Format("{0} {1}",Application.ProductName, Application.ProductVersion)); document.AddCreator(string.Format("{0} {1}", Application.ProductName, Application.ProductVersion));
document.AddAuthor(Volian.Base.Library.VlnSettings.UserID); document.AddAuthor(Volian.Base.Library.VlnSettings.UserID);
} }
private Placekeeper _MyPlacekeeper = null; private Placekeeper _MyPlacekeeper = null;
@ -1206,7 +1244,7 @@ namespace Volian.Print.Library
public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection) public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection)
{ {
if (mySection.PageNumber == -1) // If page num transition goes to a section, need the pagenumber of section. if (mySection.PageNumber == -1) // If page num transition goes to a section, need the pagenumber of section.
{ {
if ((mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountFoldoutPgs) == E_DocStructStyle.DontCountFoldoutPgs) if ((mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountFoldoutPgs) == E_DocStructStyle.DontCountFoldoutPgs)
mySection.PageNumber = _MyHelper.CurrentPageNumberNoFoldouts; mySection.PageNumber = _MyHelper.CurrentPageNumberNoFoldouts;
@ -1229,15 +1267,15 @@ namespace Volian.Print.Library
int sectPageCount = 0; int sectPageCount = 0;
float locEndOfWordDoc = 0; float locEndOfWordDoc = 0;
float pdfSize = 0; float pdfSize = 0;
using (PdfInfo myPdf = PdfInfo.Get(mySection,false)) using (PdfInfo myPdf = PdfInfo.Get(mySection, false))
{ {
if (myPdf == null) // B2017-218 Handle invalid word sections if (myPdf == null) // B2017-218 Handle invalid word sections
{ {
cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 20); cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 20);
cb.SetTextMatrix(cb.PdfDocument.Left+200,cb.PdfDocument.Bottom+cb.PdfDocument.Top / 2); cb.SetTextMatrix(cb.PdfDocument.Left + 200, cb.PdfDocument.Bottom + cb.PdfDocument.Top / 2);
cb.ShowText("Word Section Invalid"); cb.ShowText("Word Section Invalid");
// C2018-004 create meta file for baseline compares // C2018-004 create meta file for baseline compares
Volian.Base.Library.BaselineMetaFile.WriteLine("!!Word Section Invalid: ID {0} \"{1}\" \"{2}\"",mySection.ItemID, mySection.DisplayNumber, mySection.DisplayText); Volian.Base.Library.BaselineMetaFile.WriteLine("!!Word Section Invalid: ID {0} \"{1}\" \"{2}\"", mySection.ItemID, mySection.DisplayNumber, mySection.DisplayText);
} }
else else
{ {
@ -1298,13 +1336,13 @@ namespace Volian.Print.Library
OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord); OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord);
if (doimport2) if (doimport2)
{ {
if (((!didFoldout && _MyFoldoutReader.Count > 0 ) || mySection.MyProcedure.ProcHasSupInfoData) && cb.PdfWriter.CurrentPageNumber > 1 && InsertBlankPages) if (((!didFoldout && _MyFoldoutReader.Count > 0) || mySection.MyProcedure.ProcHasSupInfoData) && cb.PdfWriter.CurrentPageNumber > 1 && InsertBlankPages)
{ {
bool doInsertBlankPage = true; bool doInsertBlankPage = true;
SectionInfo currentSection = _MyHelper.MySection; SectionInfo currentSection = _MyHelper.MySection;
iTextSharp.text.Rectangle curRecSize = cb.PdfDocument.PageSize; // save current PDF Doc Page Size iTextSharp.text.Rectangle curRecSize = cb.PdfDocument.PageSize; // save current PDF Doc Page Size
// only insert a blank page if this section does not have a foldout (but the procedure as a whole does) // 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 // and the checkbox on the print dialog to add blank pages is checked
if (mySection.MyDocStyle.DontInsertBlankPages) if (mySection.MyDocStyle.DontInsertBlankPages)
{ {
// C2023-001 we are going to print the first page of a section that we don't insert blank pages // C2023-001 we are going to print the first page of a section that we don't insert blank pages
@ -1348,16 +1386,16 @@ namespace Volian.Print.Library
//float y1 = cb.PdfDocument.PageSize.Height ; // 1.8f; //float y1 = cb.PdfDocument.PageSize.Height ; // 1.8f;
float height = 12 * 1.5F; float height = 12 * 1.5F;
// B2019-102 Locate the chunk below the bottom of the page // B2019-102 Locate the chunk below the bottom of the page
ct.SetSimpleColumn(0, -height, chk.GetWidthPoint() * 1.01F, -2*height ); ct.SetSimpleColumn(0, -height, chk.GetWidthPoint() * 1.01F, -2 * height);
ct.AddElement(new Phrase(chk)); ct.AddElement(new Phrase(chk));
cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor)); cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor));
int status = ct.Go(); int status = ct.Go();
if(status > 1) if (status > 1)
_MyLog.WarnFormat("\r\n.-.-.-. Failed to add a PDF destination for {0}", mySection.ShortPath); _MyLog.WarnFormat("\r\n.-.-.-. Failed to add a PDF destination for {0}", mySection.ShortPath);
} }
if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}", if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber); _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath, pageNumber);
} }
if (ii == sectPageCount - 1) if (ii == sectPageCount - 1)
{ {
@ -1377,7 +1415,7 @@ namespace Volian.Print.Library
float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (myMsg.Length * (float)mySection.MyDocStyle.End.Font.CharsToTwips)) / 2; float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (myMsg.Length * (float)mySection.MyDocStyle.End.Font.CharsToTwips)) / 2;
float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch); float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
float adjMsgY = 0; float adjMsgY = 0;
if ((float)mySection.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. if ((float)mySection.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page.
{ {
adjMsgY = (float)(-(float)mySection.MyDocStyle.End.Flag * vlnPrintObject.SixLinesPerInch); adjMsgY = (float)(-(float)mySection.MyDocStyle.End.Flag * vlnPrintObject.SixLinesPerInch);
if (ylocation - adjMsgY > mySection.MyDocStyle.Layout.FooterLength) ylocation = ylocation - adjMsgY; if (ylocation - adjMsgY > mySection.MyDocStyle.Layout.FooterLength) ylocation = ylocation - adjMsgY;
@ -1395,47 +1433,47 @@ namespace Volian.Print.Library
} }
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord); OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
} }
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before); OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
if (mySection.MyDocStyle.LandscapePageList)// && mySection.MyDocStyle.Layout.PageWidth > mySection.MyDocStyle.Layout.PageLength) if (mySection.MyDocStyle.LandscapePageList)// && mySection.MyDocStyle.Layout.PageWidth > mySection.MyDocStyle.Layout.PageLength)
_MyHelper.IsLandscape = true; _MyHelper.IsLandscape = true;
else else
_MyHelper.IsLandscape = false; _MyHelper.IsLandscape = false;
// C2023-001 put in for Beaver Valley, DontInsertBlankPages is use on their CAS sections, which inlucde a hard page break // C2023-001 put in for Beaver Valley, DontInsertBlankPages is use on their CAS sections, which inlucde a hard page break
// with text saying that page folds out. Some procedures also have a PROMS foldout section that is printed on the // with text saying that page folds out. Some procedures also have a PROMS foldout section that is printed on the
// back of the procedure step pages. When we are printing duplex with blank pages, we don't want to insert a blank // back of the procedure step pages. When we are printing duplex with blank pages, we don't want to insert a blank
// page between the two pages of the CAS section // page between the two pages of the CAS section
// "pageForNextSection" is used to tell NewPage() if it needs to check the page size of the next section before starting the // "pageForNextSection" is used to tell NewPage() if it needs to check the page size of the next section before starting the
// next page - this fixes an issue where the page we inserted for the backside of the previous section was the larger page // next page - this fixes an issue where the page we inserted for the backside of the previous section was the larger page
// size (11x17 vs 8x11) // size (11x17 vs 8x11)
bool pageForNextSection = (ii == sectPageCount - 1 && !InsertBlankPages); bool pageForNextSection = (ii == sectPageCount - 1 && !InsertBlankPages);
_MyHelper.SpecialCAS = false; _MyHelper.SpecialCAS = false;
if (mySection.MyDocStyle.DontInsertBlankPages && ii == sectPageCount - 1) // C2023-001 beaver valley CAS section type (has hard page break for back of page) if (mySection.MyDocStyle.DontInsertBlankPages && ii == sectPageCount - 1) // C2023-001 beaver valley CAS section type (has hard page break for back of page)
{ {
pageForNextSection = true; pageForNextSection = true;
_MyHelper.SpecialCAS = true; // B2023-005: Beaver Valley - flag to rotate watermark on 2nd CAS page _MyHelper.SpecialCAS = true; // B2023-005: Beaver Valley - flag to rotate watermark on 2nd CAS page
} }
NewPage(pageForNextSection); // Word Document NewPage(pageForNextSection); // Word Document
//_MyLog.InfoFormat("NewPage 3 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 3 {0}", cb.PdfWriter.CurrentPageNumber);
// if this document style has another style that is for pages other than first, we need to // if this document style has another style that is for pages other than first, we need to
// reset the document style off of this section AND reset docstyle values used. // reset the document style off of this section AND reset docstyle values used.
_MyHelper.DidFirstPageDocStyle = true; _MyHelper.DidFirstPageDocStyle = true;
// Calvert has a case in their stp landscape word docs where a ' (Continued)' message // Calvert has a case in their stp landscape word docs where a ' (Continued)' message
// appears in their pagelist item for printing the section title, {ATTACHTITLECONT} pagelist // appears in their pagelist item for printing the section title, {ATTACHTITLECONT} pagelist
// However, other sections use this token, but do NOT have the continue message - so // However, other sections use this token, but do NOT have the continue message - so
// the docstyle was added to flag the difference between them (STP-Landscape Attachments has it, // the docstyle was added to flag the difference between them (STP-Landscape Attachments has it,
// STP-Attachments do not) // STP-Attachments do not)
if (resetSvgForCont && (mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListAddSectCont) == E_DocStructStyle.DSS_PageListAddSectCont) if (resetSvgForCont && (mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListAddSectCont) == E_DocStructStyle.DSS_PageListAddSectCont)
{ {
_MyHelper.ResetSvg(); _MyHelper.ResetSvg();
resetSvgForCont = false; // only need to reset it once (for all pages after 1st page) resetSvgForCont = false; // only need to reset it once (for all pages after 1st page)
} }
//DebugPagination.WriteLine("CreateWordDocPdf"); //DebugPagination.WriteLine("CreateWordDocPdf");
if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0) if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
_MyHelper.MySection = mySection; // this resets the docstyle/pagestyle in pagehelper _MyHelper.MySection = mySection; // this resets the docstyle/pagestyle in pagehelper
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -1453,7 +1491,7 @@ namespace Volian.Print.Library
// so that if merge is done, the pages that are landscaped can have landscaped page numbers placed on them // so that if merge is done, the pages that are landscaped can have landscaped page numbers placed on them
public static void AddMergedLandscapePage(VlnSvgPageHelper _MyHelper, string PDFFile) public static void AddMergedLandscapePage(VlnSvgPageHelper _MyHelper, string PDFFile)
{ {
string tmp = PDFFile.Substring(0,PDFFile.IndexOf(".pdf")); string tmp = PDFFile.Substring(0, PDFFile.IndexOf(".pdf"));
if (MergedLandscapePages == null) MergedLandscapePages = new Dictionary<string, List<int>>(); if (MergedLandscapePages == null) MergedLandscapePages = new Dictionary<string, List<int>>();
if (MergedLandscapePages.ContainsKey(tmp)) if (MergedLandscapePages.ContainsKey(tmp))
MergedLandscapePages[tmp].Add(_MyHelper.CurrentPageNumber); MergedLandscapePages[tmp].Add(_MyHelper.CurrentPageNumber);
@ -1512,7 +1550,7 @@ namespace Volian.Print.Library
float xAdjNumber = -6 + 1.2F; float xAdjNumber = -6 + 1.2F;
float xAdjTitle = .8F + 1.2F; float xAdjTitle = .8F + 1.2F;
float xAdjTitleIndent = -6 + 2.4F; float xAdjTitleIndent = -6 + 2.4F;
float yadj = 0.5F; // tweak to get 16 & 32 bit output to match. float yadj = 0.5F; // tweak to get 16 & 32 bit output to match.
float yPageStartAdj = yPageStart - yadj; float yPageStartAdj = yPageStart - yadj;
float leftMargin = (float)tocSection.MyDocStyle.Layout.LeftMargin; float leftMargin = (float)tocSection.MyDocStyle.Layout.LeftMargin;
@ -1572,7 +1610,7 @@ namespace Volian.Print.Library
inGroup = true; inGroup = true;
// B2020-033: for single spacing, add an extra line before a grouping title: // B2020-033: for single spacing, add an extra line before a grouping title:
float tmpspc = (float)(tOfC.TofCLineSpacing ?? 1); float tmpspc = (float)(tOfC.TofCLineSpacing ?? 1);
if (lastTOCGroupHeading != "" || (firstGroupHeading && tmpspc==1)) if (lastTOCGroupHeading != "" || (firstGroupHeading && tmpspc == 1))
{ {
yLocation += vlnPrintObject.SixLinesPerInch; yLocation += vlnPrintObject.SixLinesPerInch;
firstGroupHeading = false; firstGroupHeading = false;
@ -1612,9 +1650,9 @@ namespace Volian.Print.Library
// logic put in for V.C. Summer who wants to their auto table of contents to print "OPERATOR ACTIONS" (set in the format) instead of "Procedure Steps" // logic put in for V.C. Summer who wants to their auto table of contents to print "OPERATOR ACTIONS" (set in the format) instead of "Procedure Steps"
// - note that Summer didn't want to change the section title because they want transition to say "procedure step" for the section title. 03/08/2016 // - note that Summer didn't want to change the section title because they want transition to say "procedure step" for the section title. 03/08/2016
string tocSecTitle = mySection.FormattedDisplayText;// B2017-019 - process "<u>" in section title string tocSecTitle = mySection.FormattedDisplayText;// B2017-019 - process "<u>" in section title
tocSecTitle= ConvertSpecialChars(tocSecTitle, ii.ActiveFormat.PlantFormat.FormatData); // B2019-172 process symbol characters tocSecTitle = ConvertSpecialChars(tocSecTitle, ii.ActiveFormat.PlantFormat.FormatData); // B2019-172 process symbol characters
if (tocSecTitle.ToUpper() == "PROCEDURE STEPS" && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle != "") if (tocSecTitle.ToUpper() == "PROCEDURE STEPS" && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle != "")
tocSecTitle = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle; tocSecTitle = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle;
// Do the title first since it may wrap to 2nd line and this is an issue for // Do the title first since it may wrap to 2nd line and this is an issue for
// doing a pagebreak, i.e. may cause a page break when the number on a single line // doing a pagebreak, i.e. may cause a page break when the number on a single line
@ -1622,7 +1660,7 @@ namespace Volian.Print.Library
//if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData //if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData
if (level == 0 && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCUnderlineFirstLevelTitle) if (level == 0 && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCUnderlineFirstLevelTitle)
{ {
VE_Font ovrFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size,(E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI); VE_Font ovrFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size, (E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI);
rtfText = GetRtfToC(tocSecTitle, tOfC, ovrFont); rtfText = GetRtfToC(tocSecTitle, tOfC, ovrFont);
} }
else else
@ -1657,8 +1695,8 @@ namespace Volian.Print.Library
if (lnsp > -1) yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line if (lnsp > -1) yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line
} }
// Print the section title // Print the section title
float retval = Rtf2Pdf.TextAt(cb, myparagraphSecTitle, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" "))? secNumPos : adjSecTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin); float retval = Rtf2Pdf.TextAt(cb, myparagraphSecTitle, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" ")) ? secNumPos : adjSecTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin);
if (retval == 0) // couldn't fit, flags need for a page break. if (retval == 0) // couldn't fit, flags need for a page break.
{ {
NewPage(); NewPage();
_MyHelper.ResetSvg(); // needed to reset so that PSNotFirst pagelist justify flag gets used for BGE _MyHelper.ResetSvg(); // needed to reset so that PSNotFirst pagelist justify flag gets used for BGE
@ -1749,7 +1787,7 @@ namespace Volian.Print.Library
AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, key); AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, key);
} }
//If the format wants single spacing within subsections (2nd level and lower), then need to figure out //If the format wants single spacing within subsections (2nd level and lower), then need to figure out
// spacing (vcb1 table of contents) // spacing (vcb1 table of contents)
//bool dosuby = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0) //bool dosuby = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0)
// && (mySection.MyParent.IsSection && ((mySection.Sections != null && mySection.Sections.Count > 0) || (level > 0 && mySection.NextItem != null)))) // && (mySection.MyParent.IsSection && ((mySection.Sections != null && mySection.Sections.Count > 0) || (level > 0 && mySection.NextItem != null))))
// || didGrp; // || didGrp;
@ -1760,9 +1798,9 @@ namespace Volian.Print.Library
if (doSubY) if (doSubY)
{ {
float spcs = (float)(tOfC.TofCLineSpacingSub ?? 1); float spcs = (float)(tOfC.TofCLineSpacingSub ?? 1);
if (spcs == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not) if (spcs == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not)
{ {
if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space
spcs = 1; spcs = 1;
else else
spcs = 2; spcs = 2;
@ -1772,9 +1810,9 @@ namespace Volian.Print.Library
else else
{ {
float spc = (float)(tOfC.TofCLineSpacing ?? 1); float spc = (float)(tOfC.TofCLineSpacing ?? 1);
if (spc == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not) if (spc == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not)
{ {
if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space
spc = 1; spc = 1;
else else
spc = 2; spc = 2;
@ -1823,7 +1861,7 @@ namespace Volian.Print.Library
// C2018-004 create meta file for baseline compares // 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, stepNumPos, stepTitlePos, stepPagePos); Volian.Base.Library.BaselineMetaFile.WriteLine("TOC Ystart {0} LeftMar {1} ScNmPos {2} ScTtlPos {3} ScPgPos {4}", yPageStart, leftMargin, stepNumPos, stepTitlePos, stepPagePos);
int tofCNumLevels = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCNumLevels ?? 0; int tofCNumLevels = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCNumLevels ?? 0;
if (tofCNumLevels > 0 && level > tofCNumLevels) return yLocation; // don't go down more than number of levels as defined in format if (tofCNumLevels > 0 && level > tofCNumLevels) return yLocation; // don't go down more than number of levels as defined in format
// figure out whether to indent. If not, set indentOffset to 0, otherwise indent number to where parent's text was (input parTitleXOff) // figure out whether to indent. If not, set indentOffset to 0, otherwise indent number to where parent's text was (input parTitleXOff)
int startIndentAfterLevel = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCStartIndentAfterLevel ?? 2; // int startIndentAfterLevel = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCStartIndentAfterLevel ?? 2; //
@ -1833,7 +1871,7 @@ namespace Volian.Print.Library
// start, if indenting. Without this, the xoffset was not correct: // start, if indenting. Without this, the xoffset was not correct:
float indentOffset = level == 0 ? 0 : parTitleXOff; float indentOffset = level == 0 ? 0 : parTitleXOff;
float numwidth = 0; float numwidth = 0;
foreach (ItemInfo hls in ii.Steps) // Ouput each HLS that has config flag to include it. foreach (ItemInfo hls in ii.Steps) // Ouput each HLS that has config flag to include it.
{ {
StepConfig stc = hls.MyConfig as StepConfig; StepConfig stc = hls.MyConfig as StepConfig;
if (stc != null && stc.Step_IncludeInTOC) if (stc != null && stc.Step_IncludeInTOC)
@ -1842,13 +1880,13 @@ namespace Volian.Print.Library
// need to do the step number, title & page number. Page number has to be put on at end after number of page is known, so use a Template. // need to do the step number, title & page number. Page number has to be put on at end after number of page is known, so use a Template.
string tmptxt = hls.MyTab.CleanText; string tmptxt = hls.MyTab.CleanText;
if (tmptxt == null || tmptxt == "") tmptxt = " "; // if no number set to blanks. Without this, low level printing gets confused if (tmptxt == null || tmptxt == "") tmptxt = " "; // if no number set to blanks. Without this, low level printing gets confused
string rtfText = GetRtfToC(tmptxt, tOfC); string rtfText = GetRtfToC(tmptxt, tOfC);
Paragraph myparagraphStepNum = vlnPrintObject.RtfToParagraph(rtfText); Paragraph myparagraphStepNum = vlnPrintObject.RtfToParagraph(rtfText);
float width = 0; float width = 0;
foreach (Chunk chkt in myparagraphStepNum.Chunks) foreach (Chunk chkt in myparagraphStepNum.Chunks)
width += chkt.GetWidthPoint(); width += chkt.GetWidthPoint();
if (numwidth == 0) numwidth = width; // keep same xoffset for step text unless overwriting by number (see below) if (numwidth == 0) numwidth = width; // keep same xoffset for step text unless overwriting by number (see below)
Rtf2Pdf.Offset = new PointF(0, 2.5F); Rtf2Pdf.Offset = new PointF(0, 2.5F);
// if the starting column of text would be in 'middle of' the number, just put it // if the starting column of text would be in 'middle of' the number, just put it
@ -1960,9 +1998,9 @@ namespace Volian.Print.Library
string rtnVal = str; string rtnVal = str;
rtnVal = rtnVal.Replace("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field) rtnVal = rtnVal.Replace("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field)
rtnVal = rtnVal.Replace("\n", @"\line "); //B2018-020 SQL content record has "\line " for the hard return rtnVal = rtnVal.Replace("\n", @"\line "); //B2018-020 SQL content record has "\line " for the hard return
// Bug fix B2014-057 // Bug fix B2014-057
// if we are searching for a symbol character in all procedure sets MyDocVersion is null // if we are searching for a symbol character in all procedure sets MyDocVersion is null
// when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml) // when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml)
if (fmtData != null && fmtData.SymbolList != null) if (fmtData != null && fmtData.SymbolList != null)
{ {
SymbolList sl = fmtData.SymbolList; SymbolList sl = fmtData.SymbolList;
@ -2178,7 +2216,7 @@ namespace Volian.Print.Library
// was found in, i.e. Ginna Rev2 SAMG, SAG-3 step 7. This change won't affect other plants/formats but if the problem occurs // was found in, i.e. Ginna Rev2 SAMG, SAG-3 step 7. This change won't affect other plants/formats but if the problem occurs
// the format value can be used to adjust the location of bottom message. However, this could adversely affect pagination and // the format value can be used to adjust the location of bottom message. However, this could adversely affect pagination and
// each plant/format needs to be done on a case by base basis. // each plant/format needs to be done on a case by base basis.
float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength - (myItemInfo.MyDocStyle.Continue.Bottom.LocAdj==null?0:(int)myItemInfo.MyDocStyle.Continue.Bottom.LocAdj)); float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength - (myItemInfo.MyDocStyle.Continue.Bottom.LocAdj == null ? 0 : (int)myItemInfo.MyDocStyle.Continue.Bottom.LocAdj));
vlnParagraph.PathPrefix = myItemInfo.Path; vlnParagraph.PathPrefix = myItemInfo.Path;
//Rtf2Pdf.PdfDebug = true; //Rtf2Pdf.PdfDebug = true;
Rtf2Pdf.Offset = new PointF(0, 2.5F); Rtf2Pdf.Offset = new PointF(0, 2.5F);
@ -2188,7 +2226,7 @@ namespace Volian.Print.Library
{ {
System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0);
cb.Transform(myMatrix); cb.Transform(myMatrix);
_MyHelper.IsWatermarkLandscape = true; // B2019-145: watermark on landscape page _MyHelper.IsWatermarkLandscape = true; // B2019-145: watermark on landscape page
} }
} }
else else
@ -2208,9 +2246,9 @@ namespace Volian.Print.Library
{ {
// if there is supplemental information associated with this section... generate the pdf. This pdf will be used to place // if there is supplemental information associated with this section... generate the pdf. This pdf will be used to place
// supplemental information on facing pages // supplemental information on facing pages
// B2017-267 Put in the DocStyle setting "AdjustTopMarginOnStepContinuePages" for Farley who uses the "PSOnlyFirst" in some of their pagelists so that a section title is printed only on the first page of the section. // B2017-267 Put in the DocStyle setting "AdjustTopMarginOnStepContinuePages" for Farley who uses the "PSOnlyFirst" in some of their pagelists so that a section title is printed only on the first page of the section.
// This will adjust the top margin when the section title is not printed on the other pages. // This will adjust the top margin when the section title is not printed on the other pages.
yTopMargin += myItemInfo.MyDocStyle.AdjustTopMarginOnStepContinuePages; yTopMargin += myItemInfo.MyDocStyle.AdjustTopMarginOnStepContinuePages;
if (SupInfoPrintType == E_SupInfoPrintType.Merge && myParagraph.SupInfoSection != null && myParagraph.SupInfoSection.ChildrenBelow != null && myParagraph.SupInfoSection.ChildrenBelow.Count > 0) if (SupInfoPrintType == E_SupInfoPrintType.Merge && myParagraph.SupInfoSection != null && myParagraph.SupInfoSection.ChildrenBelow != null && myParagraph.SupInfoSection.ChildrenBelow.Count > 0)
GenerateSuppInfoPdf(myParagraph.SupInfoSection, yTopMargin, yBottomMargin); GenerateSuppInfoPdf(myParagraph.SupInfoSection, yTopMargin, yBottomMargin);
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
@ -2218,7 +2256,7 @@ namespace Volian.Print.Library
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper); // add this step text to the PlaceKeeper (Calvert Cliffs) _MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper); // add this step text to the PlaceKeeper (Calvert Cliffs)
if (myParagraph.MyContAct != null) if (myParagraph.MyContAct != null)
_MyHelper.MyContActSteps.Add(myParagraph.MyContAct); // add this step to the Continuous Action Summary _MyHelper.MyContActSteps.Add(myParagraph.MyContAct); // add this step to the Continuous Action Summary
// F2022-024 Time Critical Action // F2022-024 Time Critical Action
if (myParagraph.MyTimeCriticalAction != null) if (myParagraph.MyTimeCriticalAction != null)
_MyHelper.MyTimeCriticalActionSteps.Add(myParagraph.MyTimeCriticalAction); // add this step to the Time Critical Action Summary _MyHelper.MyTimeCriticalActionSteps.Add(myParagraph.MyTimeCriticalAction); // add this step to the Time Critical Action Summary
} }
@ -2261,8 +2299,8 @@ namespace Volian.Print.Library
{ {
_MyHelper.IsLandscape = false; _MyHelper.IsLandscape = false;
} }
NewPage(true); // end of step section NewPage(true); // end of step section
//_MyLog.InfoFormat("NewPage 6 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 6 {0}", cb.PdfWriter.CurrentPageNumber);
_NoBreakYOffset = 0; _NoBreakYOffset = 0;
yPageStart = yTopMargin; yPageStart = yTopMargin;
} }
@ -2274,7 +2312,7 @@ namespace Volian.Print.Library
{ {
_MyHelper.DrawBottomMessage(cb); _MyHelper.DrawBottomMessage(cb);
localYPageStart += 12; localYPageStart += 12;
myParagraph.YBottomMost += 24; // two lines. myParagraph.YBottomMost += 24; // two lines.
} }
float tmplocal = localYPageStart; float tmplocal = localYPageStart;
_NoBreakYOffset = myParagraph.YBottomMost; _NoBreakYOffset = myParagraph.YBottomMost;
@ -2298,7 +2336,7 @@ namespace Volian.Print.Library
else SupInfoPdfPage.Clear(); else SupInfoPdfPage.Clear();
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + vlnParagraph.MyItemInfo.ItemID.ToString() + @".pdf"; string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + vlnParagraph.MyItemInfo.ItemID.ToString() + @".pdf";
iTextSharp.text.Rectangle pageSize = PDFPageSize.UsePaperSize(MyItem.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files iTextSharp.text.Rectangle pageSize = PDFPageSize.UsePaperSize(MyItem.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
PdfContentByte cb = OpenDoc(SupInfoPdfName, pageSize); PdfContentByte cb = OpenDoc(ref SupInfoPdfName, pageSize);
if (cb == null) return; if (cb == null) return;
VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0); VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0);
cb.PdfWriter.PageEvent = myPageHelper; cb.PdfWriter.PageEvent = myPageHelper;
@ -2310,7 +2348,7 @@ namespace Volian.Print.Library
myPageHelper.ChangeBarDefinition = MyChangeBarDefinition; myPageHelper.ChangeBarDefinition = MyChangeBarDefinition;
float yPageStart = yTopMargin; float yPageStart = yTopMargin;
vlnParagraph._yPageStartForSupInfo = yTopMargin; vlnParagraph._yPageStartForSupInfo = yTopMargin;
SupInfoAjustGroupings(vlnParagraph,cb); SupInfoAjustGroupings(vlnParagraph, cb);
SupInfoPrintType = E_SupInfoPrintType.SupInfoPdfPrint; SupInfoPrintType = E_SupInfoPrintType.SupInfoPdfPrint;
vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
SupInfoPrintType = E_SupInfoPrintType.Merge; SupInfoPrintType = E_SupInfoPrintType.Merge;
@ -2347,11 +2385,11 @@ namespace Volian.Print.Library
// Initialize font decrement // Initialize font decrement
float decrement = 2f; float decrement = 2f;
float fontSize = grp[0].IParagraph.Leading; // current font size float fontSize = grp[0].IParagraph.Leading; // current font size
float mpglen = MeasureSupInfoGroupLength(grp, cb,pageLength); // Measure the length of the group of supinfo paragraphs float mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength); // Measure the length of the group of supinfo paragraphs
// If the group does not fit on a page then reduce the font size // If the group does not fit on a page then reduce the font size
if (mpglen > pageLength) if (mpglen > pageLength)
{ {
float newFontSize=fontSize; float newFontSize = fontSize;
// reduce the font size by _Decrement until the entire grouping fits on one page // reduce the font size by _Decrement until the entire grouping fits on one page
while (mpglen > pageLength) // While the measured supinfo group length is greatere than the page length while (mpglen > pageLength) // While the measured supinfo group length is greatere than the page length
{ {
@ -2413,36 +2451,36 @@ namespace Volian.Print.Library
private void ReduceSupInfoGroupFontSize(vlnParagraph pg, float scaler, PdfContentByte cb) private void ReduceSupInfoGroupFontSize(vlnParagraph pg, float scaler, PdfContentByte cb)
{ {
float hBefore = pg.Height;// Save initial paragraph height float hBefore = pg.Height;// Save initial paragraph height
AdjustSupInfoTable(pg, scaler,cb); AdjustSupInfoTable(pg, scaler, cb);
NewSupInfoFixChunks(pg, scaler);// Apply multiplier to font size NewSupInfoFixChunks(pg, scaler);// Apply multiplier to font size
pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing) pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing)
// B2017-112: Don't do the font size change if images. // B2017-112: Don't do the font size change if images.
// B2017-116: Don;t do the font size change for RTF Raw // B2017-116: Don;t do the font size change for RTF Raw
if (pg.ImageText == null && !pg.MyItemInfo.IsRtfRaw) if (pg.ImageText == null && !pg.MyItemInfo.IsRtfRaw)
{
float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height
pg.Height = hAfter; // Save new Height;
pg.YBottomMost += hAfter - hBefore; // Adjust YbottomMost for font size and leading
float hleading = hBefore * scaler; // Calcuate leading change
// If the change in font size effects the paragraph height due to word wrapping save the impact to adjust
// Offsets below
if ((hleading > hAfter + 1 && scaler < 1f) || (hleading < hAfter + 1 && scaler > 1f))
{ {
float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height if (!_AdjustForParagraphShrinkage.ContainsKey(pg.YOffset))
pg.Height = hAfter; // Save new Height;
pg.YBottomMost += hAfter - hBefore; // Adjust YbottomMost for font size and leading
float hleading = hBefore * scaler; // Calcuate leading change
// If the change in font size effects the paragraph height due to word wrapping save the impact to adjust
// Offsets below
if ((hleading > hAfter + 1 && scaler < 1f) || (hleading < hAfter + 1 && scaler > 1f))
{ {
if (!_AdjustForParagraphShrinkage.ContainsKey(pg.YOffset)) _AdjustForParagraphShrinkage.Add(pg.YOffset, hleading - hAfter);
{
_AdjustForParagraphShrinkage.Add(pg.YOffset, hleading - hAfter);
}
} }
} }
else // Adjust the Image Size B2017-112 And B2017-116 }
{ else // Adjust the Image Size B2017-112 And B2017-116
pg.ImageScaler *= scaler; {
pg.Height *= scaler; pg.ImageScaler *= scaler;
pg.Width *= scaler; pg.Height *= scaler;
} pg.Width *= scaler;
float yoBefore = pg.YOffset;// Save the offset before }
float yoAfter = pg.YOffset = NewSupInfoFixOffset(pg, scaler);// Calculate the offset after float yoBefore = pg.YOffset;// Save the offset before
pg.YBottomMost += yoAfter - yoBefore;// Adjust YbottomMost for changes to yOffset float yoAfter = pg.YOffset = NewSupInfoFixOffset(pg, scaler);// Calculate the offset after
pg.YBottomMost += yoAfter - yoBefore;// Adjust YbottomMost for changes to yOffset
foreach (vlnParagraph cpg in pg.ChildrenAbove)// Process Children Above foreach (vlnParagraph cpg in pg.ChildrenAbove)// Process Children Above
ReduceSupInfoGroupFontSize(cpg, scaler, cb); ReduceSupInfoGroupFontSize(cpg, scaler, cb);
foreach (vlnParagraph cpg in pg.ChildrenBelow)// Process Children Below foreach (vlnParagraph cpg in pg.ChildrenBelow)// Process Children Below
@ -2474,9 +2512,9 @@ namespace Volian.Print.Library
// Create lists of heights before and after shrinking sup info // Create lists of heights before and after shrinking sup info
Dictionary<int, float> beforeRowHeight = new Dictionary<int, float>(); Dictionary<int, float> beforeRowHeight = new Dictionary<int, float>();
Dictionary<int, float> afterRowHeight = new Dictionary<int, float>(); Dictionary<int, float> afterRowHeight = new Dictionary<int, float>();
for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0)-1; i++) for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0) - 1; i++)
{ {
beforeRowHeight.Add(i, scaler * (pg.MyGrid.RowTop[i+1] - pg.MyGrid.RowTop[i])); beforeRowHeight.Add(i, scaler * (pg.MyGrid.RowTop[i + 1] - pg.MyGrid.RowTop[i]));
afterRowHeight.Add(i, 0); afterRowHeight.Add(i, 0);
} }
// Adjust font size for each cell. // Adjust font size for each cell.
@ -2484,18 +2522,18 @@ namespace Volian.Print.Library
{ {
float x = cell.MyTable.ColLeft[cell.c1]; float x = cell.MyTable.ColLeft[cell.c1];
float w = cell.MyTable.ColLeft[cell.c2 + 1] - x; float w = cell.MyTable.ColLeft[cell.c2 + 1] - x;
float hBefore = scaler * pg.GetParagraphHeight(cb,cell.MyPara,"",w); float hBefore = scaler * pg.GetParagraphHeight(cb, cell.MyPara, "", w);
foreach (Chunk chk in cell.MyPara.Chunks) foreach (Chunk chk in cell.MyPara.Chunks)
chk.Font.Size = scaler * chk.Font.Size; chk.Font.Size = scaler * chk.Font.Size;
float hAfter = 1.075F * pg.GetParagraphHeight(cb,cell.MyPara,"",w);// 1.075 is a magic number that worked for Ginna. Otherwise decenders overlapped the bottom line of the cell. float hAfter = 1.075F * pg.GetParagraphHeight(cb, cell.MyPara, "", w);// 1.075 is a magic number that worked for Ginna. Otherwise decenders overlapped the bottom line of the cell.
cell.HContent = hAfter; cell.HContent = hAfter;
// Save tthe height after adjusting the font size to account for changes in word wrap. // Save tthe height after adjusting the font size to account for changes in word wrap.
afterRowHeight[cell.r1]=Math.Max(hAfter,afterRowHeight[cell.r1]); afterRowHeight[cell.r1] = Math.Max(hAfter, afterRowHeight[cell.r1]);
} }
for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0)-1; i++) for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0) - 1; i++)
{ {
pg.MyGrid.RowTop[i+1] = scaler * pg.MyGrid.RowTop[i+1];// Adjust for leading pg.MyGrid.RowTop[i + 1] = scaler * pg.MyGrid.RowTop[i + 1];// Adjust for leading
pg.MyGrid.RowTop[i+1] += (afterRowHeight[i]-beforeRowHeight[i]); //Adjust for word wrapping pg.MyGrid.RowTop[i + 1] += (afterRowHeight[i] - beforeRowHeight[i]); //Adjust for word wrapping
} }
} }
} }
@ -2523,11 +2561,11 @@ namespace Volian.Print.Library
private void NewSupInfoFixParts(vlnPrintObject po, float scaler) private void NewSupInfoFixParts(vlnPrintObject po, float scaler)
{ {
if (po.IParagraph == null) return; // B2017-132 check for NULL reference (happend printing Bryon SAMGS with sup info pages) if (po.IParagraph == null) return; // B2017-132 check for NULL reference (happend printing Bryon SAMGS with sup info pages)
// Adjust the font size by the multiplier // Adjust the font size by the multiplier
foreach (Chunk chk in po.IParagraph.Chunks) foreach (Chunk chk in po.IParagraph.Chunks)
chk.Font.Size = scaler * chk.Font.Size; chk.Font.Size = scaler * chk.Font.Size;
po.IParagraph.Leading = scaler * po.IParagraph.Leading;// Apply the multiplier to the leading (line spacing) po.IParagraph.Leading = scaler * po.IParagraph.Leading;// Apply the multiplier to the leading (line spacing)
po.YOffset = NewSupInfoFixOffset(po,scaler);// Adjust the YOffset po.YOffset = NewSupInfoFixOffset(po, scaler);// Adjust the YOffset
} }
/// <summary> /// <summary>
/// Adjust the Font Size /// Adjust the Font Size
@ -2552,7 +2590,7 @@ namespace Volian.Print.Library
_LastBottom = 0; _LastBottom = 0;
_LastOffset = 12;// 24; // account for the Sup Info header (two lines) _LastOffset = 12;// 24; // account for the Sup Info header (two lines)
float fontSize = grp[0].IParagraph.Leading; // current font size float fontSize = grp[0].IParagraph.Leading; // current font size
// For each SupInfo Paragraph calculate length // For each SupInfo Paragraph calculate length
foreach (vlnParagraph pg in grp) foreach (vlnParagraph pg in grp)
{ {
MeasureSupInfoGroupLength(pg, cb);// Measure a SupInfo Paragraph and children MeasureSupInfoGroupLength(pg, cb);// Measure a SupInfo Paragraph and children
@ -2600,7 +2638,7 @@ namespace Volian.Print.Library
} }
supInfoGroups[supInfoGroups.Count - 1].Add(pg); // add paragraph to the last grouping supInfoGroups[supInfoGroups.Count - 1].Add(pg); // add paragraph to the last grouping
} }
return supInfoGroups; return supInfoGroups;
} }
#endregion //ShrinkSupInfoGroupAtATime #endregion //ShrinkSupInfoGroupAtATime
@ -2621,7 +2659,7 @@ namespace Volian.Print.Library
{ {
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf"; string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf";
PdfReader pdfreader = new PdfReader(SupInfoPdfName); PdfReader pdfreader = new PdfReader(SupInfoPdfName);
sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1); sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage + 1);
// F2023-035: WCN - allow for change in left margin for supplemental information pages by // F2023-035: WCN - allow for change in left margin for supplemental information pages by
// setting a value in the DocStyle for the adjustment. When importing the vlnParagraph page // setting a value in the DocStyle for the adjustment. When importing the vlnParagraph page
// use this adjustment (note that page list items are done in VlnSvgPageHelper) // use this adjustment (note that page list items are done in VlnSvgPageHelper)
@ -2641,7 +2679,7 @@ namespace Volian.Print.Library
} }
public void DoFoldoutPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int foldoutindx, bool insertBlankPages) public void DoFoldoutPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int foldoutindx, bool insertBlankPages)
{ {
if (_MyFoldoutSection == null || _MyFoldoutSection.Count==0) return; if (_MyFoldoutSection == null || _MyFoldoutSection.Count == 0) return;
// if the very first page to be output is a 'foldout', treat this as a special case, since // if the very first page to be output is a 'foldout', treat this as a special case, since
// if duplex printing is on, the foldout should always be on the left side, i.e. or behind // if duplex printing is on, the foldout should always be on the left side, i.e. or behind
@ -2667,7 +2705,7 @@ namespace Volian.Print.Library
PdfImportedPage fgPage = null; PdfImportedPage fgPage = null;
try try
{ // read saved foldout page { // read saved foldout page
fgPage = cb.PdfWriter.GetImportedPage(_MyFoldoutReader[foldoutindx],1); fgPage = cb.PdfWriter.GetImportedPage(_MyFoldoutReader[foldoutindx], 1);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -2679,7 +2717,7 @@ namespace Volian.Print.Library
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0); AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0);
foreach (iTextSharp.text.pdf.PdfAnnotation.PdfImportedLink il in _MyFoldoutReader[foldoutindx].GetLinks(1)) foreach (iTextSharp.text.pdf.PdfAnnotation.PdfImportedLink il in _MyFoldoutReader[foldoutindx].GetLinks(1))
{ {
if(!il.IsInternal() ) if (!il.IsInternal())
cb.PdfWriter.AddAnnotation(il.CreateAnnotation(cb.PdfWriter)); cb.PdfWriter.AddAnnotation(il.CreateAnnotation(cb.PdfWriter));
} }
@ -2692,7 +2730,7 @@ namespace Volian.Print.Library
//_MyLog.InfoFormat("DoFoldoutPage {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("DoFoldoutPage {0}", cb.PdfWriter.CurrentPageNumber);
//PrintTextMessage(cb, "Foldout for: " + str, textLayer); //PrintTextMessage(cb, "Foldout for: " + str, textLayer);
NewPage();// Temporary for foldout/16bit-32bit page alignment NewPage();// Temporary for foldout/16bit-32bit page alignment
//_MyLog.InfoFormat("NewPage 8 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 8 {0}", cb.PdfWriter.CurrentPageNumber);
myPageHelper.MySection = saveSect; myPageHelper.MySection = saveSect;
myPageHelper.OnFoldoutPage = false; myPageHelper.OnFoldoutPage = false;
} }
@ -2746,7 +2784,7 @@ namespace Volian.Print.Library
{ {
if (!HasManPagAnnot(ii, "Removed Manual Page Break")) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, "Removed Manual Page Break", null); if (!HasManPagAnnot(ii, "Removed Manual Page Break")) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, "Removed Manual Page Break", null);
sc.Step_NewManualPagebreak = false; // reset the flag that was set in the config sc.Step_NewManualPagebreak = false; // reset the flag that was set in the config
if (sc.Step_SubStepPagebreak) sc.Step_SubStepPagebreak = false; // C2023-018: remove substep page break flags if (sc.Step_SubStepPagebreak) sc.Step_SubStepPagebreak = false; // C2023-018: remove substep page break flags
itm.MyContent.Config = sc.ToString(); itm.MyContent.Config = sc.ToString();
itm.MyContent.DTS = DateTime.Now; itm.MyContent.DTS = DateTime.Now;
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
@ -2873,7 +2911,7 @@ namespace Volian.Print.Library
public iTextSharp.text.Rectangle GetSize(SectionInfo sectInfo, int pageNumber) public iTextSharp.text.Rectangle GetSize(SectionInfo sectInfo, int pageNumber)
{ {
string key = string.Format("{0}.{1}", sectInfo.ItemID, pageNumber); string key = string.Format("{0}.{1}", sectInfo.ItemID, pageNumber);
if(dicSize.ContainsKey(key)) if (dicSize.ContainsKey(key))
return dicSize[key]; return dicSize[key];
return PDFPageSize.UsePaperSize(sectInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files return PDFPageSize.UsePaperSize(sectInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
} }
@ -2881,16 +2919,16 @@ namespace Volian.Print.Library
{ {
dicPage = new Dictionary<string, PdfImportedPage>(); dicPage = new Dictionary<string, PdfImportedPage>();
dicSize = new Dictionary<string, iTextSharp.text.Rectangle>(); dicSize = new Dictionary<string, iTextSharp.text.Rectangle>();
LoadSectionTree(ii); LoadSectionTree(ii);
} }
private void LoadSectionTree(ItemInfo ii) private void LoadSectionTree(ItemInfo ii)
{ {
if (ii.Sections == null) return; // B2021-067 crash on null reference if (ii.Sections == null) return; // B2021-067 crash on null reference
foreach (SectionInfo si in ii.Sections) foreach (SectionInfo si in ii.Sections)
{ {
if (si.IsStepSection) if (si.IsStepSection)
{ {
if(si.Sections != null)LoadSectionTree(si); if (si.Sections != null) LoadSectionTree(si);
} }
else else
{ {
@ -2900,10 +2938,10 @@ namespace Volian.Print.Library
try try
{ {
FileInfo fi = new FileInfo(MyPdfFile); FileInfo fi = new FileInfo(MyPdfFile);
if (fi.Length == 0 ) // B2017-218 Handle invalid word sections 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. 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(si.DisplayNumber + " " + si.DisplayText + " is not valid", "Invalid Word Section", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return; return;
} }
MyReader = MyPdfFile != null ? new PdfReader(MyPdfFile) : null; MyReader = MyPdfFile != null ? new PdfReader(MyPdfFile) : null;
@ -2917,13 +2955,13 @@ namespace Volian.Print.Library
if (!((si.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_WordContentLandscaped) == E_DocStructStyle.DSS_WordContentLandscaped) && rectgl.Height < rectgl.Width) if (!((si.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_WordContentLandscaped) == E_DocStructStyle.DSS_WordContentLandscaped) && rectgl.Height < rectgl.Width)
rectgl = new iTextSharp.text.Rectangle(rectgl.Height, rectgl.Width); rectgl = new iTextSharp.text.Rectangle(rectgl.Height, rectgl.Width);
dicSize.Add(key, rectgl); dicSize.Add(key, rectgl);
//dicSize.Add(key, MyReader.GetPageSizeWithRotation(i)); //dicSize.Add(key, MyReader.GetPageSizeWithRotation(i));
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
if (_MyPromsPrinter.DocReplace == null) if (_MyPromsPrinter.DocReplace == null)
MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Error); 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}", si.ItemID, si.DisplayNumber, si.DisplayText), ex);
} }
} }
@ -2960,3 +2998,4 @@ namespace Volian.Print.Library
// } // }
//} //}
} }

View File

@ -1046,8 +1046,9 @@ namespace Volian.Print.Library
// Calvert Alarms have a special case, center text if the next/previous is not the same type of caution or note. // Calvert Alarms have a special case, center text if the next/previous is not the same type of caution or note.
// Calvert Alarms have a note1 that is a warning. if a regular note preceeded it, this regular note was not centered. // Calvert Alarms have a note1 that is a warning. if a regular note preceeded it, this regular note was not centered.
// F2023-126: Vogtle Alarms - center single line caution/note if more than one type exist off step, added the check for NoteCautionCenterOneAllTypes
bool doAlign = false; bool doAlign = false;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && (MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.IsNote1)) if ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert || MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.NoteCautionCenterOneAllTypes) && (MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.IsNote1))
{ {
bool diffAsPrev = MyItemInfo.MyPrevious == null || (MyItemInfo.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type); bool diffAsPrev = MyItemInfo.MyPrevious == null || (MyItemInfo.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type);
bool diffAsNext = MyItemInfo.NextItem == null || (MyItemInfo.NextItem != null && MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type); bool diffAsNext = MyItemInfo.NextItem == null || (MyItemInfo.NextItem != null && MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type);