Hi,
Hi Rajeev,
//open document<o:p></o:p>
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("Input.pdf");
//create TextAbsorber object to find all instances of the input search phrase
//
com.aspose.pdf.TextFragmentAbsorber textFragmentAbsorber = new com.aspose.pdf.TextFragmentAbsorber("(?<=starting word)(.*?)(?=ending word)",new TextSearchOptions(true));
//from+".*"+till,new TextSearchOptions(true));
//accept the absorber for first page of document
pdfDocument.getPages().accept(textFragmentAbsorber);
//get the extracted text fragments into collection
com.aspose.pdf.TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments();
//loop through the Text fragments
for(com.aspose.pdf.TextFragment textFragment : (Iterable)textFragmentCollection)
{
System.out.print(textFragment.getText());
}
Please feel free to contact us for any further assistance.
Best Regards,
Hi Tilal,
Thanks for your response. I tried executing the code and it works fine when the start and end is on the same page. The scenario I am testing will have the start and end on separate pages.
Is it that I have to use multiple TextFragmentAbsorber or is there a way to have TextFragmentAbsorber accepted across multiple pages.
Regards,
Hi Rajeev,
Hi,
Hi Rajeev,