← All N8N workflows
AI & researchAggregateChain LLMCodeCompressionEdit Image

💡 About the Example PDF

Configured with Aggregate, Chain LLM, Compression, Edit Image, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
TriggerWhen clicking ‘Testworkflow’Manual TriggerAI & modelsGoogle Gemini ChatModelLM Chat Google GeminiTransformSort PagesSortFiles / mediaGet Bank StatementGoogle DriveWeb / APISplit PDF into ImagesHTTP RequestTransformExtract Zip FileCompressionCodeImages To ListCodeFiles / mediaResize Images For AIEdit ImageAI & modelsGoogle Gemini ChatModel1LM Chat Google GeminiTransformCombine All PagesAggregateAI & modelsExtract All DepositTable RowsInformation ExtractorAI & modelsTranscribe to MarkdownChain LLM

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.

Workflow node names, types, and operations
NodeCategoryTypeOperation
When clicking ‘Test workflow’TriggerManual TriggerSee node parameters
Google Gemini Chat ModelAI & modelsLM Chat Google GeminiSee node parameters
Sort PagesTransformSortSee node parameters
Get Bank StatementFiles / mediaGoogle Drivedownload
Split PDF into ImagesWeb / APIHTTP RequestPOST
Extract Zip FileTransformCompressionSee node parameters
Images To ListCodeCodeSee node parameters
Resize Images For AIFiles / mediaEdit Imageresize
Google Gemini Chat Model1AI & modelsLM Chat Google GeminiSee node parameters
Combine All PagesTransformAggregateSee node parameters
Extract All Deposit Table RowsAI & modelsInformation ExtractorSee node parameters
Transcribe to MarkdownAI & modelsChain LLMSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. 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

  • googleDriveOAuth2Api
  • googlePalmApi

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?

Join the Discord or ask in the Forum!

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.

More in AI & research