Extract Invoice Data from PDFs to JSON with Gemini AI and XML Transformation
Go to WorkflowDescription
This n8n workflow converts invoices in PDF format into a structured, ready-to-use JSON, using AI and XML transformation ā without writing any code.
š How it works
Upload form ā The user uploads a PDF file.
Text extraction ā The PDF content is extracted as plain text.
XML schema definition ā A standard invoice structure is defined with fields such as:
Invoice number
Customer and issuer details
Items with description, quantity, and price
Totals and taxes
Bank account details
AI (Gemini) ā The model rewrites the PDF text into a valid XML following the predefined schema.
XML cleanup ā Removes extra tags, line breaks, and unnecessary formatting.
JSON conversion ā The XML is transformed into a clean, structured JSON object, ready for integrations, APIs, or storage.
⨠Benefits
Transforms unstructured PDFs into normalized JSON data.
No coding required, only n8n nodes.
Scalable to different invoice formats with minimal adjustments.
Leverages AI to interpret complex textual content.
š ļø Use cases
Automating invoice data capture.
Integration with ERPs, CRMs, or databases.
Generating financial reports from PDFs.
This workflow was created by Mauricio Perera and shared publicly on the n8n community template library. n8nFind indexes it for discovery — the workflow remains the property of its original creator.