PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

The node operation "Add Barcode To PDF" allows users to embed a barcode into an existing PDF document. This is useful for scenarios where you want to add machine-readable information such as tracking numbers, product codes, or URLs directly onto PDF files. Common use cases include adding QR codes for quick access to web resources, encoding inventory or shipment data with Code 128 barcodes, or embedding other barcode types for document management and automation.

For example, a logistics company could automatically add a barcode containing shipment details to delivery PDFs, or a marketing team might add QR codes linking to promotional content on brochures in PDF format.

Properties

Name Meaning
Input Data Type How the PDF file is provided:
- Binary Data (from previous node)
- Base64 String (encoded PDF content)
- URL (link to PDF file)
Input Binary Field The name of the binary property containing the PDF file when using Binary Data input type (usually "data").
Base64 PDF Content The base64 encoded string representing the PDF document content (used if Input Data Type is Base64).
PDF URL The URL pointing to the PDF file to which the barcode will be added (used if Input Data Type is URL).
Barcode Text The text string that will be encoded inside the barcode.
Barcode Type The type of barcode to add. Options include:
- QR Code
- Code 128
- Data Matrix
- Aztec
- Han Xin
- PDF417
- EAN-13
- UPC-A
- Code 39
- Code 93
- Codabar
- Interleaved 2 of 5
Pages Specifies pages to add the barcode to. Can be empty (all pages), single page ("1"), multiple pages ("1,3,5"), ranges ("2-5"), combined lists and ranges ("1,3,7-10"), or open-ended ranges ("2-").
Positioning Collection of options defining barcode placement:
- Horizontal Alignment: Left, Center, Right
- Vertical Alignment: Top, Middle, Bottom
- Horizontal Margin (mm)
- Vertical Margin (mm)
Barcode Size Collection specifying barcode dimensions:
- Height (mm)
- Width (mm)
- Height (points)
- Width (points)
Use 0 for auto-detect sizing.
Appearance Collection controlling visual aspects:
- Opacity (0-100)
- Display Text position (Above or Below)
- Hide Text (boolean)
- Show Only in Print (boolean)
- Text Above Barcode (boolean)
Output Options Collection for output customization:
- Output File Name (name of resulting PDF)
- Custom Profiles (JSON string for advanced settings, e.g., output format)

Output

The node outputs the modified PDF file with the barcode embedded according to the specified parameters. The output is typically provided as binary data representing the updated PDF document. The output file can be named as specified in the "Output File Name" property.

If configured, the output may also be available as a base64 encoded string depending on custom profile settings.

Dependencies

  • Requires access to the PDF file either via binary data from a previous node, a base64 encoded string, or a URL.
  • Needs an API key credential or similar authentication token configured in n8n to interact with the underlying PDF processing service.
  • Network access is required if providing the PDF via URL.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible PDF URL: Ensure the URL is reachable and points to a valid PDF file.
    • Incorrect binary field name: Verify the binary property name matches the actual input binary data.
    • Unsupported barcode text or type: Confirm the barcode text is compatible with the selected barcode type.
    • Page specification errors: Validate the page range syntax; invalid formats may cause failures.
    • Output file naming conflicts: Avoid using names that conflict with existing files or contain invalid characters.
  • Error messages:

    • "Failed to fetch PDF from URL": Check network connectivity and URL correctness.
    • "Invalid binary data": Confirm the binary input contains a valid PDF file.
    • "Barcode generation error": Review barcode text and type compatibility.
    • "Page range parsing error": Correct the pages input format.

Resolving these usually involves verifying inputs and ensuring proper configuration of credentials and network access.

Links and References

Discussion