How to use OCR Cloud API to extract text positions or coordinates from TIFF image files?

hi,

"Greetings of the day"

I have a question for VeryPDF Cloud API Platform and OCR Cloud API,

https://www.verypdf.com/online/cloud-api/index.html

We are developing a web application that require OCR SDK for get position of particular text on the image. We also require pdf to image conversion for the same..

So my Query is ...

if we upload a pdf and send it to you for conversion then what we will get in return, Will you provide converted images or you will provide only URL for these converted images?

Our Requirement ...

We want converted images on our server for further process also we want your OCR SDK for automation and getting co-ordinate(position) of text on image.

Please provide details on these matter as soon as possible..

Customer
----------------------------------------------------------------------------

cloudocrsdk2
Sure, no problem, you can open following URL in web browser,

http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=ocr
&infile=http://online.verypdf.com/examples/cloud-api/multipage.tif&outfile=out&lang=eng&format

You will get an output URL, e.g.,

[Output] http://online.verypdf.com/u/public/api/20140703-214752-683223135-out.html

please open http://online.verypdf.com/u/public/api/20140703-214752-683223135-out.html in web browser, view its source code, you will get the source code like below,

================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='ocr-system' content='VeryPDF Cloud API System -- VeryPDF Cloud OCR API' />
<meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par ocr_line ocrx_word'/>
</head>
<body>
<div class='ocr_page' id='page_1' title='image "20140703-214752-1177385112.tif"; bbox 0 0 2000 2388; ppageno 0'>
<div class='ocr_carea' id='block_1_1' title="bbox 22 28 1013 87">
<p class='ocr_par' dir='ltr' id='par_1' title="bbox 23 30 1012 83">
<span class='ocr_line' id='line_1' title="bbox 23 30 1012 83">
<span class='ocrx_word' id='word_1' title="bbox 23 32 262 74">Universal</span>
<span class='ocrx_word' id='word_2' title="bbox 278 31 569 73">Declaration</span>
<span class='ocrx_word' id='word_3' title="bbox 586 31 637 73">of</span>
<span class='ocrx_word' id='word_4' title="bbox 649 31 836 72">Human</span>
<span class='ocrx_word' id='word_5' title="bbox 853 30 1012 83">Rights</span>
</span>
</p>
</div>
================================================

Above HTML code is contain Left, Top, Right, Bottom coordinates for each words in TIFF image file, you can read them from your PHP or C# code easily.

You can also look at following web page for more information,

https://www.verypdf.com/wordpress/201308/verypdf-cloud-api-platform-verypdf-ocr-cloud-api-online-ocr-engine-to-recognize-scanned-pdf-and-image-files-to-editable-document-formats-37980.html

VeryPDF
----------------------------------------------------------------------------
I want output in txt file not in html.

I have opened fallowing url in web browser

http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=ocr
&infile=http://online.verypdf.com/examples/cloud-api/multipage.tif&outfile=out&lang=eng&-format=2

I got the output url in txt
[Output] http://online.verypdf.com/u/public/api/20140704-015936-1482167485-out.txt

when I opened above url I found the only text not position of text.I want output as txt file with fallowing pattern-

########################################################
[Page #1] *** initial words ***
word: x=157.06..188.76 y=18.60..32.55 base=30.17 fontSize=11.52 rot=0 link=00000000 'Home'
word: x=197.88..257.12 y=18.60..32.55 base=30.17 fontSize=11.52 rot=0 link=00000000 'PDF-Tools'
word: x=266.21..287.18 y=18.60..32.55 base=30.17 fontSize=11.52 rot=0 link=00000000 'Doc'
word: x=288.38..323.97 y=18.60..32.55 base=30.17 fontSize=11.52 rot=0 link=00000000 'ument'
word: x=333.65..379.00 y=18.60..32.55 base=30.17 fontSize=11.52 rot=0 link=00000000 'Support'
[Page #1] *** flows ***
flow: x=157.06..379.00 y=18.60..32.55 pri:0.00..709.00
block: rot=0 x=157.06..379.00 y=18.60..32.55 pri=0.00..709.00
line:
word: x=157.06..188.76 y=18.60..32.55 base=30.17 fontSize=11.52 space=1: 'Home'
word: x=197.88..257.12 y=18.60..32.55 base=30.17 fontSize=11.52 space=1: 'PDF-Tools'
word: x=266.21..287.18 y=18.60..32.55 base=30.17 fontSize=11.52 space=1: 'Doc'
word: x=288.38..323.97 y=18.60..32.55 base=30.17 fontSize=11.52 space=1: 'ument'
word: x=333.65..379.00 y=18.60..32.55 base=30.17 fontSize=11.52 space=0: 'Support'
[Page #1] *** line fragments ***
line: x=157.06..379.00 y=18.60..32.55 base=30.17 'Home PDF-Tools Doc ument Support'
line: x=65.66..643.64 y=46.95..72.70 base=68.32 'Advanced PDF Tools Command Line User Manual'
line: x=8.87..94.23 y=86.81..100.76 base=98.39 'Version: v2.0'
line: x=8.87..79.14 y=117.82..137.13 base=133.85 'Content'
line: x=65.66..71.62 y=160.34..169.14 base=167.50 'l'
line: x=79.86..133.67 y=155.91..169.86 base=167.49 'Overview'
line: x=65.66..71.62 y=177.17..185.97 base=184.33 'l'
line: x=79.86..131.13 y=172.74..186.69 base=184.31 'Features'
########################################################
Is it possible to provide the data in given format with this OCR Cloud Api?

Thanks & Regards
Customer
----------------------------------------------------------------------------


We have finished a new version of OCR Cloud API for you, the new option is "dumpwordpos=1", you can use "dumpwordpos=1" option to extract position for each word, you can execute following URL,

http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=ocr
&infile=https://dl.dropboxusercontent.com/u/5570462/verypdf-cloud-api/multipage.tif&format=1&dumpwordpos=1

You can replace "infile" option with any TIFF image file, after you executed above URL, you will get the OCR result like below, you can parse page number, left, top, right bottom positions for each word easily,

***** page_1; image "20140726-205152-7219784263.tif"; bbox 0 0 2000 2388; ppageno 0
[23 32 262 74] 'Universal'
[278 31 569 73] 'Declaration'
[586 31 637 73] 'of'
[649 31 836 72] 'Human'
[853 30 1012 83] 'Rights'
[24 152 197 186] 'Whereas'
[212 151 438 196] 'recognition'
[453 150 497 185] 'of'
[507 150 567 185] 'the'
[582 150 745 185] 'inherent'
[759 150 899 195] 'dignity'
[914 149 983 184] 'and'
[998 149 1041 184] 'of'
[1051 149 1111 184] 'the'
[1126 149 1232 194] 'equal'
[1249 148 1319 183] 'and'
[1334 148 1551 183] 'inalienable'
[1565 148 1677 193] 'rights'
[1692 148 1736 183] 'of'
[1748 148 1794 183] 'all'
[25 209 206 244] 'members'
[222 209 265 244] 'of'
[275 209 334 244] 'the'
***** page_2; image "20140726-205152-7219784263.tif"; bbox 0 0 2000 1888; ppageno 1
[27 35 186 70] 'national'
[202 46 243 70] 'or'
[257 35 371 70] 'social'
[387 35 515 81] 'origin,'
[530 42 710 81] 'property,'
[725 36 819 71] 'birth'
[834 47 875 71] 'or'
[888 36 990 71] 'other'
[1004 42 1125 71] 'status.'
[26 134 287 175] 'Furthermore,'
[303 145 351 169] 'no'
[367 134 576 170] 'distinction'
[592 135 683 170] 'shall'
[697 135 743 170] 'be'
[757 135 864 170] 'made'
[879 146 927 170] 'on'
[942 135 1001 170] 'the'
[1015 135 1113 170] 'basis'
[1129 135 1172 170] 'of'
[1182 136 1241 170] 'the'
[1255 135 1430 181] 'political,'
[1441 136 1708 181] 'jurisdictional'
[1724 147 1764 171] 'or'
[26 192 278 227] 'international'
***** page_3; image "20140726-205152-7219784263.tif"; bbox 0 0 1912 2004; ppageno 2
[32 42 107 66] 'was'
[122 31 346 66] 'committed.'
[362 32 441 66] 'Nor'
[455 31 547 66] 'shall'
[562 42 583 66] 'a'
[596 31 742 66] 'heavier'
[755 31 902 77] 'penalty'
[915 31 961 66] 'be'
[976 31 1145 77] 'imposed'
[1159 31 1243 66] 'than'
[1257 31 1316 66] 'the'
[1331 42 1401 66] 'one'
[1416 31 1490 66] 'that'
[1504 42 1580 66] 'was'
[1597 31 1799 77] 'applicable'
***** page_4; image "20140726-205152-7219784263.tif"; bbox 0 0 2004 2000; ppageno 3
[29 40 218 85] 'Everyone'
[233 39 297 74] 'has'
[312 39 371 74] 'the'
[386 38 480 84] 'right'
[494 44 531 73] 'to'
[546 38 712 73] 'freedom'
[726 37 770 73] 'of'
[780 37 943 82] 'thought,'
[958 36 1176 72] 'conscience'
[1192 36 1262 71] 'and'
[1276 36 1442 81] 'religion;'
[1458 36 1528 70] 'this'
[1543 35 1636 81] 'right'
[1651 35 1814 70] 'includes'
[30 97 195 132] 'freedom'
***** page_5; image "20140726-205152-7219784263.tif"; bbox 0 0 1984 2628; ppageno 4
[22 31 212 75] 'Everyone'
[227 30 292 65] 'has'
[306 30 366 64] 'the'
[380 30 474 75] 'right'
[488 35 525 64] 'to'
[540 35 611 64] 'rest'
[626 29 696 64] 'and'
[710 29 853 70] 'leisure,'
[869 29 1057 74] 'including'
[1071 28 1284 64] 'reasonable'
[1299 28 1492 64] 'limitation'
[1507 28 1551 63] 'of'
[1561 28 1726 74] 'working'
[1740 28 1849 63] 'hours'
[1864 28 1934 63] 'and'
[22 87 184 133] 'periodic'
[200 87 367 133] 'holidays'
[382 87 469 122] 'with'
[483 98 564 133] 'pay.'

If you encounter any problem with "dumpwordpos=1" in OCR Cloud API, please feel free to let us know, we are glad to assist you asap.

VeryPDF

See Also:
https://www.verypdf.com/wordpress/201406/how-to-use-verypdf-cloud-api-ocr-sdk-for-automation-and-getting-coordinate-position-of-text-on-image-40675.html

VN:F [1.9.20_1166]
Rating: 10.0/10 (5 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
How to use OCR Cloud API to extract text positions or coordinates from TIFF image files?, 10.0 out of 10 based on 5 ratings

Related Posts

2 Replies to “How to use OCR Cloud API to extract text positions or coordinates from TIFF image files?

  1. Hi,

    I’ve been researching a way to take a pdf invoice and convert it to xml or
    json with each of the key fields and the line items. i would be looking at
    connecting it with a PHP applications so your online api is of interest to
    me.

    The invoices can come in a number of different layouts from each of our
    suppliers. is your software able to help here?

    Thanks
    Customer

    VN:F [1.9.20_1166]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.20_1166]
    Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!