Skip to main content

Create Your First OCR Template To Extract Text From PDF

How to use the template editor to tell Parseur which data points to extract from your PDFs

This tutorial assumes that you have already created a mailbox and sent your first email. If not, check out this article to get started.

Note: This article refers to a previous version of the app utilizing our template parsing system. This version is still available, but we highly recommend using the AI engine to extract data from PDFs.

Video Walkthrough

What is OCR?

OCR stands for Optical Character Recognition. It is the method we use to identify and extract text from PDFs.

Step 1: Open the template editor

A template needs to be created from one or several sample documents. You can create your first template in several ways: from the document view page, or from the document list page.

Open the template editor from the document view page

From the document view page, click on the + button to open the editor:

Open the template editor from the document list page

Head over to the Documents section on the left menu. Hover on the document you want to create a template from and click on + New Template:

Open the template editor from the document list page with multiple samples

The new version lets you create templates with multiple document samples so that you can work with optional fields and better test whether your template works for all documents.

You can create a new template and include several samples:

  1. Check the boxes next to the documents you want to use as samples.

  2. Then, click on the + New template button

Step 2: familiarize yourself with the OCR template editor.

When you create your first template, the Template Editor tutorial opens. You can revisit that tutorial by clicking on the "Help and Tutorial" link at the top right corner of the screen.

The Template Editor is where you will show which data points you want to retrieve from documents.

Let's go through each section of this screen:

  1. Template Name: give your template a name. The name must be unique in a mailbox. We recommend you always update the default name and give a meaningful one to each template.

  2. Contextual help: gives you some tips on what to do next or error messages, if any.

  3. Sample list: you can attach several document samples to the template editor. This allows you to manage optional fields and check that a template works against several documents.

  4. View: leave this on image view for now. Other modes can be useful but are for advanced usage.

  5. Content: shows the content of the current selected PDF sample. You can draw a box over it to tell Parseur which data to extract (see Step 3 below).

  6. Fields tab: lists the fields used or available to use. As you haven't created any field yet, this list is empty.

  7. Metadata tab: lists additional metadata fields you may want to add to your parsed results. See below for more information.

  8. Static tab: allows you to create Static fields, which are fields you can set with custom values. See below for more information.

  9. Settings tab: lists several advanced options, like the action to take on matching documents.

  10. Create buttons: you will use those buttons to create fields, labels, and table fields. They will become active once you draw a box over the content. Read on for more information.

Step 3: Create your first field

In Parseur, a field represents a piece of information you want to extract.

The animation below shows you how to create your first template:

To create a field:

  1. Draw a box over the text you want to extract. Draw the box over the full size the text can possibly take in any document. Parseur will only extract the text under the box.

  2. Move or resize the box using the handles as appropriate

  3. The New Field button becomes available

  4. Click this button will open the field option section

  5. Name your field and change options as appropriate

  6. Click Save or draw a new field

When you create a field, Parseur will position it in absolute terms on the page by default, which means it will extract the text in all documents in that exact box location on that page. If the field can move horizontally or vertically, you can use labels to position the field dynamically. Check out our article on how to use labels and dynamic OCR for more information.

Step 4: Create all remaining fields and save

Repeat the steps described above for every field you want to capture.

Tips for creating a template:

  1. As mentioned above, make sure to have fields cover the full zone where the text can be placed for a field, not only the one where the text is in the current document.

  2. As you can see from the screen capture, we created a label on top of the transaction table name.This will help Parseur select the right template in case your mailbox contains templates from several suppliers. When searching for the best template, Parseur will filter for the ones that contain all mandatory labels.

  3. On the right-hand side, you see the fields all have a red asterisk: fields with a red asterisk are required, and those without are optional. You can change that setting by toggling the Field presence is required switch when editing a field or label. Checking required fields happens at the very end of parsing, after every data format transformation and post processing (if any).

Step 5: Add metadata fields (optional)

You may want to extract additional metadata information that is not present in the document body, like, for instance, a link to the original PDF document.

Head over to the Metadata tab next to the Fields tab:

For more information, check out our Using Metadata Fields article.

Step 6: Save the template

Once finished, click Create. Make sure that the Re-process unprocessed documents option is selected in the dropdown.

You can now see that your document has been processed:

Step 7: Check the results

Make sure that all the data is captured correctly.

On this screen, you see:

  • At the top left, metadata information about the document, including the template that was used

  • At the top right, the action buttons (hover them for more information)

  • On the left, the document content

  • On the right, the parsed data is extracted. You can switch between the table view and JSON view according to your preference

If everything looks correct, congratulations! You have parsed your first document!

Now send more documents and verify that your data has been correctly extracted. Create new templates as necessary.

FAQ - Frequently Asked Questions

Can I split multipage PDFs into several documents or apply a template to several pages?

Yes, check out our dedicated article on how to split bundled PDFs into separate documents.

How does Parseur prioritize templates?

Templates are prioritized following the same usual rules. Check out the following article to understand how Parseur picks a template.

How can I parse checkboxes or radio buttons?

Parseur doesn't support extracting radio buttons or checked boxes at this time. You can upvote the following feature request to help us prioritize this feature: https://feedback.parseur.com/suggestions/358567/handle-checkboxes

How can I check if my document was OCRized/scanned correctly?

You can Ctrl+Click (or Option+Click on Mac OS) on the Download button of your document, on the top-right corner of your document screen, to display an overlay of the scanned text on top of your document.

You can check the actual scanned text by hovering your mouse cursor over the red boxes, which represent the actual text fragment and their position in the page:

If you detect any missing or misrecognized text, enable Force OCR in the Parseur settings, then reprocess your document. Or scan your document again using a more accurate OCR system, then upload the document to Parseur again.

I have another question

Please contact us on the chat at the bottom right corner.

What's Next?

Did this answer your question?