Free Support Forum - aspose.com

Searching for some Text in PDF and returning the Page Number

Hello,


Could anyone help me in searching for some text in existing PDF file and returning the Page number where this text is found???

I am using PDF Kit.

Any ideas please share it.

Thank you
Yadav

Hi Yadav,

At the moment, Aspose.Pdf.Kit doesn’t provide any direct feature to return the page number where the text is found. We have already logged such a feature request as PDFKITNET-19945 in our issue tracking system. You’ll be updated as soon as it is supported.

However, in the meanwhile, you can write some additional code and use the existing functionality to achieve this goal. You may use PdfExtractor class to extract text from individual pages and find the particular string in the extracted text. Along the way, you may keep track of the page numbers and in case some matching text is found, you can return the page number.

I hope this helps. If you find any further questions, please do let us know.
Regards,