How to Read or Extract Text from PDF PlatoBlockchain Data Intelligence. Vertical Search. Ai.

How to Read or Extract Text from PDF

How to Read or Extract Text from PDF

If your PDFs deal with invoices, receipts, passports or driver's licenses, check out Nanonets online OCR or PDF text extractor to extract text from PDF documents for free. Click below to learn more about Nanonets PDF scraper.


Business processes often require you to pull text from PDF documents. PDFs are  tamper-proof, secure, and the most preferred format for exchanging data and information; but they are unfortunately not editable.

If you opt to manually extract text or data from a PDF file to create a report or make a presentation, it could take a lot of time! Reading text from PDF files is often necessary as part of common document-based workflows.

Most solutions that can efficiently read text from PDFs (other than PDF parsers) today leverage OCR (Optical Character Recognition) capabilities. OCR technology can be used to identify & extract  text from images, PDFs & other non editable file formats. Depending on the scale and complexity of the PDF documents at hand, you might require varied levels of OCR capabilities; for example you could even extract tables from PDF documents.

Online PDF converters or PDF extraction tools can extract text from small PDF documents with simple formatting. But if you have a large quantity of documents with complicated formatting, tables, graphs and images, you will require an advanced OCR software like Nanonets to accurately extract relevant text from the PDFs. (What is OCR or OCR PDF? – here's a detailed explainer on what is OCR software)

Let’s look at the various ways in which you can use Nanonets to extract text from PDF documents easily, accurately and at scale:

Table of Contents

How to Read or Extract Text from PDF

Want to scrape data from PDF documents, convert PDF to XML or automate table extraction? Check out Nanonets' PDF scraper or PDF parser to convert PDFs to database entries!


How to extract text from PDF with Nanonets free OCR?

OCR tools allow you to easily extract text from PDF documents and convert it into a raw text file. Here are the steps:

  1. Visit Nanonets' free OCR tool here – nanonets.com/online-ocr
  2. Upload your PDF file
  3. Nanonets' OCR automatically recognizes the content in your file and converts it into text
  4. Download the extracted text as a raw text file

This method will suit most of your simple PDF to text use cases. This approach might not be suitable for more complex documents and table structures. Refer the methods below for more complex PDF text extraction requirements.

How to extract text from PDF using Nanonets pre-trained OCR models?

The Nanonets pre-trained Receipt OCR model in action

If your PDFs fall under any of the following document types listed below, you can use the appropriate Nanonets pre-trained model to extract text instantly in a neat and organized manner:

  • Invoices
  • Receipts
  • Driver’s license (US)
  • Passports
  • Menu cards
  • Resumes
  • License plates
  • Meter readings
  • Shipping containers

Step 1 – Select a pre-trained model for your use case

Login to Nanonets and select a model that matches the document type from which you want to extract text. If none of the pre-trained OCR models describe your document, skip this method and read ahead to find out how to create a custom Nanonets OCR model.

Step 2 – Add files

Add the PDF files/documents from which you want to extract text. You can add as many PDFs as you like.

Step 3 – Test & verify

Allow a few seconds for the model to run and extract text from the PDF documents. A table view displays a list of all the text extracted from each PDF file. Quickly verify the extracted text to check whether anything was missed or incorrectly extracted. Click “Verify Data” to proceed.

Step 4 – Export

Once everything is verified, you can export all the extracted text as a neatly organized xml, xlsx or csv file.


Need a free online OCR to extract text from image , extract tables from PDF, or extract data from PDF? Check out Nanonets and build custom OCR models for free!


How to extract text from PDF by building a custom Nanonets OCR model?

Building a custom Nanonets OCR model to extract text from PDFs is pretty straightforward. You can typically build, train and deploy a model for any document type, in any language, all in under 25 minutes (depending on the number of files used to train the model).

Building a custom Nanonets OCR model

Step 1: Create a custom OCR model

Login to Nanonets and click on “Create your own OCR model”.

Step 2: Upload training files

Upload sample PDF files. These will serve as a training set for the OCR model on how to extract text according to your requirements. The accuracy of the OCR model you build will greatly depend on the quality and quantity of the uploaded PDF files.

Step 3: Annotate text on the PDFs

Annotate each piece of text with an appropriate field or label. This will teach the OCR model to identify relevant portions of text in the PDF. You can also add a new label to annotate text. Nanonets is not bound by the template of the document!

Step 4: Train the custom OCR model

Once the annotation is complete, click on “Train Model”. Training usually takes between 20 mins-2 hours depending on the number of models & files queued for training. You can upgrade to a paid plan to get faster results (under 20 minutes). Nanonets leverages deep learning to build various OCR models and tests them against each other for accuracy. Nanonets then picks out the most accurate OCR model.

The “Model Metrics” tab shows the various measurements and comparative analyses that allowed Nanonets to pick the best OCR model among all that were built. You can retrain the model (by providing a wider range of training images and better annotation) to achieve higher levels of accuracy.

Or, if you’re satisfied, click on “Test” to test & verify the custom OCR model on a fresh sample of PDFs.

Step 5: Test & verify data

Add a couple of sample images to test & verify the custom OCR model. If the text has been recognized, extracted and presented appropriately then export the file.


Nanonets online OCR & OCR API have many interesting use cases that could optimize your business performance, save costs and boost growth. Find out how Nanonets' use cases can apply to your product.


How to train custom models for a PDF to text converter using Nanonets API?

If you’re looking to train your own OCR models to build a PDF to text converter, check out the Nanonets API. In the documentation, you will find ready to fire code samples in Shell, Ruby, Golang, Java, C# and Python, as well as detailed API specs for different endpoints.

Why choose Nanonets to extract text from PDFs?

The benefits of using Nanonets over other PDF to text converters software go far beyond just better accuracy and scale. Here are 7 reasons why you should consider using Nanonets to extract text from PDF documents instead of other tools & automated software.


Update May 2022: this post was originally published in April 2021 and has since been updated.

Here's a slide summarizing the findings in this article. Here's an alternate version of this post.

Time Stamp:

More from AI & Machine Learning