I am using Apose.PDF to find and replace text in a PDF document. The document can have some 2000 pages and the operation is taking more than 5 seconds. I am using:
Dim textFragmentAbsorber As Aspose.Pdf.Text.TextFragmentAbsorber = New Aspose.Pdf.Text.TextFragmentAbsorber(find)
pdfDocument.Pages.Accept(textFragmentAbsorber)
Is there a faster way to do this to reduce the search time? Is there a way to tell the search to limit it to just the bottom of the document perhaps?
You can search the text in document at page level in order to reduce the time cost. The code modifications would be as follows:
foreach (Page page in doc.Pages)
{
TextFragmentAbsorber finder = new TextFragmentAbsorber(keyword);
page.Accept(finder);
// Further stuff
}
Furthermore, you can also specify a particular region in PDF Page where text should be looked for. Please follow the instructions give in following article and in case you face any issue, please let us know by sharing a sample PDF document.
As per recommended practice, only one thread should be allocated to one PDF document at a time. However, would you kindly share your sample PDF document along with complete code snippet. We will test the scenario in our environment and address it accordingly.