Convert Hard hyphens to soft hyphens so that the PDF can be searched for hyphens.
Use the ISplitCharacter Interface to treat soft hyphens as non-breaking hyphens (only word wrap on spaces)
This commit is contained in:
@@ -84,6 +84,18 @@ namespace Volian.Print.Library
|
||||
get { return _Rtf; }
|
||||
set { _Rtf = value; }
|
||||
}
|
||||
public class VlnSplitCharacter : ISplitCharacter
|
||||
{
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
||||
{
|
||||
return (cc[current] == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(char c)
|
||||
{
|
||||
return (c == ' ');
|
||||
}
|
||||
}
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
iTextSharp.text.Paragraph _IParagraph;
|
||||
public iTextSharp.text.Paragraph IParagraph
|
||||
{
|
||||
@@ -112,7 +124,7 @@ namespace Volian.Print.Library
|
||||
get
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.Height");
|
||||
if (_Height == 0)
|
||||
if (_Height == 0)
|
||||
_Height = GetParagraphHeight(MyContentByte, IParagraph, Width);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return _Height;
|
||||
@@ -377,6 +389,16 @@ namespace Volian.Print.Library
|
||||
para.IndentationLeft = chkW;
|
||||
para.FirstLineIndent = -chkW;
|
||||
}
|
||||
// Change the chunks to only split on spaces rather than spaces and hyphens
|
||||
foreach (Chunk chk in para)
|
||||
{
|
||||
if (chk.Attributes==null || !chk.Attributes.ContainsKey("NoSplit"))
|
||||
{
|
||||
if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable();
|
||||
chk.SetSplitCharacter(mySplitter);
|
||||
chk.Attributes.Add("NoSplit", false);
|
||||
}
|
||||
}
|
||||
return para;
|
||||
}
|
||||
public static float CalculateHangingIndent(string rtf)
|
||||
|
Reference in New Issue
Block a user