From ff796c7e1c0cd4bce939ec1fae946581bbfe3339 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 12 Apr 2018 20:33:52 +0000 Subject: [PATCH] C2018-004 logic to print meta file information C2018-009 logic to print PROMS version on PDF pages --- PROMS/Volian.Print.Library/Rtf2Pdf.cs | 113 +++++++++++++++++- .../Volian.Print.Library/VlnSvgPageHelper.cs | 32 ++++- PROMS/Volian.Print.Library/vlnBox.cs | 24 ++++ PROMS/Volian.Print.Library/vlnChangeBar.cs | 2 + PROMS/Volian.Print.Library/vlnMacro.cs | 2 + PROMS/Volian.Print.Library/vlnParagraph.cs | 42 +++---- PROMS/Volian.Print.Library/vlnRNOSeparator.cs | 4 +- PROMS/Volian.Svg.Library/iTextSharp.cs | 31 +++++ 8 files changed, 215 insertions(+), 35 deletions(-) diff --git a/PROMS/Volian.Print.Library/Rtf2Pdf.cs b/PROMS/Volian.Print.Library/Rtf2Pdf.cs index 65ba6a89..3e39217c 100644 --- a/PROMS/Volian.Print.Library/Rtf2Pdf.cs +++ b/PROMS/Volian.Print.Library/Rtf2Pdf.cs @@ -100,7 +100,7 @@ namespace Volian.Print.Library get { int retval = ++TextAtCounter; - //if (InList(retval, 461)) Console.WriteLine("TextAt {0}", retval); + //if (InList(retval, 17)) Console.WriteLine("TextAt {0}", retval); return retval; } } @@ -126,8 +126,101 @@ namespace Volian.Print.Library return (val & _AllowTableScrunching) == val; } public static VlnSplitCharacter mySplitter = new VlnSplitCharacter(); - public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin) + public static string FixText(string str) // C2018-004 create meta file for baseline compares { + StringBuilder sb = new StringBuilder(); + if (str == null)return null; + foreach(char c in str) + { + if (c < '\x1F' || c > '\x7F') + { + int i = (int)c; + switch (i) + { + case '\u000A': + sb.Append("[LF]"); + break; + case '\u00A0': + sb.Append("[HS]"); + break; + case '\u25CF': + sb.Append("[Bullet]"); + break; + case '\u2022': + sb.Append("[SmBullet]"); + break; + case '\u2011': + sb.Append("[NBDash]"); + break; + case '\u00B0': + sb.Append("[Degree]"); + break; + default: + sb.Append(string.Format("[[{0:X}]]", (int)c)); + break; + } + } + else + sb.Append(c); + } + return sb.ToString(); + } + public static string ChunkTextAttributesInfo(Chunk chk1) // C2018-004 create meta file for baseline compares + { + string rtnval = "Atrbs:"; + if (chk1.HasAttributes()) + { + float? subsup = (float?)chk1.Attributes["SUBSUPSCRIPT"]; + if (subsup != null) + { + if (subsup > 0.0) + rtnval += " SUPERSCRIPT |"; + else if (subsup < 0.0) + rtnval += " SUBSCRIPT |"; + } + if (chk1.Attributes["UNDERLINE"] != null) + rtnval += " UNDERLINE |"; + } + if (chk1.Font.BaseFont != null) + { + if (chk1.Font.BaseFont.PostscriptFontName.ToUpper().Contains("BOLD")) + rtnval += " BOLD |"; + if (chk1.Font.BaseFont.PostscriptFontName.ToUpper().Contains("ITALIC")) + rtnval += " ITALICS |"; + } + if (rtnval.Length == 6) + rtnval += " none"; + else + rtnval = rtnval.Substring(0, rtnval.Length - 2); + return rtnval; + } + public static int _lastPageNum = 0; // C2018-004 create meta file for baseline compares + public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin) + { + return TextAt(cb, iParagraph, x, y, width, height, debugText, yBottomMargin, null); + } + public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin, int? itmID) + { + if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares + { + Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber); + _lastPageNum = cb.PdfDocument.PageNumber; + } + if (iParagraph.Chunks.Count > 0) + { + if (itmID == null) + Volian.Base.Library.BaselineMetaFile.WriteLine("TX x={0} Y={1} W={2} H={3}", x, y, width, height); + else + Volian.Base.Library.BaselineMetaFile.WriteLine("TX x={0} Y={1} W={2} H={3} ItmID={4}", x, y, width, height, itmID); + foreach (Chunk chk1 in iParagraph) + { + //Object obj = chk1.Attributes["UNDERLINE"]; + //Console.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, obj != null ? "Underline" : "", FixText(chk1.Content)); + string ctai = ChunkTextAttributesInfo(chk1); + Volian.Base.Library.BaselineMetaFile.WriteLine(" {0} {1} {2} {3} \"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai, FixText(chk1.Content)); + //Console.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai, FixText(chk1.Content)); + } + } // Change the chunks to only split on spaces rather than spaces and hyphens foreach (Chunk chk in iParagraph) { @@ -183,8 +276,13 @@ namespace Volian.Print.Library if (ex == value) return true; return false; } - public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, float yBottommargin, bool hasBorder) + public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, float yBottommargin, bool hasBorder, int itmID) { + if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares + { + Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber); + _lastPageNum = cb.PdfDocument.PageNumber; + } VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; float left = x + Offset.X; @@ -194,6 +292,8 @@ namespace Volian.Print.Library image.ScaleAbsoluteHeight(height); image.SetAbsolutePosition(left, bottom); if (textLayer != null) cb.BeginLayer(textLayer); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("FG left={0} top={1} bottom={2} Height={3} Width={4} ItmID={5}", left, top, bottom, height, width, itmID); cb.AddImage(image); if (hasBorder) { @@ -228,6 +328,11 @@ namespace Volian.Print.Library } public static float GridAt(PdfContentByte cb, vlnTable myGrid, float x, float y, float width, float height, string debugText, float yBottomMargin, bool hasBorder) { + if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares + { + Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber); + _lastPageNum = cb.PdfDocument.PageNumber; + } //VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; // RHM20150507 Table Scrunch //PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; // RHM20150507 Table Scrunch float left = x + Offset.X; @@ -237,6 +342,8 @@ namespace Volian.Print.Library ColumnText myColumnText = new ColumnText(cb); myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin); //if (textLayer != null) cb.BeginLayer(textLayer); // RHM20150507 Table Scrunch + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("GD left={0} top={1} right={2} bottom={3} Mygrid.ItmID={4}", left, top + GridTopAdjust, right, bottom, myGrid.ItemID); myGrid.ToPdf(myColumnText, left, top + GridTopAdjust); //if (textLayer != null) cb.EndLayer(); // RHM20150507 Table Scrunch return bottom; diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index f95830c2..16934a4c 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -473,6 +473,8 @@ i = 0; cb.SetColorStroke(new Color(PrintOverride.SvgColor)); if (MySection.MyDocStyle.CLineWidth != null && MySection.MyDocStyle.CLineWidth != 0) cb.SetLineWidth((float)MySection.MyDocStyle.CLineWidth); //cb.SetColorStroke(lineColor); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("HorzLn X1={0} Y={1} X2={2}", left, yoff, right); cb.MoveTo(left, yoff); cb.LineTo(right, yoff); cb.Stroke(); @@ -511,6 +513,8 @@ i = 0; { foreach (Gap gap in MyGaps) { + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("CntrLn X={0} Top={1} Btm={2}", xLoc, ylast, gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier); cb.LineTo(xLoc, gap.YTop); cb.MoveTo(xLoc, gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier); ylast = gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier; @@ -521,8 +525,12 @@ i = 0; // the end message for EOP procedure 15.2 was at the very bottom of the page. // the remaining center line was drawn past the page boarder. there was no need // to print it for cases like that - if (ylast > yBottom) + if (ylast > yBottom) + { + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("CntrLn X={0} Top={1} Btm={2}", xLoc, ylast, yBottom); cb.LineTo(xLoc, yBottom); + } cb.Stroke(); if (PageListLayer != null) cb.EndLayer(); cb.RestoreState(); @@ -1249,8 +1257,10 @@ i = 0; public Dictionary PgLogicals; private void AddPageListItems(Volian.Svg.Library.Svg mySvg, VEPROMS.CSLA.Library.PageStyle pageStyle, VEPROMS.CSLA.Library.SectionInfo section, bool forceLoad) { - //Console.WriteLine("{0}", section.ActiveFormat.Name); - //Console.WriteLine("{0} pgstyle {1} section", pageStyle.Name,section.DisplayText); + SectionConfig sc = section.MyConfig as SectionConfig; + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("SecNum=\"{0}\" SecTitle=\"{1}\" DocStyle=\"{2}\" Format=\"{3}\" ItemID={4}", section.DisplayNumber, section.DisplayText, section.MyDocStyle.Name, sc.FormatSelection, section.ItemID); + Volian.Base.Library.BaselineMetaFile.WriteLine(" Pagination=\"{0}\" MSWordPgCnt={1} NumPages={2} WordMargin={3}", sc.Section_Pagination, section.MSWordPageCount, (string.IsNullOrEmpty(sc.Section_NumPages)) ? "0" : sc.Section_NumPages, (string.IsNullOrEmpty(sc.Section_WordMargin))?"N":sc.Section_WordMargin); if (PgLogicals == null) PgLogicals = new Dictionary(); else PgLogicals.Clear(); @@ -1260,8 +1270,8 @@ i = 0; SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate; if (section.IsStepSection && section.MyPrevious != null && section.MyPrevious.IsStepSection && section.MyContent.Number.ToUpper() != "FOLDOUT") { - SectionConfig sc = section.MyConfig as SectionConfig; - sPag = sc.Section_Pagination; + SectionConfig sc1 = section.MyConfig as SectionConfig; + sPag = sc1.Section_Pagination; } SvgGroup svgGroup = new SvgGroup(); @@ -1403,7 +1413,11 @@ i = 0; SvgText st = new SvgText(new System.Drawing.PointF(300, 300), "Non-printing {PAGE}", VE_Font.GetWinSysFont("Arial", 10), System.Drawing.Color.Black); svgGroup.Add(st); } - if (svgGroup.Count>0) mySvg.Add(svgGroup); + // C2018-004 create meta file for baseline compares + if (svgGroup.Count > 0) + mySvg.Add(svgGroup); + else + Volian.Base.Library.BaselineMetaFile.WriteLine("No Pagelist Information"); } private string ROLookup(string accpageid, string multiid, string deflt) { @@ -2486,6 +2500,8 @@ i = 0; svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT); if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, Rtf2Pdf.FixText(svgText.Text)); return svgText; } private SvgPart PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, float yOffset) @@ -2527,6 +2543,8 @@ i = 0; svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); svgText.Y = new SvgMeasurement((float)(yOffset + pageItem.Row ?? 0), E_MeasurementUnits.PT); if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, Rtf2Pdf.FixText(svgText.Text)); return svgText; } private SvgPart PageItemToSvgText(string token, float row, float col, E_Justify just, VE_Font font, string text, SectionInfo MySection) @@ -2568,6 +2586,8 @@ i = 0; svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT); if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, Rtf2Pdf.FixText(svgText.Text)); return svgText; } private static List _MissingTokens = new List(); diff --git a/PROMS/Volian.Print.Library/vlnBox.cs b/PROMS/Volian.Print.Library/vlnBox.cs index 0b280578..f1f5331f 100644 --- a/PROMS/Volian.Print.Library/vlnBox.cs +++ b/PROMS/Volian.Print.Library/vlnBox.cs @@ -122,10 +122,14 @@ namespace Volian.Print.Library lheight += (bottom - yBottomMargin); bottom = yBottomMargin; } + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BX Lf={0} Bt={1} W={2} H={3}", left, bottom, right - left, lheight * MyPageHelper. YMultiplier); cb.Rectangle(left, bottom, right - left, lheight * MyPageHelper.YMultiplier); } else if (DefBox == vlnBox.DOUBLEboxHLS) { + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BXHLS Lf={0} Rt={1} Tp={2} Bt={3}", left, (float)MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth,top, bottom); DrawDoubleHlsBox(cb, top, bottom, left, (float)MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth); } else @@ -137,11 +141,15 @@ namespace Volian.Print.Library case BoxThin: lineThickness = .6F; cb.SetLineWidth(lineThickness); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BXThin Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); break; case BoxThick: lineThickness = 6; cb.SetLineWidth(lineThickness); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BXThick Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); break; case BoxDouble: @@ -150,18 +158,28 @@ namespace Volian.Print.Library lineThickness = .6F; cb.SetLineWidth(lineThickness / 2F); // outer rectangle (rectangle's are defined as x,y,w,h) + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BX3lns1 Lf={0} Bt={1} W={2} H={3}", left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); // inner rectangle + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BX3lns2 Lf={0} Bt={1} W={2} H={3}", left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); // outer outer most + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BX3lns3 Lf={0} Bt={1} W={2} H={3}", left + llxOffset - lineThickness * 4F, bottom - lineThickness * 3.5F, right - left + lineThickness * 8, (Height + lineThickness * 7) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset - lineThickness * 4F, bottom - lineThickness * 3.5F, right - left + lineThickness * 8, (Height + lineThickness * 7) * MyPageHelper.YMultiplier); break; } lineThickness = .6F; cb.SetLineWidth(lineThickness); // outer rectangle (rectangle's are defined as x,y,w,h) + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BX2lns1 Lf={0} Bt={1} W={2} H={3}", left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); // inner rectangle + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BX2lns2 Lf={0} Bt={1} W={2} H={3}", left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); break; case BoxFPLNote: @@ -169,6 +187,8 @@ namespace Volian.Print.Library cb.SetLineWidth(lineThickness); float[] linePattern = { 6, 1.75F, 2.5F, 1.75F }; cb.SetLineDash(linePattern,3); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BXFPLNt Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom + (lineThickness / 2) - 1, right - left, (2 + Height - lineThickness) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2) -1, right - left, (2 + Height - lineThickness) * MyPageHelper.YMultiplier); break; case BoxFPLCaution: @@ -176,6 +196,8 @@ namespace Volian.Print.Library cb.SetLineWidth(lineThickness); // use a Y adjustment (top & bottom) to make the caution box match the 16bit output. float YbxAdjust = 6.5F; + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BXFPLCn Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom - YbxAdjust + (lineThickness / 2), right - left, (Height - lineThickness + 2 * YbxAdjust) * MyPageHelper.YMultiplier); cb.Rectangle(left + llxOffset, bottom - YbxAdjust + (lineThickness / 2), right - left, (Height - lineThickness + 2*YbxAdjust) * MyPageHelper.YMultiplier); break; case BoxAsterisk: @@ -186,6 +208,8 @@ namespace Volian.Print.Library case BoxLineTopBottom: // fnp note box lineThickness = .6f; cb.SetLineWidth(lineThickness); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("BXFNPNt Lf={0} Rt={1} Tp={2} Bt={3}", left + llxOffset, right, top, bottom); cb.MoveTo(left + llxOffset, bottom); cb.LineTo(right, bottom); cb.MoveTo(left + llxOffset, top); diff --git a/PROMS/Volian.Print.Library/vlnChangeBar.cs b/PROMS/Volian.Print.Library/vlnChangeBar.cs index 6fc4a870..cc2ee5e6 100644 --- a/PROMS/Volian.Print.Library/vlnChangeBar.cs +++ b/PROMS/Volian.Print.Library/vlnChangeBar.cs @@ -182,6 +182,8 @@ namespace Volian.Print.Library // reset the YOffset if up too high before printing the change bar if (topMost != null) YOffset = Math.Min(YOffset, (float)topMost); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("ChgBar X1={0} Y1={1} X2={2} Y2={3} ID={4}", XOffset + xAdj, YOffset - yAdj, XOffset + xAdj, YChangeBarBottomExtend - yAdj - 1, MyParent.MyItemInfo.ItemID); cb.MoveTo(XOffset + xAdj, YOffset - yAdj); // combination yStart and YOffset cb.LineTo(XOffset + xAdj, YChangeBarBottomExtend - yAdj - 1); cb.Stroke(); diff --git a/PROMS/Volian.Print.Library/vlnMacro.cs b/PROMS/Volian.Print.Library/vlnMacro.cs index ba8d73f0..cfbe67de 100644 --- a/PROMS/Volian.Print.Library/vlnMacro.cs +++ b/PROMS/Volian.Print.Library/vlnMacro.cs @@ -37,6 +37,8 @@ namespace Volian.Print.Library PrintOverride.SvgColor = PrintOverride.TextColor == System.Drawing.Color.Empty ? System.Drawing.Color.Black : PrintOverride.TextColor; if (MyPageHelper != null && MyPageHelper.MySvg != null && MacroDef != null) { + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("MC X={0} Y={1} {2}", XOffset - MyPageHelper.MySvg.LeftMargin, yLocation, MacroDef); // PageList items are located with respect to the left margin, macros are not. MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset - MyPageHelper.MySvg.LeftMargin, yLocation, cb); } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index a43636f6..951f6241 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -949,7 +949,7 @@ namespace Volian.Print.Library float retval = yLocation; if (MyItemInfo.IsRtfRaw) { - retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin); + retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin, MyItemInfo.ItemID); // C2018-004 ItemID for create meta file for baseline compares return retval; } @@ -1073,7 +1073,7 @@ namespace Volian.Print.Library //if (MyItemInfo.InList(39048)) Console.WriteLine("Here"); } MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); - retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin); + retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin, MyItemInfo.ItemID); // C2018-004 ItemID for create meta file for baseline compares ProfileTimer.Pop(profileDepth); if (retval == 0) // problem occurred - paragraph was not able to be printed on page { // pagination logic needs to be fixed. @@ -1312,7 +1312,7 @@ namespace Volian.Print.Library // B2017-241 Adjust Bottom Message Location for the figure MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); // B2017-112 Adjust Image Size by Scaler (Used for Facing Pages - Sup Info) - retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier * ImageScaler, Height * MyPageHelper.YMultiplier * ImageScaler, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless")); + retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier * ImageScaler, Height * MyPageHelper.YMultiplier * ImageScaler, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"), MyItemInfo.ItemID); // C2018-004 added ItemID for create meta file for baseline compares } catch { @@ -1367,7 +1367,7 @@ namespace Volian.Print.Library } // B2017-241 Adjust Bottom Message Location for the figure MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); - retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless")); + retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"), MyItemInfo.ItemID); } } // The following code was added to fix B2016-219 (for VCS, the centerline drew through a figure). The 'top' value was taken from the code @@ -1412,20 +1412,25 @@ namespace Volian.Print.Library { ItemInfo ii = (ItemInfo)MyItemInfo.MyActiveSection; int indx = (int)MyItemInfo.MyActiveSection.MyDocStyle.IndexOtherThanFirstPage; + bool reassignedDocStyle = false; // C2018-004 create meta file for baseline compares foreach (DocStyle ds in ii.ActiveFormat.PlantFormat.DocStyles.DocStyleList) { if (ds.Index == indx) { + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("Reset DocStyle to \"{0}\"",ds.Name); MyItemInfo.MyActiveSection.MyDocStyle = ds; MyPageHelper.MySection = MyItemInfo.MyActiveSection as SectionInfo; MyPageHelper.MySection.MyDocStyle = ds; - MyPageHelper.ResetSvg(); + //MyPageHelper.ResetSvg(); this is done when MyPageHelper.MySection is assigned - no need to do again. + reassignedDocStyle = true; // C2018-004 create meta file for baseline compares break; } } MyPageHelper.DidFirstPageDocStyle = true; if (DebugPagination.IsOpen) DebugPagination.WriteLine("ResetDocStyleAndValues"); - MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection; + if (!reassignedDocStyle) // C2018-004 create meta file for baseline compares + MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection; yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin; yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength); } @@ -1676,9 +1681,7 @@ namespace Volian.Print.Library } else { - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + MyPromsPrinter.InsertBlankPage(cb); } } } @@ -1746,9 +1749,7 @@ namespace Volian.Print.Library // preceeding foldout. if (MyItemInfo.FoldoutIndex() <= -1) { - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + MyPromsPrinter.InsertBlankPage(cb); //_MyLog.InfoFormat("NewPage 10 blank {0}", cb.PdfWriter.CurrentPageNumber); } } @@ -1859,9 +1860,7 @@ namespace Volian.Print.Library MyPromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.MyHLS.FoldoutIndex(), false); // temporary foldout else if (PromsPrinter.MyFoldoutReader.Count > 0 && MyPageHelper.MyPromsPrinter.InsertBlankPages) { - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + MyPromsPrinter.InsertBlankPage(cb); _MyLog.InfoFormat("NewPage Break within step blank {0}", cb.PdfWriter.CurrentPageNumber); } if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) @@ -1873,9 +1872,7 @@ namespace Volian.Print.Library } else { - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + MyPromsPrinter.InsertBlankPage(cb); } } // if there is a 'container vlnbox' around the HLS, flag that the drawn box must also break: @@ -2016,9 +2013,7 @@ namespace Volian.Print.Library { // insert a blank page if this step section had a foldout associated and the checkbox // on the print dialog, to add blank pages, is checked - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + MyPromsPrinter.InsertBlankPage(cb); //_MyLog.InfoFormat("NewPage 12 lpi blank {0}", cb.PdfWriter.CurrentPageNumber); } // See comments under case 0 explaining supinfo/facing page processing. @@ -2032,9 +2027,7 @@ namespace Volian.Print.Library } else { - MyPageHelper.OnBlankPage = true; - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - MyPromsPrinter.NewPage(); + MyPromsPrinter.InsertBlankPage(cb); } } if (MyItemInfo.MyDocStyle.LandscapePageList) @@ -2270,7 +2263,6 @@ namespace Volian.Print.Library ProfileTimer.Pop(profileDepth); return yPageStart; } - private bool IsPrintedStepItemForSupInfo() { bool printedMySectTitle = true; diff --git a/PROMS/Volian.Print.Library/vlnRNOSeparator.cs b/PROMS/Volian.Print.Library/vlnRNOSeparator.cs index 4a3a2dbc..a25c2c5d 100644 --- a/PROMS/Volian.Print.Library/vlnRNOSeparator.cs +++ b/PROMS/Volian.Print.Library/vlnRNOSeparator.cs @@ -66,7 +66,9 @@ namespace Volian.Print.Library iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideChangeBarColor(System.Drawing.Color.Black)); cb.SetColorStroke(lineColor); cb.SetLineWidth(.5F); - cb.MoveTo(XOffset/* + xAdj */, yLocation-7); + // C2018-004 create meta file for baseline compares + Volian.Base.Library.BaselineMetaFile.WriteLine("RNOSepLn X1={0} Y1={1} X2={2} Y2={3}", XOffset, yLocation - 7, XOffset + XLength, yLocation - 7); + cb.MoveTo(XOffset/* + xAdj */, yLocation - 7); cb.LineTo(XOffset + XLength, yLocation-7); cb.Stroke(); if (textLayer != null) cb.EndLayer(); diff --git a/PROMS/Volian.Svg.Library/iTextSharp.cs b/PROMS/Volian.Svg.Library/iTextSharp.cs index 7fd8484a..3f0a2deb 100644 --- a/PROMS/Volian.Svg.Library/iTextSharp.cs +++ b/PROMS/Volian.Svg.Library/iTextSharp.cs @@ -983,6 +983,18 @@ namespace Volian.Svg.Library get { return _Watermark; } set { _Watermark = value; } } + private PdfLayer _PROMSVersionLayer; //C2018-009 print PROMS version + public PdfLayer PROMSVersionLayer + { + get { return _PROMSVersionLayer; } + set { _PROMSVersionLayer = value; } + } + private string _PROMSVersion = string.Empty; + public string PROMSVersion + { + get { return _PROMSVersion; } + set { _PROMSVersion = value; } + } private bool _DoZoomOMatic = false; public bool DoZoomOMatic { @@ -1061,6 +1073,7 @@ namespace Volian.Svg.Library DrawBackground(writer.DirectContentUnder); DrawPageList(writer.DirectContent); DrawWatermark(writer.DirectContent); + DrawPROMSVersion(writer.DirectContent); //C2018-009 print PROMS version if (DoZoomOMatic) DrawZoomOMatic(writer.DirectContent); } CurrentPageNumber++; @@ -1074,6 +1087,7 @@ namespace Volian.Svg.Library DrawBackground(writer.DirectContentUnder); DrawPageList(writer.DirectContent); DrawWatermark(writer.DirectContent); + DrawPROMSVersion(writer.DirectContent); //C2018-009 print PROMS version if (DoZoomOMatic) DrawZoomOMatic(writer.DirectContent); CurrentPageNumber++; } @@ -1169,6 +1183,23 @@ namespace Volian.Svg.Library if (_WatermarkLayer != null) cb.EndLayer(); cb.RestoreState(); } + //C2018-009 print PROMS version + private void DrawPROMSVersion(PdfContentByte cb) + { + cb.SaveState(); + string text = PROMSVersion; + float textBase =cb.PdfDocument.Top + 19; + float textLeft = cb.PdfDocument.Right - 15; + if (_PROMSVersionLayer != null) cb.BeginLayer(_PROMSVersionLayer); + cb.BeginText(); + cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 6f); + cb.SetTextMatrix(textLeft, textBase); + cb.SetColorFill(new iTextSharp.text.Color(System.Drawing.Color.Indigo)); + cb.ShowText(text); + cb.EndText(); + if (_PROMSVersionLayer != null) cb.EndLayer(); + cb.RestoreState(); + } private void DrawPageList(PdfContentByte cb) { if (_MySvg != null)