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

This node operation, Split PDF By Swiss QR, processes PDF documents containing Swiss QR codes and splits the PDF into multiple parts based on the location of these QR codes. It is particularly useful in scenarios where a single PDF contains multiple invoices or payment slips each identified by a Swiss QR code, and you want to separate them into individual documents for further processing or archiving.

Typical use cases include:

  • Automating invoice processing workflows by splitting batch PDFs into individual invoices.
  • Extracting payment slips from combined documents for accounting systems.
  • Preparing documents for targeted distribution based on QR code data.

The node supports different input methods for the PDF (binary data, base64 string, or URL) and offers options to control how the split occurs relative to the page containing the Swiss QR code, as well as whether consecutive pages with the same QR code should be combined.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF data:
- Base64 String: Provide PDF content as a base64 encoded string.
- Binary Data: Use PDF file from previous nodes.
- URL: Provide URL to PDF file.
Binary Property Name The name of the binary property that contains the PDF file when using binary data input type.
Base64 Content The base64 encoded PDF content when using base64 string input type.
PDF URL The URL to the PDF file when using URL input type.
Split QR Page Defines where to split relative to the Swiss QR page:
- After: Split after the page containing the QR code.
- Before: Split before the page containing the QR code.
Combine Pages With Same Barcodes Whether to combine consecutive pages that have the same QR code into a single output document (true or false).
PDF Render DPI The resolution (dots per inch) used when rendering the PDF for processing. Options are 100, 150, 200, or 250 DPI.
Advanced Options Custom JSON profiles to adjust extra properties for API calls. This allows advanced users to fine-tune the behavior by specifying additional parameters according to external API documentation.

Output

The node outputs an array of JSON objects, each representing a split part of the original PDF. Each item typically contains:

  • A binary property holding the PDF data of the split segment.
  • Metadata about the split, such as which pages were included or the QR code value detected (depending on implementation details).

If the input was binary or base64, the output will contain binary data representing the split PDFs. If the input was a URL, the output will similarly provide the split PDFs as binary data.

The binary data can be used downstream in n8n workflows for storage, sending via email, or further processing.

Dependencies

  • Requires access to an external PDF processing service or API capable of detecting Swiss QR codes and splitting PDFs accordingly.
  • Needs an API key or authentication token configured in n8n credentials to authorize requests to this service.
  • Network access to fetch PDFs if using the URL input option.

Troubleshooting

  • Common Issues:

    • Incorrect input data type selected or mismatched input property name may cause failures in reading the PDF.
    • Low PDF render DPI might result in poor QR code detection; increasing DPI can improve accuracy but at the cost of performance.
    • Combining pages with the same barcode incorrectly set may merge unrelated pages if QR codes are not unique or properly detected.
  • Error Messages:

    • Errors related to invalid PDF format or unreadable content usually indicate corrupted input or wrong binary property.
    • Authentication errors suggest missing or invalid API credentials.
    • Network errors when using URL input indicate connectivity issues or inaccessible URLs.
  • Resolutions:

    • Verify the input data matches the selected input type and property names.
    • Increase PDF render DPI if QR codes are not detected reliably.
    • Check API credentials and permissions.
    • Ensure URLs are publicly accessible or accessible from the n8n environment.

Links and References

Discussion