C2023-024 Fix Duplicate Print Issue

This commit is contained in:
Paul Larsen 2023-12-27 11:45:43 -05:00
parent 3ad6dea425
commit 041e28b61b

View File

@ -19,7 +19,7 @@ using JR.Utils.GUI.Forms;
namespace Volian.Print.Library
{
public delegate void PromsPrinterStatusEvent(object sender,PromsPrintStatusArgs args);
public delegate void PromsPrinterStatusEvent(object sender, PromsPrintStatusArgs args);
public class PromsPrintStatusArgs
{
private string _MyStatus;
@ -336,7 +336,7 @@ namespace Volian.Print.Library
_MyReaderHelper = new ReaderHelper(this);
_SaveLinks = saveLinks;
// 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>();
_BlankPageText = blankPageText;
_DidAll = didAll;
@ -435,7 +435,7 @@ namespace Volian.Print.Library
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
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();
ForcedPaginations.Clear();
@ -565,7 +565,7 @@ namespace Volian.Print.Library
set
{
_MyContentByte = value;
if(value != null)MyReaderHelper.LoadTree(MyItem);
if (value != null) MyReaderHelper.LoadTree(MyItem);
}
}
public void NewPage()
@ -588,7 +588,7 @@ namespace Volian.Print.Library
//SectionConfig sc = (nextSection ?? currentSection).MyConfig as SectionConfig;
// 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
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");
if (wordMargins)
{
@ -622,7 +622,7 @@ namespace Volian.Print.Library
if (currentSection.IsStepSection)
Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", rct);
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}"
// , currentSection == null ? "" : currentSection.DisplayNumber + " " + currentSection.DisplayText
// , nextSection == null ? "" : nextSection.DisplayNumber + " " + nextSection.DisplayText
@ -682,12 +682,35 @@ namespace Volian.Print.Library
// Console.WriteLine("To {0}.{1} Page: {2}",LastWordSection.DisplayNumber,LastWordSection.DisplayText,_PageCountOfWordSection);
// 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
{
PdfWriter writer = null;
iTextSharp.text.Document document = new iTextSharp.text.Document(rect);
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.
@ -721,6 +744,21 @@ namespace Volian.Print.Library
MyContentByte = writer.DirectContent;
return MyContentByte;
}
catch (Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Error occured when creating Print PDF");
sb.AppendLine();
sb.AppendLine(outputFileName + ".");
sb.AppendLine();
sb.AppendLine("If it is open, close and retry.");
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");
return MyContentByte = null;
}
}
//private string CreateFileName(string procNumber, string sectNumber, string sectTitle)
//{
// return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle));
@ -838,7 +876,7 @@ namespace Volian.Print.Library
// B2023-024 PROMS was using old cached PDF data when printing Word sections.
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))
File.Delete(outputFileName); // delete the temporary FOLDOUT file
}
@ -857,7 +895,7 @@ namespace Volian.Print.Library
bool wordMargins = (sc != null && sc.Section_WordMargin == "Y");
if (wordMargins)
{
string pdfFile =BuildMSWordPDF(si);
string pdfFile = BuildMSWordPDF(si);
try
{
PdfReader reader = new PdfReader(pdfFile);
@ -866,12 +904,12 @@ namespace Volian.Print.Library
catch (Exception ex)
{
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);
}
}
}
PdfContentByte cb = OpenDoc(outputFileName, rct);
PdfContentByte cb = OpenDoc(ref outputFileName, rct);
if (cb == null)
{
ProfileTimer.Pop(profileDepth);
@ -906,7 +944,7 @@ namespace Volian.Print.Library
{
// B2020-115 Calculate maximum available space on a page for figures
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;
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)
@ -961,7 +999,7 @@ namespace Volian.Print.Library
}
x += 72F * VlnSettings.GetCommandFloat("X", 0);
y -= 72F * VlnSettings.GetCommandFloat("Y", 0);
_MyHelper.BackgroundOffset = new PointF(x,y);
_MyHelper.BackgroundOffset = new PointF(x, y);
_MyHelper.BackgroundPageOffset = 0;
}
_MyHelper.WatermarkLayer = _WatermarkLayer;
@ -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,
// 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);
}
@ -1174,9 +1212,9 @@ namespace Volian.Print.Library
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.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);
}
private Placekeeper _MyPlacekeeper = null;
@ -1229,15 +1267,15 @@ namespace Volian.Print.Library
int sectPageCount = 0;
float locEndOfWordDoc = 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
{
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");
// 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
{
@ -1298,7 +1336,7 @@ namespace Volian.Print.Library
OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord);
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;
SectionInfo currentSection = _MyHelper.MySection;
@ -1348,16 +1386,16 @@ namespace Volian.Print.Library
//float y1 = cb.PdfDocument.PageSize.Height ; // 1.8f;
float height = 12 * 1.5F;
// 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));
cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor));
int status = ct.Go();
if(status > 1)
if (status > 1)
_MyLog.WarnFormat("\r\n.-.-.-. Failed to add a PDF destination for {0}", mySection.ShortPath);
}
if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath, pageNumber);
}
if (ii == sectPageCount - 1)
{
@ -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
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.ContainsKey(tmp))
MergedLandscapePages[tmp].Add(_MyHelper.CurrentPageNumber);
@ -1572,7 +1610,7 @@ namespace Volian.Print.Library
inGroup = true;
// B2020-033: for single spacing, add an extra line before a grouping title:
float tmpspc = (float)(tOfC.TofCLineSpacing ?? 1);
if (lastTOCGroupHeading != "" || (firstGroupHeading && tmpspc==1))
if (lastTOCGroupHeading != "" || (firstGroupHeading && tmpspc == 1))
{
yLocation += vlnPrintObject.SixLinesPerInch;
firstGroupHeading = false;
@ -1612,7 +1650,7 @@ 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"
// - 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
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 != "")
tocSecTitle = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle;
@ -1622,7 +1660,7 @@ namespace Volian.Print.Library
//if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData
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);
}
else
@ -1657,7 +1695,7 @@ namespace Volian.Print.Library
if (lnsp > -1) yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line
}
// 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.
{
NewPage();
@ -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
// 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.
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;
//Rtf2Pdf.PdfDebug = true;
Rtf2Pdf.Offset = new PointF(0, 2.5F);
@ -2298,7 +2336,7 @@ namespace Volian.Print.Library
else SupInfoPdfPage.Clear();
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
PdfContentByte cb = OpenDoc(SupInfoPdfName, pageSize);
PdfContentByte cb = OpenDoc(ref SupInfoPdfName, pageSize);
if (cb == null) return;
VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0);
cb.PdfWriter.PageEvent = myPageHelper;
@ -2310,7 +2348,7 @@ namespace Volian.Print.Library
myPageHelper.ChangeBarDefinition = MyChangeBarDefinition;
float yPageStart = yTopMargin;
vlnParagraph._yPageStartForSupInfo = yTopMargin;
SupInfoAjustGroupings(vlnParagraph,cb);
SupInfoAjustGroupings(vlnParagraph, cb);
SupInfoPrintType = E_SupInfoPrintType.SupInfoPdfPrint;
vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
SupInfoPrintType = E_SupInfoPrintType.Merge;
@ -2347,11 +2385,11 @@ namespace Volian.Print.Library
// Initialize font decrement
float decrement = 2f;
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 (mpglen > pageLength)
{
float newFontSize=fontSize;
float newFontSize = fontSize;
// 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
{
@ -2413,7 +2451,7 @@ namespace Volian.Print.Library
private void ReduceSupInfoGroupFontSize(vlnParagraph pg, float scaler, PdfContentByte cb)
{
float hBefore = pg.Height;// Save initial paragraph height
AdjustSupInfoTable(pg, scaler,cb);
AdjustSupInfoTable(pg, scaler, cb);
NewSupInfoFixChunks(pg, scaler);// Apply multiplier to font size
pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing)
// B2017-112: Don't do the font size change if images.
@ -2474,9 +2512,9 @@ namespace Volian.Print.Library
// Create lists of heights before and after shrinking sup info
Dictionary<int, float> beforeRowHeight = 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);
}
// Adjust font size for each cell.
@ -2484,18 +2522,18 @@ namespace Volian.Print.Library
{
float x = cell.MyTable.ColLeft[cell.c1];
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)
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;
// 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] += (afterRowHeight[i]-beforeRowHeight[i]); //Adjust for word wrapping
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
}
}
}
@ -2527,7 +2565,7 @@ namespace Volian.Print.Library
foreach (Chunk chk in po.IParagraph.Chunks)
chk.Font.Size = scaler * chk.Font.Size;
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>
/// Adjust the Font Size
@ -2621,7 +2659,7 @@ namespace Volian.Print.Library
{
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf";
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
// 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)
@ -2641,7 +2679,7 @@ namespace Volian.Print.Library
}
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 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;
try
{ // read saved foldout page
fgPage = cb.PdfWriter.GetImportedPage(_MyFoldoutReader[foldoutindx],1);
fgPage = cb.PdfWriter.GetImportedPage(_MyFoldoutReader[foldoutindx], 1);
}
catch (Exception ex)
{
@ -2679,7 +2717,7 @@ namespace Volian.Print.Library
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0);
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));
}
@ -2873,7 +2911,7 @@ namespace Volian.Print.Library
public iTextSharp.text.Rectangle GetSize(SectionInfo sectInfo, int pageNumber)
{
string key = string.Format("{0}.{1}", sectInfo.ItemID, pageNumber);
if(dicSize.ContainsKey(key))
if (dicSize.ContainsKey(key))
return dicSize[key];
return PDFPageSize.UsePaperSize(sectInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
}
@ -2890,7 +2928,7 @@ namespace Volian.Print.Library
{
if (si.IsStepSection)
{
if(si.Sections != null)LoadSectionTree(si);
if (si.Sections != null) LoadSectionTree(si);
}
else
{
@ -2900,9 +2938,9 @@ namespace Volian.Print.Library
try
{
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);
return;
}
@ -2960,3 +2998,4 @@ namespace Volian.Print.Library
// }
//}
}