Replaced Rtf2Pdf.FixText with TextForBaseline.FixText
Moved the FixText logic to DisplayText.cs Replaced Rtf2Pdf.FixText with TextForBaseline.FixText
This commit is contained in:
@@ -9,6 +9,7 @@ using Itenso.Rtf.Parser;
|
||||
using Itenso.Rtf.Interpreter;
|
||||
using Itenso.Rtf.Support;
|
||||
using System.IO;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
|
||||
namespace Volian.Print.Library
|
||||
@@ -52,7 +53,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public void Process()
|
||||
{
|
||||
Document document = new Document(PageSize.LETTER);
|
||||
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER);
|
||||
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(FileName, FileMode.Create));
|
||||
document.Open();
|
||||
// Open RTF Document
|
||||
@@ -126,45 +127,6 @@ namespace Volian.Print.Library
|
||||
return (val & _AllowTableScrunching) == val;
|
||||
}
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
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:";
|
||||
@@ -223,7 +185,7 @@ namespace Volian.Print.Library
|
||||
//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));
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine(" {0} {1} {2} {3} \"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai,TextForBaseline.FixText(chk1.Content));
|
||||
//Console.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai, FixText(chk1.Content));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user