Changed NextItem property to use GetNextItem method when printing

Added Profile debug
Added Command-line parameters (/X= and /Y=) to specify the offset used for Compare.
Changed NextItem property to use GetNextItem method when printing.
Remove PrintTimer which has been replaced with ProfileTimer
Added Profile debug
Added code to handle special characters when printing,
Added Profile debug
Changed NextItem property to use GetNextItem method when printing
This commit is contained in:
Rich
2015-01-19 20:56:35 +00:00
parent d501a39a7b
commit 389c6575d0
4 changed files with 151 additions and 39 deletions

View File

@@ -10,6 +10,7 @@ using Itenso.Rtf.Interpreter;
//using Itenso.Rtf.Model;
using Itenso.Rtf.Support;
using Microsoft.Win32;
using Volian.Base.Library;
namespace Volian.Print.Library
{
@@ -115,11 +116,15 @@ namespace Volian.Print.Library
}
public Paragraph Convert()
{
int profileDepth = ProfileTimer.Push(">>>> Rtf2ITextSharp.Convert");
_MyParagraph.Clear();
_MyFont = null;
foreach (IRtfVisual visual in _RtfDoc.VisualContent)
{
visual.Visit(this);
}
//_MyParagraph.SetLeading(0, 1);
ProfileTimer.Pop(profileDepth);
return _MyParagraph;
}
// ----------------------------------------------------------------------
@@ -150,25 +155,34 @@ namespace Volian.Print.Library
switch (visualSpecialChar.CharKind)
{
case RtfVisualSpecialCharKind.Bullet:
_MyParagraph.Add(new Chunk("\u2022"));
break;
case RtfVisualSpecialCharKind.EmDash:
_MyParagraph.Add(new Chunk("\u2014"));
break;
case RtfVisualSpecialCharKind.EmSpace:
_MyParagraph.Add(new Chunk("\u2003"));
break;
case RtfVisualSpecialCharKind.EnDash:
_MyParagraph.Add(new Chunk("\u2013"));
break;
case RtfVisualSpecialCharKind.EnSpace:
_MyParagraph.Add(new Chunk(" "));
break;
case RtfVisualSpecialCharKind.LeftDoubleQuote:
_MyParagraph.Add(new Chunk("\u201C"));
break;
case RtfVisualSpecialCharKind.LeftSingleQuote:
_MyParagraph.Add(new Chunk("\u2018"));
break;
case RtfVisualSpecialCharKind.NonBreakingHyphen:
_MyParagraph.Add(new Chunk("\u2011"));
break;
case RtfVisualSpecialCharKind.NonBreakingSpace:
_MyParagraph.Add(new Chunk("\u00A0"));
break;
case RtfVisualSpecialCharKind.OptionalHyphen:
_MyParagraph.Add(new Chunk("\u00AD"));
break;
case RtfVisualSpecialCharKind.ParagraphNumberBegin:
break;
@@ -177,8 +191,10 @@ namespace Volian.Print.Library
case RtfVisualSpecialCharKind.QmSpace:
break;
case RtfVisualSpecialCharKind.RightDoubleQuote:
_MyParagraph.Add(new Chunk("\u201D"));
break;
case RtfVisualSpecialCharKind.RightSingleQuote:
_MyParagraph.Add(new Chunk("\u2019"));
break;
case RtfVisualSpecialCharKind.Tabulator:
break;
@@ -188,7 +204,12 @@ namespace Volian.Print.Library
}
protected override void DoVisitText(IRtfVisualText visualText)
{
if (visualText.Format.IsHidden) return;
int profileDepth = ProfileTimer.Push(">>>> DoVisitText");
if (visualText.Format.IsHidden)
{
ProfileTimer.Pop(profileDepth);
return;
}
iTextSharp.text.Font font = Volian.Svg.Library.VolianPdf.GetFont(visualText.Format.Font.Name, visualText.Format.FontSize,
(visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) +
(visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0));
@@ -261,7 +282,7 @@ namespace Volian.Print.Library
_MyParagraph.Font = _MyFont;
}
_MyParagraph.Add(chk);
ProfileTimer.Pop(profileDepth);
}
private string ShowSpecialCharacters(string p)