Free plan

Read codes in a PDF

Read the QR codes and barcodes found on a PDF's pages
POST
/v1/pdfs/decode-codes

About this tool

This tool looks at the pages of a PDF, which can be a scan or a normal document, and reads every QR code and barcode it finds. It tells you what each code says and on which page it is. You can choose the pages and the types of code, and it can also look harder for small, turned or damaged codes, which takes more time.
For example, you read the tracking number from the barcode on a scanned shipping label.

How to use it

  1. Choose this tool.
  2. Add your PDF with Upload or drag and drop.
  3. Optionally choose the pages and the types of code to look for.
  4. Press Generate.
  5. Read or copy the codes from the result.

What you get back

You get a list of the codes found, with what each one says and the page it is on. You can copy it.
GOOD TO KNOW
A scanned page is read as a picture. Counts as one PDF operation.
TEST IT LIVE

Try Read codes in a PDF in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/decode-codes
Tool ID
pdfs.decode-codes
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/decode-codes" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'pages=1-3' \
  -F 'dpi=200' \
  -F 'formats=["example"]'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.decodeCodes({
    "file": 'document.pdf',
    "pages": "1-3",
    "dpi": 200,
    "formats": [
      "example"
    ]
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->decodeCodes([
    'file' => 'document.pdf',
    'pages' => '1-3',
    'dpi' => 200,
    'formats' => ['example'],
]);
echo $result->requestId;
FAQ

Frequently asked questions

Read every QR code and barcode on the chosen pages of a PDF (a scan or a document), with the page it is on and where, with the same decoder and symbologies as the picture tool.

Read codes in a PDF accepts PDF. You can send several files in one request.

Read codes in a PDF is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/decode-codes with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.