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

Free Support Forum - aspose.com

Text replace WITH line wrap

What is the correct way to replace text placeholders, and have the words wrap correctly after a line break? Imagine inserting a long piece of text in the place of some placeholder.


Hi Rene,

Thanks for using our products.

Kindly check the following documentation links for details and code snippets as per your requirement.

Working with Text

Working with Text (Facades)

Please do let us know if you need any further assistance.

Thanks & Regards,

Yes I have the documentation, but I can’t specify wrapmode for textfragmentabsorber right?

The Java version can do this:

//create PdfContentEditor object and open PDF file
PdfContentEditor pdfEditor = new PdfContentEditor();
//set wordwrap mode for text replacement
//replace short text with longer string
pdfEditor.replaceText(“old text here”, new longer text string goes here. the wordwrap will be applied on this.”);
//save output PDF file

How to do this with the .Net version?

Hi Rene,

Thank you for sharing the feedback, I am very sorry to share with you that the WordWrap property is not directly available in Aspose.PDF for .NET at the time of replacing text. However, this property is available at the time of adding text in an existing PDF. For more details, please visit: Add Text in an Existing PDF File (Facades).

As a workaround, you can replace text with space or empty string before adding the new text using this property or you can extract text before adding the new text using this functionality.

Moreover, to exactly replicate your issue at our end, we would appreciate, if you create a sample application and post here to show us the issue. This will help us to regenerate the issue and get the cause of the issue soon.

We apologize for your inconvenience.

Thanks & Regards,