Link Search Menu Expand Document

Table with Multiple Subitems - TEMPLATES-SAMPLES

Document Parser sample in TEMPLATES-SAMPLES demonstrating ‘Table with Multiple Subitems’

template.json
{
  "templateName": "template",
  "templateVersion": "4",
  "templatePriority": 0,
  "detectionRules": {
    "keywords": []
  },
  "objects": [
    {
      "name": "Doc No",
      "objectType": "field",
      "fieldProperties": {
        "fieldType": "macros",
        "expression": "Doc No{{Spaces}}(?<value>{{Digits}})",
        "regex": true
      }
    },
    {
      "name": "Doc Date",
      "objectType": "field",
      "fieldProperties": {
        "fieldType": "macros",
        "expression": "Doc Date{{Spaces}}(?<value>{{SmartDate}})",
        "regex": true
      }
    },
    {
      "name": "TableItems",
      "objectType": "table",
      "tableProperties": {
        "start": {
          "expression": "Description{{Spaces}}Quantity{{Spaces}}Price",
          "regex": true
        },
        "end": {
          "expression": "{{EndOfPage}}",
          "regex": true
        },
        "row": {
          "expression": "{{LineStart}}{{Spaces}}(?<No>{{Digits}}){{Spaces}}(?<Description>{{SentenceWithSingleSpaces}}){{Spaces}}(?<Quantity>{{Number}}{{Spaces}}{{Letters}}){{Spaces}}(?<Price>{{Number}}{{Spaces}}{{Letters}}/{{Letters}}){{Spaces}}(?<Amount>{{Number}}{{Spaces}}{{Letters}})",
          "regex": true,
          "subExpression1": "{{LineStart}}{{Spaces}}(?<Description>{{SentenceWithSingleSpaces}})"
        },
        "columns": [
          {
            "name": "No",
            "dataType": "integer"
          },
          {
            "name": "Description",
            "dataType": "string"
          },
          {
            "name": "Quantity",
            "dataType": "string"
          },
          {
            "name": "Price",
            "dataType": "string"
          },
          {
            "name": "Amount",
            "dataType": "string"
          }
        ]
      }
    }
  ]
}

PDF.co Web API: the Web API with a set of tools for documents manipulation, data conversion, data extraction, splitting and merging of documents. Includes image recognition, built-in OCR, barcode generation and barcode decoders to decode bar codes from scans, pictures and pdf.

Get your PDF.co API key here!

Download Source Code (.zip)

return to the previous page explore Document Parser endpoint