This short tutorial explains how to extract text from PDF document with C# REST API. You will learn to extract text out of PDF with C# .NET-based API using a .NET-based Cloud SDK. It demonstrates the complete process by sharing a sample code for reading and displaying the PDF text.
Prerequisite
- Create an account API credentials extract text from PDF
- Download Aspose.PDF Cloud SDK for Dotnet to read a PDF file
- Setup C# project with the above SDK for fetching text
Steps to Extract PDF Text with C# Low Code API
- Configure the PdfApi by providing the application key and SID to read the PDF file
- Upload the source PDF file for extracting the text
- Call the GetText() method upon successful uploading of the source PDF file
- Set the rectangular area of the page from which text is to be fetched on all the pages
- Parse through all the occurrences of the text in the API response and display the text
These steps entail the process to read PDF text with C# RESTful Service. Load the PDF file into the Cloud storage and call the GetText() method to fetch all occurrences of the text from all the pages in the loaded PDF file from the specified rectangle on the page. Praise through all the occurrences in the response and display page number and text.
Code to Grab Text from PDF with C# REST Interface
This code demonstrates the process to retrieve text from PDF with C# REST Interface. The rectangular area consists of the lower left x and y position and the upper right x and y position within which you want to fetch the text. If you need to fetch text from a single page, use the GetPageText() method that requires a page number as an additional argument to select the page.
This article has taught us to read the PDF file without using any PDF reading software installed on your system. If you want to count the number of words in a PDF file, refer to the article on Count words in PDF document with C# REST API.