Free Support Forum - aspose.cloud

How to find text with page number in PDF document using Aspose.PDF REST API

Support,
Is there a best way/approach to search for a text string in PDF documents and obtain the Page Number using REST API’s? I am then using the page number as the “from” field for the /split operation.

@intelepeer

Thank you for contacting Aspose Support.

We are offering search feature in our Native APIs but not in Cloud APIs. Please check Aspose.PDF API Reference guide for a complete list of REST APIs.

We have logged the feature request (PDFCLOUD-259) for our Development team to provide PDF search functionality in REST APIs. We will update you here as soon this feature is implemented.

1 Like

@intelepeer

We have already implemented your requested feature. Please find sample C# sample code as following and check GetText API method for more details.

var textResponce = pdfApi.GetText("<input_file_name>", 0, 0, 2000, 2000, new List<string>() { "Search text" }, null, true, "<folder_on_storage>");
        foreach (var item in textResponce.TextOccurences.List)
        {
            Console.WriteLine($"Search text on the page {item.Page}");
        }