Read Code128 Barcode using PDF.co and Postman

Sep 2, 2024·4 Minutes Read

In this tutorial, we will show you how to read a Code128 barcode using PDF.co and Postman. Here’s the sample PNG with different types of barcodes. We will use this image to specifically decode the Code128 barcode.

Sample Barcodes Of Code128
Sample Barcode for Code128

Step 1: Setup Postman

First, open the Postman app and click on the PDF.co Postman Collection . If you haven’t set up your PDF.co Postman Collection yet, you can check out our step-by-step guide.

Step 2: Barcode Reader Web API Collection

Next, expand the Barcode Reader folder and choose the Post/barcode/read/from/url . The Barcode Reader API can read all popular barcode types like QR Code, Code 128EAN, DatamatrixPDF417GS1, and more.

Step 3: Barcode Reader Configuration

Now, let’s go over the /barcode/read/from/url endpoint’s parameters.

  • In the url param, type the required URL from the source file.
  • In the types param, type in Code128 because we only want to decode the value for this type of barcode. You can add other barcode types separated by comma.
  • In the pages param, you can specify the page number(s) or page range(s) that you want the reader to go over. Let’s leave the default value to 0 for page 1.
  • The encrypt param is optional. You can set the value to true to enable the output file encryption.
  • The async is recommended when you are working with large files. You can set it to true or false.
Barcode Reader Configuration

Barcode Reader Web API cURL Code Snippet

curl --location --request POST 'https://api.pdf.co/v1/barcode/read/from/url' \
 --header 'x-api-key: your-api-key' \
 --header 'Content-Type: application/json' \ 
--data-raw '{
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/barcode-reader/sample.pdf", 
"types": "Code128",
 "pages": "0", 
"encrypt": false, 
"async": false
 }'

You can now click on the Send button to see the result.

Step 4: Barcode Reader Result

Great! The Barcode Reader Web API successfully decoded the Code128 barcode. You can see the value, url, and type name in the result body.

Code128 Return Value

In this tutorial, you learned how to read the Code128 barcode using PDF.co and Postman. You learned how to set up the PDF.co Postman Collection in the Postman app. You also learned the different Barcode Reader Web API parameters and their functions.

Related Tutorials

See Related Tutorials