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 "Extract Table From PDF" allows users to extract tabular data from PDF documents. It is useful in scenarios where structured data is embedded within PDFs, such as invoices, reports, or forms, and you want to convert these tables into machine-readable JSON or other formats for further processing or analysis.

Practical examples include:

  • Extracting invoice line items from a PDF invoice.
  • Parsing tables from financial reports or statements.
  • Converting survey results or form responses stored in PDF tables into structured data.

The node supports multiple ways to provide the PDF input: as binary data from a previous node, as a base64 encoded string, or via a URL pointing to the PDF file.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF file to extract tables from. Options:
• Binary Data (PDF file from previous node)
• Base64 String (PDF content as base64 encoded string)
• URL (URL to PDF file)
Input Binary Field Name of the binary property containing the PDF file (usually "data" for file uploads). Required if Input Data Type is Binary Data.
Base64 PDF Content Base64 encoded PDF document content. Required if Input Data Type is Base64 String.
PDF URL URL to the PDF file to extract tables from. Required if Input Data Type is URL.
Document Name Name of the document used for processing. Defaults to "document.pdf".
Advanced Options Collection of advanced options. Currently supports:
• Custom Profiles: A JSON string to adjust custom properties for API calls, e.g., { 'outputDataFormat': 'json' }. Useful to customize extraction behavior based on external API documentation.

Output

The output contains the extracted table data from the PDF in JSON format under the json field of each item. The structure typically includes rows and columns representing the table contents parsed from the PDF.

If the node supports binary output (not explicitly shown here), it would represent extracted files or related binary data, but this operation focuses on JSON extraction of tables.

Dependencies

  • Requires access to an external PDF processing API service capable of extracting tables from PDFs.
  • Needs appropriate API authentication configured in n8n (e.g., an API key credential).
  • Network access to fetch PDF files if using the URL input option.

Troubleshooting

  • Common issues:

    • Providing incorrect input data type or missing required fields for the selected input type.
    • Invalid or inaccessible PDF URLs leading to download failures.
    • Malformed base64 strings causing decoding errors.
    • Unsupported or corrupted PDF files that the external API cannot process.
    • Incorrectly formatted custom profiles JSON causing API call failures.
  • Error messages and resolutions:

    • "Failed to fetch PDF from URL": Check the URL accessibility and correctness.
    • "Invalid base64 content": Verify the base64 string is properly encoded without extra characters.
    • "API authentication error": Ensure the API key or credentials are correctly set up in n8n.
    • "Table extraction failed": Confirm the PDF contains recognizable tables and try adjusting advanced options or profiles.

Links and References

  • PDF4me API Documentation — For details on custom profiles and advanced options.
  • General info on PDF table extraction techniques and best practices can be found in various PDF processing libraries and services documentation.

Discussion