AI-Powered PDF Generation and Manipulation using Api2Pdf - n8n Workflow

Use this powerful n8n workflow to convert, merge, and generate PDFs and barcodes via Api2Pdf. This n8n template acts as an AI tool server using the MCP trigger, automating complex document tasks.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI Agent developers who need robust, scalable PDF processing capabilities within their models.

  • Automation specialists looking for advanced n8n templates for document conversion.

  • Businesses requiring serverless, high-volume document generation (invoices, reports).

  • Users familiar with integrating complex APIs into an n8n workflow.

Overview

This specialized n8n workflow integrates the comprehensive Api2Pdf service—known for its scalable, AWS Lambda-powered serverless architecture—directly into an AI agent ecosystem using the Multi-tool Call Protocol (MCP). The core value proposition of this n8n template is transforming 9 different Api2Pdf endpoints (for conversion, merging, and barcode generation) into distinct, callable tools that an AI agent can utilize seamlessly. Instead of manually configuring data flows, the AI agent simply sends a request to the n8n trigger, and the workflow dynamically executes the correct Api2Pdf n8n node tool, providing a highly efficient and modular approach to document automation. This powerful n8n workflow ensures reliable and cheap PDF manipulation at scale.

How it Works

The entire process is initiated by the custom n8n trigger, the MCP Trigger n8n node, which listens for incoming requests from a configured AI agent. When the AI agent determines that a PDF operation (like converting a URL or merging documents) is required, it calls this workflow's webhook URL.


  1. Trigger Reception: The MCP trigger n8n node receives the request, including the specific tool (API endpoint) to be executed and the necessary parameters.

  2. Dynamic Parameter Mapping: Each subsequent HTTP Request Tool n8n node uses the special $fromAI() expression. This ensures that parameters like the url, html content, format, or value are dynamically extracted from the AI agent's request.

  3. API Execution: The appropriate HTTP Request Tool n8n node executes the call to the Api2Pdf V2018 endpoint, correctly passing the dynamically mapped parameters and the required API key in the Authorization header.

  4. Response Return: The result (the PDF file or a JSON response, depending on the configuration) is returned directly by the executing n8n node back through the MCP trigger to the initiating AI agent, completing the automated task.

Installation Guide

To deploy and utilize this versatile n8n workflow, follow these setup steps:


  1. Import the n8n template: Copy the provided JSON and import it into your n8n instance.

  2. Obtain Api2Pdf Key: Create an account at portal.api2pdf.com to retrieve your API key.

  3. Configure Credentials: Create a Generic Auth credential within n8n. The workflow expects HTTP Header authentication:

Type: API Key in header
Key name: Authorization
* Key value: Your Api2Pdf key.

  1. Activate the n8n workflow: Toggle the workflow to 'Active'.

  2. Get MCP URL: Copy the unique webhook URL generated by the 'Api2Pdf - PDF Generation...' MCP n8n trigger.

  3. Connect to AI Agent: Use this MCP URL as the tool endpoint URL when configuring your external AI agent or platform that supports the Multi-tool Call Protocol.

Node Details


  • Api2Pdf - PDF Generation, Powered by AWS Lambda MCP Server (MCP Trigger n8n node): This is the entry point and primary n8n trigger for the entire n8n workflow. It exposes the subsequent HTTP nodes as tools callable by an AI agent, allowing the AI to orchestrate PDF operations.

  • Convert raw HTML to PDF (HTTP Request Tool n8n node - Headless Chrome): Configured to POST raw HTML data to the /chrome/html endpoint for conversion.

  • Convert URL to PDF (HTTP Request Tool n8n node - Headless Chrome/W K Html To Pdf): Multiple identical nodes exist to handle both GET and POST methods for URL-to-PDF conversion under different engines. Crucially, they use $fromAI('url', ...) and $fromAI('output', ...) to dynamically pull the target URL and desired output format from the AI request.

  • Convert office document or image to PDF (HTTP Request Tool n8n node - Libre Office): A dedicated n8n node configured to convert document types (DOCX, XLSX, images) to PDF using the LibreOffice engine via a POST request to /libreoffice/convert.

  • Merge multiple PDFs together (HTTP Request Tool n8n node): Calls the /merge endpoint to combine multiple PDF files, expecting file URLs or base64 data to be passed by the AI agent.

  • Generate bar codes and QR codes with ZXING (HTTP Request Tool n8n node): This specialized n8n node uses query parameters defined with $fromAI() expressions (format, value, showlabel, height, width) to allow the AI agent precise control over generating QR codes or various barcode formats via the /zebra endpoint.

Related n8n Workflows

Free

Nodes: 3 Nodes
Updated: December 26 2025
View all
Created by

A hacker by nature, programmer by trade ⚒️ I'm looking to collaborate on things that save human labor 📫 How to reach me Github👇 -> Discord

Featured*