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

Want to replace Text in PDF File.

$
0
0
Hi,

We are using following code to determine the curly braces in the pdf document.
This is required as we need to replace the text between the curly braces.

       TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("{(.*?)}"); //like 1999-2000
       TextSearchOptions textSearchOptions = new TextSearchOptions(true);
       textFragmentAbsorber.TextSearchOptions = textSearchOptions;
       pdfDocument.Pages.Accept(textFragmentAbsorber);
       TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
        //loop through the fragments
        foreach (TextFragment textFragment in textFragmentCollection)
        {
            Console.WriteLine("Text : {0} ", textFragment.Text);
        }


This works as expected when the open and close curly braces ({}) are in same line in cell of the table.
If they wrap in the cell, the code is not able to identify the close part of curly braces.

Attached is the sample document for your reference.

The code works for the first row, but does not work for the second row in the attached document

Viewing all articles
Browse latest Browse all 3131

Trending Articles