Parse an Invoice with Line Items in Bordered Table – Guide

  1. Go to your PDF.co Document Parser Page
  2. Create a New Template
  3. Load Test PDF or Image
  4. Add Objects
  5. Add Expression using Macros
  6. Result
  7. Save Template

We prepared this step-by-step tutorial to teach you how to parse an invoice with line items in a bordered table using PDF.co Document Parser.

Here’s our sample invoice with line items in a bordered table:

Screenshot of Sample Invoice
Screenshot of Sample Invoice

Let’s start by logging in to PDF.co here.

Step 1 – Go to your PDF.co Document Parser Page

  • Once you’re already logged in to PDF.co you will be redirected to your dashboard
  • On your dashboard page, click on the document parser menu at the top of the page

Go to your PDF.co Document Parser Page

Step 2 – Create a New Template

  • On your document parser page, click on New Template

Create a New Template

Step 3 – Load Test PDF or Image

  • Once you’re already at the template editor page, load the PDF or Image that you’re going to use

Load Test PDF or Image

Step 4 – Add Objects

  • We will use two types of objects for this invoice
  • First will be Add TABLE field based on TEXT SEARCH
  • The second will be Add Field based on TEXT SEARCH

Add table field based on text search object

Add field based on text search

Step 5 – Add Expression using Macros

  • To get the invoice number, order number, total net, and total invoice we will first search for the Invoice #, Order, Total Net, and Total Invoice text and then add the {{Number}} macro. Then, check the Regex checkbox and change the Data Type to Integer since we’re looking for a number.
  • To get the date, we will first search for the Date text and then add the {{SmartDate}} macro. Then, check the Regex checkbox and change the Data Type to Date since we’re looking for a date.
  • For the list of items just use these properties and change the column/rows depending on what’s on your invoice.
    • {
      "start": {
      "expression": "({{LineStart}})(?={{Spaces}}WH)",
      "regex": true
      },
      "end": {
      "expression": "{{EndOfPage}}",
      "regex": true
      },
      "row": {
      "expression": "{{LineStart}}{{Spaces}}(?<WarehouseLoc>{{Letter}}){{Spaces}}(?<ItemNo>{{Number}}){{Spaces}}(?<Brand>{{SentenceWithSingleSpaces}}){{Spaces}}(?<Description>{{SentenceWithSingleSpaces}}){{Spaces}}(?<PackSize>{{LettersOrDigitsOrSymbols}}){{Spaces}}(?<Per>{{Letters}}){{Spaces}}(?<Quantity>{{Number}}){{Spaces}}(?<UnitPrice>{{Number}}){{Spaces}}(?<NetValue>{{Number}}){{Spaces}}(?<GSTAmount>{{Number}}){{Spaces}}(?<TotalAmount>{{Number}})",
      "regex": true
      },
      "columns": [
      {
      "name": "WH LOC",
      "dataType": "string"
      },
      {
      "name": "Item Number",
      "dataType": "integer"
      },
      {
      "name": "Brand",
      "dataType": "string"
      },
      {
      "name": "Description",
      "dataType": "string"
      },
      {
      "name": "Pack Size",
      "dataType": "string"
      },
      {
      "name": "Per",
      "dataType": "string"
      },
      {
      "name": "Quantity",
      "dataType": "integer"
      },
      {
      "name": "Unit Price",
      "dataType": "decimal or currency"
      },
      {
      "name": "Net Value",
      "dataType": "decimal or currency"
      },
      {
      "name": "GST Amount",
      "dataType": "decimal or currency"
      },
      {
      "name": "Total Amount",
      "dataType": "decimal or currency"
      }
      ]
      }

Invoice number field

Order number field

Total net fieldTotal invoice field

Date field

List of items table

Step 6 – Result

  • Here’s the result of our Invoice with Line Items in Bordered Table
Output of Parsed Invoice
The output of Parsed Invoice

Step 7 – Save Template

  • Once you’re finished making your template. You may now save it to be used later.

Save template

That’s how you parse an invoice with line items in a bordered table using PDF.co Document Parser. Find more tutorials about PDF invoice extraction.

Similar Pages