Skip to main content

Add Barcode to PDF using n8n action

PDF4me Add Barcode to PDF enhances PDF documents by adding customizable barcodes and QR codes through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to generate 100+ barcode types (QR Code, Code 128, Data Matrix, EAN-13, PDF417, etc.) with precise positioning, customizable sizing, opacity control, and flexible alignment options. This solution is ideal for document tracking, inventory management, asset labeling, automated workflows, and compliance requirements that need reliable barcode generation with professional formatting and seamless integration.

Setup

Add the PDF4me "Add Barcode to PDF" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.

Prerequisites:

  • PDF4me API credentials
  • n8n workflow access

Configuration:

  1. Add PDF4me node to workflow
  2. Select "Add Barcode to PDF" action
  3. Configure input parameters (see below)
Add Barcode to PDF

Parameters

Complete list of parameters for the Add Barcode to PDF action. Configure these parameters to control barcode placement and appearance.

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

ParameterTypeDescriptionExample
Input Data Type***StringPDF Input Format Selection
• Choose the format of your PDF data input
• PDF4me supports multiple input types with different field requirements
• Options: Binary Data, Base64 String, or URL
Binary Data
Input Binary FieldBinaryBinary PDF File Input (Required if Binary Data)
• Reference PDF file from previous n8n node or file upload
• PDF4me processes binary PDF files with automatic format detection
• Required when Input Data Type is "Binary Data"
{{ $binary.data }}
Base64 Document ContentStringBase64 Encoded PDF Input (Required if Base64 String)
• Provide PDF data as base64 encoded string
• PDF4me automatically decodes and processes the PDF content
• Required when Input Data Type is "Base64 String"
UEsDBBQABgAI...
File URLStringPublic PDF URL Input (Required if URL)
• Provide a public/open permission URL to the PDF file
• PDF4me downloads and processes the file from the provided URL
• Required when Input Data Type is "URL"
https://abc.com/xyz.pdf
Barcode Text***StringBarcode Content Data
• Specify the text, data, or URL to encode in the barcode
• This content determines what the barcode contains when scanned
• Supports alphanumeric characters, URLs, and special data
PDF4me Barcode Sample
Barcode Type***EnumBarcode Format Selection
• Choose from 100+ barcode types (1D linear, 2D matrix, postal, healthcare)
• Different types support varying data capacities and scanning requirements
• Select based on industry standards and use case requirements
• Common types: QR Code, Code 128, Data Matrix, Aztec, PDF417, EAN-13
QR Code
Pages***StringPage Range Specification
• Define which pages should receive barcode enhancement
• Use comma-separated values and ranges for flexible targeting
• Examples: "" (all pages), "0" (first page), "0, 2, 4" (multiple), "1-5" (range)
• Essential for precise barcode placement control
1-3
Horizontal Alignment***StringBarcode Horizontal Position
• Control the horizontal placement of the barcode on the page
• Options: Left, Center, Right
• Determines barcode position relative to page margins
• Essential for professional document layout
Center
Vertical Alignment***StringBarcode Vertical Position
• Control the vertical placement of the barcode on the page
• Options: Top, Middle, Bottom
• Determines barcode position relative to page margins
• Essential for professional document layout
Bottom
Height in mm***StringBarcode Height Dimension
• Set the height of the barcode in millimeters
• Recommended: QR Codes (40mm), 1D Barcodes (20mm), DataMatrix (20mm)
• Enter "0" for auto-sizing based on barcode type
• Essential for barcode readability and scanning
40
Width in mm***StringBarcode Width Dimension
• Set the barcode width in millimeters
• Use "0" for auto-sizing based on barcode type and data
• Controls horizontal dimension for optimal scanning
• Balance size with document layout
40
Margin Horizontal In mm***StringHorizontal Margin Spacing
• Set the horizontal spacing from page edge in millimeters
• Controls distance between barcode and page boundaries
• Works with horizontal alignment setting
• Essential for proper barcode placement
20
Margin Vertical In mm***StringVertical Margin Spacing
• Set the vertical spacing from page edge in millimeters
• Controls distance between barcode and page boundaries
• Works with vertical alignment setting
• Prevents overlap with document content
20
Height In Pt***StringBarcode Height in Points
• Set the barcode height in points (1/72 inch)
• Provides typography-based sizing for document layout
• Use "0" for auto-sizing
• Alternative to millimeter-based sizing
20
Width In Pt***StringBarcode Width in Points
• Set the barcode width in points (1/72 inch)
• Provides typography-based sizing for document layout
• Use "0" for auto-sizing
• Alternative to millimeter-based sizing
20
Margin X In Pt***StringHorizontal Margin in Points
• Set the horizontal margin from page edge in points (1/72 inch)
• Provides typography-based spacing for document layout
• Works with horizontal alignment
10
Margin Y In Pt***StringVertical Margin in Points
• Set the vertical margin from page edge in points (1/72 inch)
• Provides typography-based spacing for document layout
• Works with vertical alignment
10
Opacity***IntegerBarcode Transparency Level
• Range from 0 (invisible) to 100 (fully opaque)
• 100 for standard scanning, 30-50 for watermark effects
• Controls barcode visibility and background blending
• Essential for professional document design
100
Display Text***StringBarcode Text Display Position
• Set the text position relative to barcode
• Options: above, below
• Controls where display text appears
• Essential for barcode labeling and readability
below
Hide Text***BooleanText Visibility Control
• Control whether to hide barcode text display
• true = hide text, false = show text
• Allows for clean barcode presentation
• Essential for minimalist design
false
Show Only In Print***BooleanPrint-Only Display Control
• Control whether barcode appears only in printed version
• true = print only, false = screen and print
• Useful for print-optimized workflows
• Maintains clean screen display
false
Is Text Above***BooleanText Positioning Control
• Control whether text appears above the barcode
• true = text above, false = text below
• Provides precise text positioning control
• Works with Display Text setting
false
Binary Data Output NameStringBinary Data Output Mapping
• Define the variable name for the generated PDF binary data
• Used to access enhanced PDF in subsequent workflow steps
• Essential for workflow automation and data flow
• Default is "data" if not specified
data

Advanced Options

The following parameters are available in the Advanced Options section and are optional:

ParameterTypeDescriptionExample
Custom ProfilesStringCustom Configuration Profiles
• Set additional options using custom profiles
• JSON-like format containing predefined parameters
• Enables advanced barcode generation settings
• Optional for specialized requirements
{ "outputDataFormat": "base64", "preserveMetadata": true }
Output File NameStringOutput Filename
• Specify a custom name for the output PDF file
• If not provided, system generates default filename
• Supports dynamic naming from workflow variables
• Helps with file organization
output_with_barcode.pdf

Output

Output Parameters

ParameterTypeDescriptionExample
fileNameStringPDF4me enhanced PDF filename - The complete filename of the successfully generated PDF document with barcode enhancements with proper .pdf extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processesdocument_with_barcode.pdf
mimeTypeStringPDF4me enhanced PDF MIME type - The MIME type of the generated PDF file with barcodes, indicating the file format for proper handling in web applications and file systemsapplication/pdf
fileSizeNumberPDF4me enhanced PDF file size in bytes - The exact size of the generated PDF file with barcodes in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise document management and workflow automation104989
successBooleanPDF4me barcode enhancement status indicator - Boolean flag indicating the success or failure of the PDF barcode enhancement process. PDF4me returns true for successful enhancements and false for any errors, enabling robust error handling in automated workflowstrue
messageStringPDF4me enhancement status message - Human-readable status message providing details about the barcode enhancement process result. Includes success confirmation or error details for troubleshootingBarcode added to PDF successfully

N8N Action Response

The PDF4me Add Barcode to PDF API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:

JSON Response Format

The raw JSON response from the API:

{
"fileName": "document_with_barcode.pdf",
"mimeType": "application/pdf",
"fileSize": 104989,
"success": true,
"message": "Barcode added to PDF successfully"
}

Use Cases

Inventory Management and Asset Tracking

  • Automatically add unique barcodes to product catalogs, inventory sheets, and asset documentation for streamlined scanning and tracking operations in warehouses and retail environments
  • Process shipping labels and logistics documents by embedding tracking barcodes that integrate with warehouse management systems for automated package routing and delivery confirmation
  • Generate compliance documents with industry-standard barcodes for healthcare equipment, pharmaceutical packaging, and regulated products to meet FDA and international standards

Document Authentication and Security

  • Enhance legal contracts and official documents with QR codes containing digital signatures, verification links, and tamper-proof identifiers for secure document authentication
  • Process identification documents and certificates by adding unique barcodes that link to verification databases, ensuring document authenticity and preventing counterfeiting
  • Create secure access documents with embedded barcodes that integrate with building security systems and visitor management platforms for controlled facility access

Marketing and Customer Engagement

  • Generate promotional materials and marketing collateral with QR codes that link to product information, special offers, and interactive content for enhanced customer engagement
  • Process event tickets and admission passes with unique barcodes that enable quick entry validation, attendee tracking, and post-event analytics for event management
  • Create interactive business cards and contact materials with QR codes containing contact information, social media links, and portfolio access for seamless networking

Get Help