API V2

Add Barcode to PDF

Transform your PDF documents with our powerful barcode API that supports 150+ barcode types including QR codes, Code128, DataMatrix, Aztec, Hanxin, and PDF417. Perfect for inventory systems, shipping labels, document tracking, and automated workflows.

Key Features:

  • 150+ Barcode Types: QR Code, Code128, DataMatrix, Aztec, Hanxin, PDF417, and more
  • Flexible Positioning: Place barcodes anywhere on your PDF with pixel-perfect control
  • Multiple Formats: Support for both millimeters and points for precise sizing
  • Text Display Options: Show or hide barcode text, position above or below
  • Opacity Control: Adjust transparency for watermark effects
  • Batch Processing: Add barcodes to multiple pages or documents

Popular Use Cases:

  • E-commerce: Product catalogs with barcode labels
  • Logistics: Shipping labels and tracking documents
  • Healthcare: Patient records and medication administration
  • Government: ID documents and compliance forms
  • Education: Student IDs and library systems

This barcode generator API integrates seamlessly with your existing workflows, providing enterprise-grade reliability and performance.

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

Authenticating Your API Request

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


Supported Barcode Types

Supports 150+ barcode types for comprehensive PDF integration.

Popular 1D Barcodes

  • Code128 - Universal barcode (255 chars max)
  • Code39 - Alphanumeric barcode (43 chars max)
  • EAN13/EAN8 - Retail product codes (13/8 chars)
  • UPC-A/UPC-E - North American retail (12/8 chars)

Popular 2D Barcodes

  • QR Code - Mobile scanning (4,296 chars max)
  • DataMatrix - High-density 2D (2,335 chars max)
  • PDF417 - Large data capacity (2,710 chars max)
  • Aztec - Excellent error correction (3,832 chars max)

Specialized Formats

  • Postal Codes: USPS, Royal Mail, Australia Post, Deutsche Post
  • Healthcare: HIBC, GS1 DataBar, Pharmacode
  • Logistics: MaxiCode, SSCC-18, ITF-14, GS1-128
  • QR Variants: Micro QR, iQR, rMQR

Technical Requirements

  • Print Size: 10mm x 10mm minimum for mobile scanning
  • Resolution: 300 DPI minimum
  • Contrast: 70% minimum for reliable scanning

PDF4me api samples

CSharp(C#)
Java
JavaScript
Python
Salesforce
Google Script
AWS Lambda

API Parameters

Complete list of parameters for the Add Barcode to PDF API. Parameters are organized by category for better understanding and implementation.

Document ContentBase64, Required

PDF document content encoded in Base64 format.

Example:JVBERi0xLjQKJcOkw7zDtsO8CjIgMCBvYmoKPDwKL0xlbmd0aCAzIDAgUgo+PgpzdHJlYW0K...

Document Namestring, Required

Name of the source PDF file with .pdf extension.

Examples:document.pdf, invoice-2024.pdf

Barcode Datastring, Required

Data to be encoded into the barcode (text, numbers, URLs, etc.).

Examples:Hello World, https://example.com, ABC123456

Barcode Typestring, Required

Type of barcode to generate. Choose from 150+ supported formats.

Popular Types:qrCode, code128, dataMatrix, ean13, upcA

Target Pagesstring, Required

Pages to add barcodes to. Use comma-separated values and ranges.

Examples:"" (all), "0" (first page), "0, 2, 4" (multiple), "1-5" (range)

Horizontal Alignmentstring, Required

Control the horizontal positioning of the barcode on the page. This determines where the barcode appears horizontally relative to the page margins.

Options:

  • Left - Align to the left edge of the page
  • Center - Center horizontally on the page
  • Right - Align to the right edge of the page

Example:"Center" will place the barcode in the middle of the page horizontally.

Vertical Alignmentstring, Required

Control the vertical positioning of the barcode on the page. This determines where the barcode appears vertically relative to the page margins.

Options:

  • Top - Align to the top edge of the page
  • Middle - Center vertically on the page
  • Bottom - Align to the bottom edge of the page

Example:"Bottom" will place the barcode at the bottom of the page vertically.

Barcode Height (mm)string, Required

Set the height of the barcode in millimeters. This controls the vertical size of the generated barcode.

Recommended Heights:

  • QR Codes: 20-60mm (40mm recommended)
  • 1D Barcodes: 15-30mm (20mm recommended)
  • DataMatrix: 10-40mm (20mm recommended)

Auto-sizing: Enter "0" to let the system automatically determine the optimal height based on the barcode type and data.

Example:"40" creates a 40mm tall barcode.

Width in mmstring, Required

Barcode width in millimeters. Use ‘0’ for auto-sizing.

Example:40 (40mm wide)

Margin Horizontal In mmstring, Required

Left margin from page edge in millimeters.

Example:20 (20mm from left edge)

Margin Vertical In mmstring, Required

Top margin from page edge in millimeters.

Example:20 (20mm from top edge)

Height In PtString, Required

Barcode height in points. Use ‘0’ for auto-sizing.

Example:20 (20 points tall)

Width In PtString, Required

Barcode width in points. Use ‘0’ for auto-sizing.

Example:20 (20 points wide)

Margin X In PtString, Required

Top margin from page edge in points.

Example:10 (10 points from top edge)

Margin Y In PtString, Required

Left margin from page edge in points.

Example:10 (10 points from left edge)

Opacityinteger, Required

Transparency level from 0 (invisible) to 100 (fully opaque).

Example:100 (no transparency)

Display TextString, Required

Text position relative to barcode.

Options:above, below

Hide TextBoolean, Required

Hide barcode text.

Options:true (hide text), false (show text)

Show Only In PrintBoolean, Required

Show barcode only in printed version.

Options:true (print only), false (screen and print)

Is Text AboveBoolean, Required

Position text above barcode.

Options:true (above), false (below)


Output

The API returns the processed PDF document with embedded barcodes. The response includes the file content and metadata for easy integration into your application workflow.

File ContentBinary

Binary content of the processed PDF document with embedded barcodes. Ready for download or further processing.

File NameString

Filename for the processed PDF document. Can be customized or auto-generated based on your requirements.

Header
Content-Type: application/json
Authorization: Please copy key from the link.

Payload

{
  "alignX": "Right",
  "alignY": "Top",
  "docContent": "Please put PDF base64 content",
  "docName": "output.pdf",
  "text": "hello",
  "barcodeType": "qrCode",
  "pages": "2",
  "heightInMM": "40",
  "widthInMM": "40",
  "marginXInMM": "20",
  "marginYInMM": "20",
  "heightInPt": "20",
  "widthInPt": "20",
  "marginXInPt": "10",
  "marginYInPt": "10",
  "opacity": 100,
  "displayText": "above",
  "hideText": true,
  "showOnlyInPrint": false,
  "isTextAbove": true
}

Industry Use Cases & Applications

E-commerce & Retail

  • Product Catalogs: Generate barcodes for inventory management and product identification
  • Price Tags: Create dynamic pricing with barcode integration for automated checkout
  • Order Tracking: Add tracking codes to shipping documents for real-time package monitoring
  • Inventory Systems: Bulk barcode generation for warehouse management and stock control

Logistics & Shipping

  • Shipping Labels: Add tracking barcodes to delivery documents for package traceability
  • Package Tracking: Generate unique identifiers for each shipment across the supply chain
  • Warehouse Management: Create barcodes for bin locations and product identification
  • Supply Chain: Track products through entire distribution network with embedded codes

Healthcare & Medical

  • Patient Records: Add barcodes for quick patient identification and medical history access
  • Medication Administration: Generate barcodes for drug tracking and dosage verification
  • Medical Equipment: Tag equipment with maintenance barcodes for asset management
  • Lab Results: Add barcodes to test result documents for secure patient data linking

Government & Compliance

  • ID Documents: Add security barcodes to driver’s licenses and passports for verification
  • Tax Documents: Generate tracking codes for tax forms and compliance monitoring
  • Compliance Forms: Add barcodes for regulatory tracking and audit trails
  • Public Records: Create searchable document identifiers for government databases

Education & Libraries

  • Student IDs: Generate barcodes for student identification and campus access control
  • Library Systems: Add barcodes to books and resources for automated checkout systems
  • Exam Papers: Create unique identifiers for test documents and academic integrity
  • Campus Services: Track equipment and resource usage across educational facilities

Business & Finance

  • Invoice Processing: Add barcodes for automated invoice handling and payment processing
  • Document Management: Create unique identifiers for business documents and records
  • Asset Tracking: Generate barcodes for equipment and assets across organizations
  • Audit Trails: Add tracking codes for compliance documentation and financial records