Skip to main content

Read Barcode from PDF - Scanner & Extractor API

PDF4me Read Barcode from PDF enables you to extract and recognize various types of barcodes and QR codes from PDF documents using advanced OCR and barcode recognition technology. This API service processes PDF files and extracts barcode data with position coordinates, type information, and extracted text. The API receives PDF content through REST API calls, utilizing Base64 encoding for secure transmission. With support for 1D and 2D barcodes including QR codes, DataMatrix, PDF417, Code128, and specialized industry formats, this solution is ideal for document processing, inventory management, tracking systems, and workflow automation.

Authenticating Your API Request

To access the PDF4me REST API, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user of the REST API.

Key Features

  • Comprehensive Barcode Recognition: Support for 1D and 2D barcodes including QR codes, DataMatrix, PDF417, Code128, postal codes, and specialized industry formats
  • Seamless PDF Integration: Direct processing of PDF documents with support for all PDF versions and complex document structures
  • Flexible Page Processing: Process specific pages, page ranges, or entire documents with selective barcode extraction capabilities
  • Enterprise Batch Processing: Extract multiple barcodes from single or multiple pages with automated processing workflows
  • Structured Data Output: Return barcode data in structured JSON format with position coordinates, type information, and metadata for easy system integration

Supported Barcode Types

The API supports a comprehensive range of barcode formats for reliable recognition:

1D Barcodes

  • Code128 - Universal barcode format
  • Code39 - Alphanumeric barcode
  • Code93 - High-density barcode
  • Codabar - Numeric barcode
  • EAN8/EAN13 - European Article Number
  • UPC-A/UPC-E - Universal Product Code
  • Inter2of5 - Industrial 2 of 5
  • PatchCode - Document processing codes

2D Barcodes

  • QR Code - Quick Response codes
  • DataMatrix - High-density 2D barcode
  • PDF417 - Portable Data File
  • MicroQRCode - Compact QR variant

Specialized Formats

  • Postal Codes: Postnet, Planet, RM4SCC, Australia Post
  • Intelligent Mail: USPS Intelligent Mail barcodes
  • PharmaCode: Pharmaceutical barcodes
  • RSS Codes: Reduced Space Symbology

REST API Endpoint

The PDF4me REST API uses standard HTTP methods to interact with resources. All barcode reading operations are performed through a single endpoint:

  • Method: POST
  • Endpoint: /api/v2/ReadBarcodes

REST API Parameters

Complete list of parameters for the Read Barcode from PDF REST API. Parameters are organized by category for better understanding and implementation.

Important: Parameters marked with an asterisk (*) are required and must be provided for the API to function correctly.

Required Parameters

ParameterTypeDescriptionExample
docContent*Base64PDF file content encoded in Base64JVBERi...
docName*StringPDF file name with .pdf extensiondocument.pdf
barcodeType*ArrayArray of barcode types to detect. Use ["all"] for all types, or specific types like ["qrCode"], ["dataMatrix", "code128"]["all"]
pages*StringPage options: "all", "1", "1,3,5", "2-5", "1,3,7-10", "2-"all
IsAsync*BooleanEnable asynchronous processing. When true, the API returns a 202 status and provides a polling URL in the Location headertrue

Barcode Type Options

TypeDescriptionCategory
allDetect all supported barcode typesUniversal
unknownDetect unknown barcode typesUniversal
qrCodeQR Code recognition2D
dataMatrixDataMatrix recognition2D
pdf417PDF417 recognition2D
code128Code128 recognition1D
code39Code39 recognition1D
ean13EAN13 recognition1D
upcaUPC-A recognition1D
all_1DAll 1D barcode types1D
all_2DAll 2D barcode types2D

Output

The PDF4me Read Barcode from PDF REST API returns different responses based on the processing mode. The API returns structured JSON data with barcode information.

Synchronous Processing (Default)

When IsAsync is not set or set to false, the API processes the request immediately:

Status Code: 200 OK

Content-Type: application/json

Response Body:

{
"barcodes": [
{
"type": "qrCode",
"text": "Barcode content",
"page": 1,
"x": 100,
"y": 200,
"width": 50,
"height": 50
}
]
}

Response Fields:

  • barcodes (array): Array of detected barcode objects
    • type (string): Barcode type (e.g., "qrCode", "dataMatrix", "code128")
    • text (string): Extracted barcode content/text
    • page (number): Page number where barcode was found
    • x (number): X coordinate of barcode position
    • y (number): Y coordinate of barcode position
    • width (number): Width of the barcode
    • height (number): Height of the barcode

Example (JavaScript):

const response = await fetch(url, options);
const data = await response.json();
data.barcodes.forEach(barcode => {
console.log(`Found ${barcode.type}: ${barcode.text} on page ${barcode.page}`);
});

Request Example

Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY

Note:

  • Get your API key from the PDF4me Dashboard
  • The API key must be Base64 encoded and prefixed with "Basic " in the Authorization header
  • Example: If your API key is abc123, encode it to Base64 and use Authorization: Basic YWJjMTIz

Payload

Example:

{
"docContent": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPD4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Gb250IDw8Ci9GMSA0IDAgUgo+Pgo+PgovQ29udGVudHMgNSAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL1R5cGUgL0ZvbnQKL1N1YnR5cGUgL1R5cGUxCi9CYXNlRm9udCAvSGVsdmV0aWNhCj4+CmVuZG9iago1IDAgb2JqCjw8Ci9MZW5ndGggNDQKPj4Kc3RyZWFtCkJUCi9GMSAxMiBUZgoxMDAgNzAwIFRkCihIZWxsbyBXb3JsZCkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagp4cmVmCjAgNgowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMDkgMDAwMDAgbiAKMDAwMDAwMDA1NCAwMDAwMCBuIAowMDAwMDAwMTAxIDAwMDAwIG4gCjAwMDAwMDAxNzAgMDAwMDAgbiAKMDAwMDAwMDI0NCAwMDAwMCBuIAp0cmFpbGVyCjw8Ci9TaXplIDYKL1Jvb3QgMSAwIFIKPj4Kc3RhcnR4cmVmCjM0MQolJUVPRg==",
"docName": "document.pdf",
"barcodeType": ["all"],
"pages": "all",
"IsAsync": true
}

Code Samples

The PDF4me Read Barcode from PDF REST API provides code samples in multiple programming languages. Choose the language that best fits your development environment:

C# (CSharp) Sample

Complete C# implementation for reading barcodes from PDF documents:

Industry Use Cases & Applications

Finance & Banking Use Cases

  • Invoice Processing: Extract barcode data from invoices for automated payment processing
  • Financial Documents: Process financial documents with barcodes for payment processing
  • Payment Processing: Extract payment information from barcodes in financial documents
  • Banking Integration: Integrate barcode reading into banking applications and systems

Barcode Recognition Features

Detection Capabilities

  • Multi-format Support: Recognition of 1D and 2D barcodes in various formats
  • Position Tracking: Accurate barcode location and positioning data with coordinates
  • Page Selection: Process specific pages or entire documents using page options

Processing Features

  • Batch Recognition: Extract multiple barcodes from single or multiple pages
  • Type Filtering: Specify which barcode types to detect using the barcodeType array
  • Structured Output: Returns barcode data with type, text, page, and position information

Get Help