💡 About the Example PDF
Configured with Aggregate, Chain LLM, Compression, Edit Image, and additional nodes. Review the connections and setup before adapting this template.
Node categories in this workflow
- Trigger
- AI & models
- Transform
- Files / media
- Web / API
- Code
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| When clicking ‘Test workflow’ | Trigger | Manual Trigger | See node parameters |
| Google Gemini Chat Model | AI & models | LM Chat Google Gemini | See node parameters |
| Sort Pages | Transform | Sort | See node parameters |
| Get Bank Statement | Files / media | Google Drive | download |
| Split PDF into Images | Web / API | HTTP Request | POST |
| Extract Zip File | Transform | Compression | See node parameters |
| Images To List | Code | Code | See node parameters |
| Resize Images For AI | Files / media | Edit Image | resize |
| Google Gemini Chat Model1 | AI & models | LM Chat Google Gemini | See node parameters |
| Combine All Pages | Transform | Aggregate | See node parameters |
| Extract All Deposit Table Rows | AI & models | Information Extractor | See node parameters |
| Transcribe to Markdown | AI & models | Chain LLM | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
googleDriveOAuth2ApigooglePalmApi
Workflow notes
Try Me Out!
Try Me Out!
This workflow converts a bank statement to markdown, faithfully capturing the details using the power of Vision Language Models ("VLMs"). The resulting markdown can then be parsed again by your standard LLM to extract data such as identifying all deposit table rows in the document.
This workflow is able to handle both downloaded PDFs as well as scanned PDFs. Be sure to protect sensitive data before running this workflow.
Need Help?
1. Download Bank Statement PDF
1. Download Bank Statement PDF
Read more about Google Drive node
For this demonstration, we'll pull an example bank statement off Google Drive however, you can also swap this out for other triggers such as webhook.
You can use the example bank statement created specifically for this workflow here: https://drive.google.com/file/d/1wS9U7MQDthj57CvEcqG_Llkr-ek6RqGA/view?usp=sharing
2. Split PDF Pages into Seperate Images
2. Split PDF Pages into Seperate Images
Currently, the vision model we'll be using can't accept raw PDFs so we'll have to convert our PDF to a image in order to use it. To achieve this, we'll use the free Stirling PDF webservice for convenience but if we need data privacy (recommended!), we could self-host our own Stirling PDF instance instead. Alternatively, feel free to swap this service out for one of your own as long as it can convert PDFs into images!
We will ask the PDF service to return each page of our statement as separate images, which it does so as a zip file. Next steps is to just unzip the file and convert the output as a list of images.
3. Convert PDF Pages to Markdown Using Vision Model
3. Convert PDF Pages to Markdown Using Vision Model
Learn more about using the Basic LLM node
Unlike traditional OCR, vision models ("VLMs") "transcribe" what they see so while we shouldn't expect an exact replication of a document, they may perform better making sense of complex document layouts ie. such as with horizontally stacked tables.
In this demonstration, we can transcribe our bank statement scans to markdown text for the purpose of further processing. With markdown, we can retain tables or columnar data found in the document. We'll employ two optimisations however as a workaround for token and timeout limits (1) we'll only transcribe one page at a time and (2) we'll shrink the pages just a little just enough to speed up processing but not enough to reduce our required resolution.
4. Extract Key Data Confidently From Statement
4. Extract Key Data Confidently From Statement
Read more about the Information Extractor
With our newly generated transcript, let's pull just the deposit line items from our statement. Processing all pages together as images may have been compute-extensive but as text, this is usually no problem at all for our LLM.
For our example bank statement PDF, the resulting extraction should be 8 table rows where a value exists in the "deposits" column.
💡 About the Example PDF
💡 About the Example PDF
Scanned PDFs (ie. where each page is a scanned image) are a use-case where extracting PDF text content will not work. Vision models are a great solution as this workflow aims to demonstrate!
Privacy Warning!
Privacy Warning!
This example uses a public third party service. If your data is senstive, please swap this out for the self-hosted version!
💡 Don't use Google?
💡 Don't use Google?
Feel free to swap the model out for any state-of-the-art multimodal model which supports image inputs such as GPT4o(-mini) or Claude Sonnet/Opus. Note, I've found Gemini to produce the most accurate and consistent for this example use-case so no guarantees if you switch!
💡 About the Example PDF
💡 About the Example PDF
Purpose and structure
This folder contains the 💡 About the Example PDF workflow. Its executable nodes use aggregate, chainLlm, code, compression, editImage, googleDrive, httpRequest, informationExtractor, lmChatGoogleGemini, manualTrigger, sort. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
When clicking ‘Test workflow’
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0580_Code_Editimage_Import_Webhook.json MIT; preserve source notices.