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
OCR tools allow you to easily extract text from PDF documents and convert it into a raw text file. Here are the steps:
- Visit Nanonets’ free OCR tool here – nanonets.com/online-ocr
- Upload your PDF file
- Nanonets’ OCR automatically recognizes the content in your file and converts it into text
- 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.
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:
- Driver’s license (US)
- Menu cards
- 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.
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).
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.
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.
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.