Hi,
I noticed when creating a text paragraph with word wrapping, if the text applied has hyphens in it, part of the text can go missing on the saved file. In my example below when adding a paragraph with the wrapped text “Te-st-Te-xt”, multiple characters get trimmed in the paragraph, and it is no longer viewed by pdf as one text string (which in turn makes it unsearchable).
Sample code:
using (var pdf = new Document(@"BlankPdf.pdf"))
{
var paragraph = new TextParagraph
{
Rectangle = new Rectangle(100, 100, 125, 200),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
FormattingOptions = new TextFormattingOptions(TextFormattingOptions.WordWrapMode.ByWords)
};
var fragment = new TextFragment("Te-st-Te-xt");
fragment.TextState.FontSize = 20;
paragraph.AppendLine(fragment);
var textBuilder = new TextBuilder(pdf.Pages[1]);
textBuilder.AppendParagraph(paragraph);
pdf.Save(@"ParagraphWrapWithHyphens.pdf");
}
Sample file attached below (although it’s just a blank pdf)
BlankPdf.zip (1.6 KB)
Thanks!