We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text paragraph missing characters when string added has hyphens

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!

@bvk

We managed to replicate the issue in our environment with latest version of the API i.e. 20.8 and logged it under the ticket ID PDFNET-48647 in our issue management system. We will further check it in details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.