Quick Start with Document Parser Template Editor: How To Create a Template

Sep 2, 2024·5 Minutes Read

In this tutorial, we will show you how to use the Online Template Editor to create a Document Parser Template. You can follow along by downloading our sample PDF here.

Sample Invoice To Create A Document Parser Template
Screenshot of a Sample Invoice for the Document Parser Template

How to Extract One-Line Text

Add Object

To extract a one-line Invoice Number, kindly click on the Add Object button and select the FIELD from Rectangle.

Add Field From Rectangle Object

Drag Object to Invoice Number

Drag the Rectangle object over to the Invoice Number and resize it to fit the whole number. Then, change the Object Name to easily identify the Object.

Drag Object Over Invoice Number To Extract

Test Object

When you click on the Test Object button this will give you a preview of the result.

Test Field From Rectangle Object To Extract Invoice Number

Configure Object Properties

Now let’s add a Field From Rectangle Object over the Invoice Date, change the Rectangle Name, and select the Data Type to Date.

Extract Invoice Date Using Field From Rectangle Object

How to Extract Multi-Line Text

FIELD from Rectangle Object

Next, let’s get the Invoice Address. The Invoice Address is composed of three lines. To extract a three-line address, we will use the FIELD from Rectangle Object. Add the object and drag it over the Address. Then, change the Name to easily identify the Rectangle Object.

Extract Invoice Address Using Field From Rectangle

How to Extract a Fixed Table

Use TABLE from Rectangle Object

There are several ways to extract a Table. The Table in this Invoice is fixed and covers a one-page only. To get the values in a Fixed Table, we will use the TABLE from Rectangle Object.

Use Table From Rectangle Object To Extract Fixed Table

Drag Object Over Table

Drag the TABLE from Rectangle Object over to the Table and resize it to cover the whole area. Then, change the Name of the Object to easily identify the Table. Click on the Test Object button to see the result.

Drag Table From Rectangle Over Fixed Table

How to Extract a Field Based On Search

FIELD Based On Search Object

The FIELD Based On Search Object is another way to get values such as an Invoice Number. Instead of drawing a Rectangle Object over the text, we can use the Expression property to find the text. This makes it easier to parse data with no fixed location. To get started, click on the Add Object button on the top left corner and select FIELD Based On Search.

Add Object Field Based On Search

Expression Field

On the Selected Object Properties, look for the Expression field. Kindly enter the word SUBTOTAL. This will look for the word SUBTOTAL in the Invoice.

Extract Subtotal Field Based On Search

Insert SPACES Macros

Now click on the Insert Macros button and select SPACES. This will now look up the word SUBTOTAL with one or more spaces after the word.

Add Spaces Macro To Insert One Or More Spaces

Insert Money Macro

Click on the Insert Macros button again and select Money. This time it will look up the word SUBTOTAL with one or more spaces and a decimal number.

Add Money Macro To Insert Decimal Number

Configure Object Properties

Place a checkmark on the Regex checkbox and change the Data Type to Decimal or Currency. When you click on the Test Object button this will look up the SUBTOTAL{{SPACES}}{{MONEY}} pattern. When a match is found it will return the decimal number.

Check Regex And Select Data Type In Subtotal

Find Sales Tax

Now we will find the SALES TAX amount in the Invoice. To do that, use the same Macros as the SUBTOTAL. Kindly enter SALES TAX{{SPACES}}{{MONEY}} in the Expression field.

Extract Sales Tax Field Based On Search

Find Total

In addition to the two examples above, we will also find the TOTAL DUE BY DATE amount. Kindly enter TOTAL DUE BY DATE{{SPACES}}{{MONEY}} in the Expression field.

Extract Total Due By Date Field Based On Search

How to Add A Static Value In The Template

STATIC Value Object

The STATIC Value Object allows you to add text or data in the Template that may or may not be available in the PDF that you would like to Parse. To use this Object, click on the Add Object button on the upper left corner and select STATIC Value.

Add An Object In The Template Using Static Value

Enter Currency Value

Under Selected Object Properties, enter USD in the Value field. Change the Name to currency to easily identify this Object.

Add A Currency Static Value

Enter Company Name

Instead of parsing the Company Name we will add it as a STATIC Value. Add a STATIC Value object and enter ACME Inc.

Add A Company Name Static Value

Document Parser Template Result

You can give your New Template a Name and Save the Template To File. You can also Save the Template to the Document Parser Manager in PDF.co. Click on the Run Template button to see the result.

Great! We have successfully created a re-usable Document Parser Template for this sample Invoice.

Output Of Invoice Document Parser Template
Screenshot of the Document Parser Invoice Template Output

In this tutorial, we explained the different functions of the Document Parser Objects. We used the different Objects to parse the data in the Invoice. We used the Macros in the Expression to search for specific data that follows a certain pattern. And, we also learned how to add a STATIC Value to the extracted Invoice.

Video Guide

Related Tutorials

See Related Tutorials