Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Wrapping of Text when doing Search and Replace

$
0
0
Hello,

I am trying to replace text in PDF files using the following code.  The problem is that the text does not wrap if the line becomes too long due to the replacement text.  Is there a way to handle this?  I have attached sample input and output files to illustrate the problem.

            Document pdfDocument = new Document("input.pdf");
        TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("rinse");
        pdfDocument.Pages.Accept(textFragmentAbsorber);

        TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

        foreach (TextFragment textFragment in textFragmentCollection)
        {
            textFragment.Text = "LONG REPLACEMENT TEXT";
        }

        pdfDocument.Save("output.pdf");



- Sumit

Viewing all articles
Browse latest Browse all 3131

Trending Articles