Replaced Rtf2Pdf.FixText with TextForBaseline.FixText
Moved the FixText logic to DisplayText.cs Replaced Rtf2Pdf.FixText with TextForBaseline.FixText
This commit is contained in:
parent
7a0edda568
commit
601b4edfb7
@ -1371,7 +1371,7 @@ namespace Volian.Print.Library
|
||||
foreach (Chunk chk1 in MyPara.Chunks)
|
||||
{
|
||||
string ctai = Rtf2Pdf.ChunkTextAttributesInfo(chk1);
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai, Rtf2Pdf.FixText(chk1.Content));
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai, TextForBaseline.FixText(chk1.Content));
|
||||
}
|
||||
// B2018-003 - Adjust Leading for 7LPI if necessary
|
||||
MyPara.SetLeading(MyPara.TotalLeading * _MyPageHelper.YMultiplier, 0);
|
||||
|
@ -1119,13 +1119,10 @@ namespace Volian.Print.Library
|
||||
float yoff = 0;
|
||||
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
|
||||
// C2018-004 create meta file for baseline compares
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine("WD Hight={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff);
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber);
|
||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff);
|
||||
if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
|
||||
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
||||
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0:D6},'{1}',{2}",
|
||||
// _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
||||
|
||||
}
|
||||
if (ii == sectPageCount - 1)
|
||||
{
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -2501,7 +2501,7 @@ i = 0;
|
||||
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));
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, TextForBaseline.FixText(svgText.Text));
|
||||
return svgText;
|
||||
}
|
||||
private SvgPart PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, float yOffset)
|
||||
@ -2544,7 +2544,7 @@ i = 0;
|
||||
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));
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, TextForBaseline.FixText(svgText.Text));
|
||||
return svgText;
|
||||
}
|
||||
private SvgPart PageItemToSvgText(string token, float row, float col, E_Justify just, VE_Font font, string text, SectionInfo MySection)
|
||||
@ -2587,7 +2587,7 @@ i = 0;
|
||||
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));
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, TextForBaseline.FixText(svgText.Text));
|
||||
return svgText;
|
||||
}
|
||||
private static List<string> _MissingTokens = new List<string>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user