I am building a demo application for reading an invoice pdf using the OCR library provided by Microsoft for NodeJS. The data are extracting well but I got stuck in one point. In the invoice pdf doc the amount, quantity is in tabular format. So I am not getting any relation regarding which value is for the amount and which value is for quantity. I am attaching my PDF file and extract text for reference. Please let me know if there is any way to extract those data.
{
"page": 1,
"angle": 0,
"width": 8.2639,
"height": 11.6806,
"unit": "inch",
"lines": [
{
"boundingBox": [0.6679,0.7621,1.4191,0.7621,1.4191,0.8842,0.6679,0.8842],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": "TestSam1",
"words": [
{
"boundingBox": [0.6679,0.7621,1.4191,0.7621,1.4191,0.8842,0.6679,0.8842],
"text": "TestSam1",
"confidence": 1
}
]
},
{
"boundingBox": [0.6677,0.992,1.2962,0.992,1.2962,1.1002,0.6677,1.1002],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": "West Bengal",
"words": [
{
"boundingBox": [0.6677,1.0014,0.9218,1.0014,0.9218,1.0807,0.6677,1.0807],
"text": "West",
"confidence": 1
},
{
"boundingBox": [0.959,0.992,1.2962,0.992,1.2962,1.1002,0.959,1.1002],
"text": "Bengal",
"confidence": 1
}
]
},
{
"boundingBox": [5.9831,0.9355,7.7952,0.9355,7.7952,1.1598,5.9831,1.1598],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": "TAX INVOICE",
"words": [
{
"boundingBox": [5.9831,0.9407,6.5404,0.9407,6.5404,1.1556,5.9831,1.1556],
"text": "TAX",
"confidence": 1
},
{
"boundingBox": [6.6434,0.9355,7.7952,0.9355,7.7952,1.1598,6.6434,1.1598],
"text": "INVOICE",
"confidence": 1
}
]
},
{
"boundingBox": [0.6741,1.1359,0.9013,1.1359,0.9013,1.2246,0.6741,1.2246],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": "India",
"words": [
{
"boundingBox": [0.6741,1.1359,0.9013,1.1359,0.9013,1.2246,0.6741,1.2246],
"text": "India",
"confidence": 1
}
]
},
{
"boundingBox": [0.6179,1.3359,0.6811,1.3359,0.6811,1.4139,0.6179,1.4139],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": "#",
"words": [
{
"boundingBox": [0.6179,1.3359,0.6811,1.3359,0.6811,1.4139,0.6179,1.4139],
"text": "#",
"confidence": 1
}
]
},
{
"boundingBox": [2.3861,1.334,3.0461,1.334,3.0461,1.4153,2.3861,1.4153],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": ": INV-000772",
"words": [
{
"boundingBox": [2.3861,1.3546,2.4067,1.3546,2.4067,1.4152,2.3861,1.4152],
"text": ":",
"confidence": 1
},
{
"boundingBox": [2.4456,1.334,3.0461,1.334,3.0461,1.4153,2.4456,1.4153],
"text": "INV-000772",
"confidence": 1
}
]
},
{
"boundingBox": [0.622,1.4831,1.2323,1.4831,1.2323,1.5673,0.622,1.5673],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": "Invoice Date",
"words": [
{
"boundingBox": [0.622,1.4831,0.963,1.4831,0.963,1.5673,0.622,1.5673],
"text": "Invoice",
"confidence": 1
},
{
"boundingBox": [1.0041,1.4872,1.2323,1.4872,1.2323,1.5672,1.0041,1.5672],
"text": "Date",
"confidence": 1
}
]
},
{
"boundingBox": [2.3861,1.4777,3.0196,1.4777,3.0196,1.5864,2.3861,1.5864],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": ": 28/08/2021",
"words": [
{
"boundingBox": [2.3861,1.5067,2.4067,1.5067,2.4067,1.5673,2.3861,1.5673],
"text": ":",
"confidence": 1
},
{
"boundingBox": [2.4406,1.4777,3.0196,1.4777,3.0196,1.5864,2.4406,1.5864],
"text": "28/08/2021",
"confidence": 1
}
]
},
{
"boundingBox": [0.6143,1.64,0.9208,1.64,0.9208,1.7193,0.6143,1.7193],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": "Terms",
"words": [
{"boundingBox": [0.6143,1.64,0.9208,1.64,0.9208,1.7193,0.6143,1.7193],
"text": "Terms",
"confidence": 1
}
]
},
{
"boundingBox": [2.3861,1.6318,3.2388,1.6318,3.2388,1.7385,2.3861,1.7385],
"appearance": {
"style": {
"name": "other",
"confidence": 1
}
},
"text": ": Due on Receipt",
"words": [
{
"boundingBox": [2.3861,1.6588,2.4067,1.6588,2.4067,1.7194,2.3861,1.7194],
"text": ":",
"confidence": 1
},
{
"boundingBox": [
2.4456,
1.6392, 2.6437, 1.6392, 2.6437, 1.7195, 2.4456, 1.7195 ], "text": "Due", "confidence": 1 }, { "boundingBox": [ 2.6803, 1.6572, 2.8008, 1.6572, 2.8008, 1.7195, 2.6803, 1.7195 ], "text": "on", "confidence": 1 }, { "boundingBox": [ 2.8435, 1.6318, 3.2388, 1.6318, 3.2388, 1.7385, 2.8435, 1.7385 ], "text": "Receipt", "confidence": 1 } ] }, { "boundingBox": [ 0.622, 1.7913, 1.0807, 1.7913, 1.0807, 1.8714, 0.622, 1.8714 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Due Date", "words": [ { "boundingBox": [ 0.622, 1.7913, 0.8114, 1.7913, 0.8114, 1.8714, 0.622, 1.8714 ], "text": "Due", "confidence": 1 }, { "boundingBox": [ 0.8525, 1.7913, 1.0807, 1.7913, 1.0807, 1.8714, 0.8525, 1.8714 ], "text": "Date", "confidence": 1 } ] }, { "boundingBox": [ 2.3861, 1.7819, 3.0196, 1.7819, 3.0196, 1.8906, 2.3861, 1.8906 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": ": 28/08/2021", "words": [ { "boundingBox": [ 2.3861, 1.8109, 2.4067, 1.8109, 2.4067, 1.8715, 2.3861, 1.8715 ], "text": ":", "confidence": 1 }, { "boundingBox": [ 2.4406, 1.7819, 3.0196, 1.7819, 3.0196, 1.8906, 2.4406, 1.8906 ], "text": "28/08/2021", "confidence": 1 } ] }, { "boundingBox": [ 0.6214, 2.0441, 0.9464, 2.0441, 0.9464, 2.133, 0.6214, 2.133 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Bill To", "words": [ { "boundingBox": [ 0.6214, 2.0441, 0.7876, 2.0441, 0.7876, 2.1325, 0.6214, 2.1325 ], "text": "Bill", "confidence": 1 }, { "boundingBox": [ 0.8181, 2.0535, 0.9464, 2.0535, 0.9464, 2.133, 0.8181, 2.133 ], "text": "To", "confidence": 1 } ] }, { "boundingBox": [ 0.62, 2.255, 1.0775, 2.255, 1.0775, 2.355, 0.62, 2.355 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Md Riaz", "words": [ { "boundingBox": [ 0.62, 2.255, 0.7914, 2.255, 0.7914, 2.355, 0.62, 2.355 ], "text": "Md", "confidence": 1 }, { "boundingBox": [ 0.8401, 2.2563, 1.0775, 2.2563, 1.0775, 2.3547, 0.8401, 2.3547 ], "text": "Riaz", "confidence": 1 } ] }, { "boundingBox": [ 0.7076, 2.5806, 0.773, 2.5806, 0.773, 2.6586, 0.7076, 2.6586 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "#", "words": [ { "boundingBox": [ 0.7076, 2.5806, 0.773, 2.5806, 0.773, 2.6586, 0.7076, 2.6586 ], "text": "#", "confidence": 1 } ] }, { "boundingBox": [ 1.0119, 2.5724, 1.988, 2.5724, 1.988, 2.679, 1.0119, 2.679 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Item & Description", "words": [ { "boundingBox": [ 1.0119, 2.5806, 1.2406, 2.5806, 1.2406, 2.6601, 1.0119, 2.6601 ], "text": "Item", "confidence": 1 }, { "boundingBox": [ 1.2784, 2.5787, 1.3516, 2.5787, 1.3516, 2.6595, 1.2784, 2.6595 ], "text": "&", "confidence": 1 }, { "boundingBox": [ 1.3882, 2.5724, 1.988, 2.5724, 1.988, 2.679, 1.3882, 2.679 ], "text": "Description", "confidence": 1 } ] }, { "boundingBox": [ 5.8379, 2.5787, 6.0289, 2.5787, 6.0289, 2.6794, 5.8379, 2.6794 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Qty", "words": [ { "boundingBox": [ 5.8379, 2.5787, 6.0289, 2.5787, 6.0289, 2.6794, 5.8379, 2.6794 ], "text": "Qty", "confidence": 1 } ] }, { "boundingBox": [ 6.5922, 2.5797, 6.8278, 2.5797, 6.8278, 2.6601, 6.5922, 2.6601 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Rate", "words": [ { "boundingBox": [ 6.5922, 2.5797, 6.8278, 2.5797, 6.8278, 2.6601, 6.5922, 2.6601 ], "text": "Rate", "confidence": 1 } ] }, { "boundingBox": [ 7.3646, 2.5806, 7.7832, 2.5806, 7.7832, 2.6601, 7.3646, 2.6601 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Amount", "words": [ { "boundingBox": [ 7.3646, 2.5806, 7.7832, 2.5806, 7.7832, 2.6601, 7.3646, 2.6601 ], "text": "Amount", "confidence": 1 } ] }, { "boundingBox": [ 0.7192, 2.7535, 0.7498, 2.7535, 0.7498, 2.8315, 0.7192, 2.8315 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "1", "words": [ { "boundingBox": [ 0.7192, 2.7535, 0.7498, 2.7535, 0.7498, 2.8315, 0.7192, 2.8315 ], "text": "1", "confidence": 1 } ] }, { "boundingBox": [ 0.9831, 2.7516, 1.7297, 2.7516, 1.7297, 2.8331, 0.9831, 2.8331 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "APPSeConnect", "words": [ { "boundingBox": [ 0.9831, 2.7516, 1.7297, 2.7516, 1.7297, 2.8331, 0.9831, 2.8331 ], "text": "APPSeConnect", "confidence": 1 } ] }, { "boundingBox": [ 5.8463, 2.7516, 6.0455, 2.7516, 6.0455, 2.8331, 5.8463, 2.8331 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "1.00", "words": [ { "boundingBox": [ 5.8463, 2.7516, 6.0455, 2.7516, 6.0455, 2.8331, 5.8463, 2.8331 ], "text": "1.00", "confidence": 1 } ] }, { "boundingBox": [ 6.4338, 2.7516, 6.8481, 2.7516, 6.8481, 2.8491, 6.4338, 2.8491 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "1,000.00", "words": [ { "boundingBox": [ 6.4338, 2.7516, 6.8481, 2.7516, 6.8481, 2.8491, 6.4338, 2.8491 ], "text": "1,000.00", "confidence": 1 } ] }, { "boundingBox": [ 7.3874, 2.7516, 7.8017, 2.7516, 7.8017, 2.8491, 7.3874, 2.8491 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "1,000.00", "words": [ { "boundingBox": [ 7.3874, 2.7516, 7.8017, 2.7516, 7.8017, 2.8491, 7.3874, 2.8491 ], "text": "1,000.00", "confidence": 1 } ] }, { "boundingBox": [ 0.9909, 2.8715, 2.341, 2.8715, 2.341, 2.9801, 0.9909, 2.9801 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "(28-08-2021 to 27-08-2022)", "words": [ { "boundingBox": [ 0.9909, 2.8715, 1.5636, 2.8715, 1.5636, 2.9801, 0.9909, 2.9801 ], "text": "(28-08-2021", "confidence": 1 }, { "boundingBox": [ 1.6191, 2.883, 1.7153, 2.883, 1.7153, 2.9611, 1.6191, 2.9611 ], "text": "to", "confidence": 1 }, { "boundingBox": [ 1.7528, 2.8715, 2.341, 2.8715, 2.341, 2.9801, 1.7528, 2.9801 ], "text": "27-08-2022)", "confidence": 1 } ] }, { "boundingBox": [ 5.9984, 2.8817, 6.029, 2.8817, 6.029, 2.9597, 5.9984, 2.9597 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "1", "words": [ { "boundingBox": [ 5.9984, 2.8817, 6.029, 2.8817, 6.029, 2.9597, 5.9984, 2.9597 ], "text": "1", "confidence": 1 } ] }, { "boundingBox": [ 6.0235, 3.0681, 6.4919, 3.0681, 6.4919, 3.1571, 6.0235, 3.1571 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Sub Total", "words": [ { "boundingBox": [ 6.0235, 3.0681, 6.2023, 3.0681, 6.2023, 3.1571, 6.0235, 3.1571 ], "text": "Sub", "confidence": 1 }, { "boundingBox": [ 6.2354, 3.0681, 6.4919, 3.0681, 6.4919, 3.1569, 6.2354, 3.1569 ], "text": "Total", "confidence": 1 } ] }, { "boundingBox": [ 7.3666, 3.0757, 7.7808, 3.0757, 7.7808, 3.1731, 7.3666, 3.1731 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "1,000.00", "words": [ { "boundingBox": [ 7.3666, 3.0757, 7.7808, 3.0757, 7.7808, 3.1731, 7.3666, 3.1731 ], "text": "1,000.00", "confidence": 1 } ] }, { "boundingBox": [ 0.6351, 3.1723, 1.3611, 3.1723, 1.3611, 3.2611, 0.6351, 3.2611 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Total In Words", "words": [ { "boundingBox": [ 0.6351, 3.1723, 0.8917, 3.1723, 0.8917, 3.2611, 0.6351, 3.2611 ], "text": "Total", "confidence": 1 }, { "boundingBox": [ 0.9295, 3.1817, 1.0053, 3.1817, 1.0053, 3.2597, 0.9295, 3.2597 ], "text": "In", "confidence": 1 }, { "boundingBox": [ 1.0423, 3.1723, 1.3611, 3.1723, 1.3611, 3.2611, 1.0423, 3.2611 ], "text": "Words", "confidence": 1 } ] }, { "boundingBox": [ 0.6422, 3.3003, 2.095, 3.3003, 2.095, 3.4082, 0.6422, 3.4082 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Rupees One Thousand Only", "words": [ { "boundingBox": [ 0.6422, 3.3089, 1.0316, 3.3089, 1.0316, 3.4082, 0.6422, 3.4082 ], "text": "Rupees", "confidence": 1 }, { "boundingBox": [ 1.0551, 3.3079, 1.2756, 3.3079, 1.2756, 3.3892, 1.0551, 3.3892 ], "text": "One", "confidence": 1 }, { "boundingBox": [ 1.2965, 3.3003, 1.8189, 3.3003, 1.8189, 3.3892, 1.2965, 3.3892 ], "text": "Thousand", "confidence": 1 }, { "boundingBox": [ 1.84, 3.3003, 2.095, 3.3003, 2.095, 3.4082, 1.84, 3.4082 ], "text": "Only", "confidence": 1 } ] }, { "boundingBox": [ 6.2158, 3.2378, 6.4932, 3.2378, 6.4932, 3.3267, 6.2158, 3.3267 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Total", "words": [ { "boundingBox": [ 6.2158, 3.2378, 6.4932, 3.2378, 6.4932, 3.3267, 6.2158, 3.3267 ], "text": "Total", "confidence": 1 } ] }, { "boundingBox": [ 7.2074, 3.2454, 7.7826, 3.2454, 7.7826, 3.3433, 7.2074, 3.3433 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Rs.1,000.00", "words": [ { "boundingBox": [ 7.2074, 3.2454, 7.7826, 3.2454, 7.7826, 3.3433, 7.2074, 3.3433 ], "text": "Rs.1,000.00", "confidence": 1 } ] }, { "boundingBox": [ 5.7647, 3.4133, 6.4887, 3.4133, 6.4887, 3.5134, 5.7647, 3.5134 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Balance Due", "words": [ { "boundingBox": [ 5.7647, 3.4133, 6.22, 3.4133, 6.22, 3.5134, 5.7647, 3.5134 ], "text": "Balance", "confidence": 1 }, { "boundingBox": [ 6.2656, 3.4229, 6.4887, 3.4229, 6.4887, 3.5134, 6.2656, 3.5134 ], "text": "Due", "confidence": 1 } ] }, { "boundingBox": [ 7.1339, 3.4218, 7.7819, 3.4218, 7.7819, 3.5321, 7.1339, 3.5321 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Rs.1,000.00", "words": [ { "boundingBox": [ 7.1339, 3.4218, 7.7819, 3.4218, 7.7819, 3.5321, 7.1339, 3.5321 ], "text": "Rs.1,000.00", "confidence": 1 } ] }, { "boundingBox": [ 0.6351, 3.7124, 1.8961, 3.7124, 1.8961, 3.8206, 0.6351, 3.8206 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Thanks for your business.", "words": [ { "boundingBox": [ 0.6351, 3.7124, 0.9841, 3.7124, 0.9841, 3.8011, 0.6351, 3.8011 ], "text": "Thanks", "confidence": 1 }, { "boundingBox": [ 1.023, 3.7124, 1.1641, 3.7124, 1.1641, 3.8012, 1.023, 3.8012 ], "text": "for", "confidence": 1 }, { "boundingBox": [ 1.1911, 3.7398, 1.4169, 3.7398, 1.4169, 3.8206, 1.1911, 3.8206 ], "text": "your", "confidence": 1 }, { "boundingBox": [ 1.4525, 3.7124, 1.8961, 3.7124, 1.8961, 3.8012, 1.4525, 3.8012 ], "text": "business.", "confidence": 1 } ] }, { "boundingBox": [ 5.7353, 4.4857, 6.8014, 4.4857, 6.8014, 4.5939, 5.7353, 4.5939 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "Authorized Signature", "words": [ { "boundingBox": [ 5.7353, 4.4857, 6.2869, 4.4857, 6.2869, 4.5745, 5.7353, 4.5745 ], "text": "Authorized", "confidence": 1 }, { "boundingBox": [ 6.325, 4.4903, 6.8014, 4.4903, 6.8014, 4.5939, 6.325, 4.5939 ], "text": "Signature", "confidence": 1 } ] }, { "boundingBox": [ 2.5798, 11.1207, 5.8183, 11.1207, 5.8183, 11.2264, 2.5798, 11.2264 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "This is a sample document generated for testing purposes only", "words": [ { "boundingBox": [ 2.5798, 11.1207, 2.7874, 11.1207, 2.7874, 11.2075, 2.5798, 11.2075 ], "text": "This", "confidence": 1 }, { "boundingBox": [ 2.8238, 11.1219, 2.8972, 11.1219, 2.8972, 11.2075, 2.8238, 11.2075 ], "text": "is", "confidence": 1 }, { "boundingBox": [ 2.9315, 11.1467, 2.9805, 11.1467, 2.9805, 11.2072, 2.9315, 11.2072 ], "text": "a", "confidence": 1 }, { "boundingBox": [ 3.0178, 11.1207, 3.3775, 11.1207, 3.3775, 11.226, 3.0178, 11.226 ], "text": "sample", "confidence": 1 }, { "boundingBox": [ 3.4132, 11.1207, 3.9228, 11.1207, 3.9228, 11.2075, 3.4132, 11.2075 ], "text": "document", "confidence": 1 }, { "boundingBox": [ 3.9569, 11.1207, 4.4816, 11.1207, 4.4816, 11.2264, 3.9569, 11.2264 ], "text": "generated", "confidence": 1 }, { "boundingBox": [ 4.5228, 11.1207, 4.6713, 11.1207, 4.6713, 11.2075, 4.5228, 11.2075 ], "text": "for", "confidence": 1 }, { "boundingBox": [ 4.7054, 11.1219, 5.0623, 11.1219, 5.0623, 11.2264, 4.7054, 11.2264 ], "text": "testing", "confidence": 1 }, { "boundingBox": [ 5.1034, 11.1467, 5.5659, 11.1467, 5.5659, 11.226, 5.1034, 11.226 ], "text": "purposes", "confidence": 1 }, { "boundingBox": [ 5.6012, 11.1207, 5.8183, 11.1207, 5.8183, 11.226, 5.6012, 11.226 ], "text": "only", "confidence": 1 } ] }, { "boundingBox": [ 7.7572, 11.4777, 7.7802, 11.4777, 7.7802, 11.5362, 7.7572, 11.5362 ], "appearance": { "style": { "name": "other", "confidence": 1 } }, "text": "1", "words": [ { "boundingBox": [ 7.7572, 11.4777, 7.7802, 11.4777, 7.7802, 11.5362, 7.7572, 11.5362 ], "text": "1", "confidence": 1 } ] } ] }

