Barcode Reader#
Available Methods#
/barcode/read/from/url#
Read barcodes from images and PDF. Can read all popular barcode types from QR Code and Code 128, EAN to Datamatrix, PDF417, GS1 and many other barcodes.
Method: POST
Endpoint: /v1/barcode/read/from/url
Attributes#
Note
Attributes are case-sensitive and should be inside JSON for POST request, for example:
{
"url": "https://example.com/file1.pdf"
}
Attribute |
Description |
Required |
---|---|---|
|
URL to the source file. 1 |
yes |
|
HTTP auth user name if required to access source |
no |
|
HTTP auth password if required to access source |
no |
|
Comma-separated indices of pages (or page ranges) that you want to use. The first-page index is always 0. For example, if you have a 7-page document that you want to be split into 3 separate PDFs but a different number of pages it would go like this: 0, 1, 2- or 1, 2, 3-7 which will result in 1 PDF with page one, 1 PDF with page two and one PDF with the rest of the pages. You can also use inverted page numbers adding |
no |
|
Set the barcode type, must be in a |
no |
|
See Optical Marks Reader. Comma-separated list of object types to decode, must be in a
|
no |
|
Set |
no |
|
Use this parameter to set additional configurations for fine-tuning and extra options. Explore the Profiles section for more. |
no |
Supported Barcode Types#
The supported barcode types are as follows:
Name |
Type |
Character Set |
Length |
Notes |
---|---|---|---|---|
|
2D |
Numbers Only |
4 |
|
|
2D |
Full ASCII; FNC1 and ESI control codes |
Variable, Min 12 - Max 3832 |
|
|
Linear |
Numbers: 0-9; Symbols: - : . $ / + Start/Stop Characters: A, B, C, D, E, |
Variable |
|
|
Complex - see this guide. |
|||
|
Linear |
All ASCII characters and control codes |
Variable |
|
|
||||
|
Linear |
Uppercase letters A-Z; Numbers 0-9; Space - . $ / + % |
Variable |
|
|
Linear |
All ASCII characters and control codes |
Variable |
|
|
||||
|
||||
|
Linear |
Uppercase letters A-Z; Numbers 0-9; Space - . $ / + % |
||
|
2D |
All ASCII characters |
Variable |
|
|
||||
|
Linear |
Numbers Only |
13 + check digit +2 optional +5 optional |
|
|
Linear |
Numbers only |
Exact 2 Numbers |
|
|
Linear |
Numbers Only |
Exact 5 Numbers |
|
|
Linear |
Numbers Only |
7 + check digit |
|
|
Linear |
ASCII symbols |
128 ASCII symbols |
|
|
Linear |
String |
74 numeric or 41 alphabetic characters |
|
|
Linear |
String |
74 numeric or 41 alphabetic characters |
|
|
Linear |
Numbers Only |
Upto 14 digits |
Last digit must be checksum and will be verified |
|
Linear |
Numbers Only |
Upto 14 digits |
Last digit must be checksum and will be verified |
|
Linear |
Numbers Only |
Upto 14 digits |
Last digit must be checksum and will be verified |
|
Linear |
Numbers Only |
Expects 11 digits. User may enter 12th digit |
|
|
Linear |
Numbers Only |
Expects 12 digits. User may enter 13th digit |
|
|
Linear |
Numbers Only |
Expects 13 digits. User may enter 14th digit |
|
|
Linear |
Numbers Only |
Expects 7 digits. User may enter 8th digit |
|
|
Linear |
Numbers Only |
Upto 31 digits of data |
Tracking code should be exactly 20 digits long and Rounding code may be 0,5,9 or 11 digits long. Spaces and dots are allowed as separators. |
|
Linear |
Numbers Only |
EVEN if checksum is not to be added, ODD if checksum is to be added |
|
|
Linear |
Numbers Only |
Expects 13 digits. User may enter 14th digit which will be verified. |
|
|
2D |
All ASCII characters |
93 |
|
|
||||
|
2D |
String |
1850 characters or 2710 digits |
|
|
Linear |
Numbers Only |
Variable |
|
|
||||
|
Linear |
This symbology supports all 256 ASCII characters and 8-bit binary data. |
Variable |
|
|
Linear |
Decimal Numbers |
Number can be between 1 to 131070 |
|
|
Postal |
Numbers Only |
5 + check digit +4 optional +6 optional |
|
|
Linear |
Numbers Only |
Excatly 6 or 7 digits |
|
|
2D |
All ASCII characters |
Variable |
|
|
Postal |
Digits and characters from A to Z |
||
|
Postal |
All numeric digits (0-9). All uppercase letters (A-Z) |
Variable |
|
|
||||
|
Linear |
Numbers Only |
11 + check digit +2 optional +5 optional |
|
|
Linear |
Numbers Only |
UPC-E encodes 6 digits of numeric message data together with a number system digit and a check digit, for a total of 8 digits. |
|
|
Postal |
Query parameters#
No query parameters accepted.
Payload#
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"types": "QRCode,Code128,Code39,Interleaved2of5,EAN13",
"pages": "0",
"async": false
}
Response 2#
{
"barcodes": [
{
"Value": "abcdef123456",
"RawData": "",
"Type": 14,
"Rect": "{X=448,Y=23,Width=106,Height=112}",
"Page": 0,
"File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"Confidence": 1,
"Metadata": "",
"TypeName": "QRCode"
},
{
"Value": "test123",
"RawData": "",
"Type": 2,
"Rect": "{X=111,Y=60,Width=255,Height=37}",
"Page": 0,
"File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"Confidence": 0.90625155,
"Metadata": "",
"TypeName": "Code128"
},
{
"Value": "123456",
"RawData": "",
"Type": 4,
"Rect": "{X=111,Y=129,Width=306,Height=37}",
"Page": 0,
"File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"Confidence": 0.7710818,
"Metadata": "",
"TypeName": "Code39"
},
{
"Value": "<FNC1>0112345678901231",
"RawData": "",
"Type": 2,
"Rect": "{X=111,Y=198,Width=305,Height=37}",
"Page": 0,
"File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"Confidence": 0.9156459,
"Metadata": "",
"TypeName": "Code128"
},
{
"Value": "12345670",
"RawData": [
1,
2,
3,
4,
5,
6,
7,
0
],
"Type": 5,
"Rect": "{X=111,Y=267,Width=182,Height=0}",
"Page": 0,
"File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"Confidence": 1,
"Metadata": "",
"TypeName": "I2of5"
},
{
"Value": "1234567890128",
"RawData": "",
"Type": 6,
"Rect": "{X=102,Y=336,Width=71,Height=72}",
"Page": 0,
"File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"Confidence": 0.895925164,
"Metadata": "",
"TypeName": "EAN13"
}
],
"pageCount": 1,
"error": false,
"status": 200,
"remainingCredits": 99826192,
"credits": 35
}
CURL#
curl --location --request POST 'https://api.pdf.co/v1/barcode/read/from/url' \
--header 'x-api-key: ' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
"types": "QRCode,Code128,Code39,Interleaved2of5,EAN13",
"pages": "0",
"async": false
}'
Optical Marks Reader#
Our barcode reader engine can also find the following marks and objects on scanned documents:
Checkboxes
Radioboxes
Vertical and horizontal lines
General segments (basically, all content types on the page).
Payload#
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-html/sample.pdf",
"types": "Checkbox,UnderlinedField",
"async": false
}
Response 2#
{
"barcodes": [
{
"Value": "box",
"RawData": "",
"Type": 53,
"Rect": "{X=298,Y=437,Width=132,Height=6}",
"Page": 0,
"File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-html/sample.pdf",
"Confidence": 1,
"Metadata": "",
"TypeName": "UnderlinedField"
}
],
"pageCount": 1,
"error": false,
"status": 200,
"duration": 860,
"remainingCredits": 98725528,
"credits": 35
}
CURL#
curl --location --request POST 'https://api.pdf.co/v1/barcode/read/from/url' \
--header 'x-api-key: ' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-html/sample.pdf",
"types": "Checkbox,UnderlinedField",
"async": false
}'
Code samples#
Footnotes
- 1
Supports links from Google Drive, Dropbox, and PDF.co Built-In Files Storage. To upload files via the API check out the File Upload section. Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add
cache:
to enable built-in URL caching. (e.gcache:https://example.com/file1.pdf
) For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.- 2(1,2)
Main response codes as follows:
Code
Description
200
Success
400
Bad request. Typically happens because of bad input parameters, or because the input URLs can’t be reached, possibly due to access restrictions like needing a login or password.
401
Unauthorized
402
Not enough credits
445
Timeout error. To process large documents or files please use asynchronous mode (set the
async
parameter totrue
) and then check status using the /job/check endpoint. If a file contains many pages then specify a page range using thepages
parameter. The number of pages of the document can be obtained using the /pdf/info endpoint.Note
For more see the complete list of available response codes.