Table Of Contents

How to Extract a One-Line Text?
How to Extract a Multi-Line Text?
How to Extract a Fixed Table?
How to Extract a Field Based On Search?
How to Add A Static Value In The Template?
Document Parser Template Result

In this tutorial, we will show you how to use the Online Template Editor to create a Document Parser Template.

We have several samples that you can check out here Click on the Load Sample Template button on the upper left corner to access them.

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

How to Extract a One-Line Text?

1. 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

2. 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

3. 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

4. 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 a Multi-Line Text?

1. 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?

1. 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

2. 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?

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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?

1. 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

2. 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

3. 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 page 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.

NOTE: To learn how to use Macros and Expressions, check out this tutorial here.

Related Pages:

Related Samples: