C2018-004 logic to print meta file information
C2018-009 logic to print PROMS version on PDF pages
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user