# Create custom PDF documents from templates with Gemini: n8n workflow

> Started by someone opening a chat with it, and works across Google Drive. It puts Gemini behind a retrieval step, so answers are drawn from documents you...

Source: https://millionrounds.com/workflow/create-custom-pdf-documents-from-templates-with-gemini (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Create custom PDF documents from templates with Gemini

Started by someone opening a chat with it, and works across Google Drive. It puts Gemini behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 30 steps, 4 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcreate-custom-pdf-documents-from-templates-with-gemini)

**30 steps** Large: read it before trusting it with anything live

**4** Branches: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 2 Model 9 Logic 13 Service 6

The steps in the order they run, from what starts it.

- 1 **Google Gemini Chat Model** Lm Chat Google Gemini *Model*
- 2 **GetMetaData** Http Request Tool *Service*
- 3 **When chat message received** Chat trigger *Starts it*
- 4 **DocProcess** Tool Workflow *Model*
- 5 **Postgres Chat Memory** Memory Postgres Chat *Model*
- 6 **Template List** Http Request *Service*
- 7 **When Executed by Another Workflow** Execute Workflow trigger *Starts it*
- 8 **Google Gemini Chat Model1** Lm Chat Google Gemini *Model*
- 9 **Structured Output Parser** Output Parser Structured *Model*
- 10 **Google Gemini Chat Model2** Lm Chat Google Gemini *Model*
- 11 **DocAgent** Agent *Model*
- 12 **User Choice Match Check** Chain Llm *Model*
- 13 **Format Control** Chain Llm *Model*
- 14 **If** If *Logic*
- 15 **Formatting Correction** Code *Logic*
- 16 **User Choice Match Correct** Set *Logic*
- 17 **User Choice Matching Error** Set *Logic*
- 18 **CopyTemplate** Google Drive *Service*
- 19 **GetMetaData2** Http Request *Service*
- 20 **If1** If *Logic*
- 21 **Edit Fields** Set *Logic*
- 22 **Cop. Document ID Matching Error** Set *Logic*
- 23 **FillDocument** Http Request *Service*
- 24 **if** If *Logic*
- 25 **Generate Download Link** Http Request *Service*
- 26 **Switch** Switch *Logic*
- 27 **Download Link Format** Set *Logic*
- 28 **Template Technical Error** Set *Logic*
- 29 **Incomplete Information Error** Set *Logic*
- 30 **Other Errors** Set *Logic*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 30, with 4 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Drive
- **Model:** Gemini
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Google Drive account, and a key for Gemini. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls Gemini. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 30 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 30 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcreate-custom-pdf-documents-from-templates-with-gemini)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**Chat with Google Drive and Pinecone** 30 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/chat-with-google-drive-and-pinecone)
- [**Build a PDF Document RAG System with Mistral and Qdrant** 29 steps · calls a model · Google Drive, Qdrant](https://millionrounds.com/workflow/build-a-pdf-document-rag-system-with-mistral-and-qdrant)
- [**Automate commercial insurance submissions with Google Suite** 29 steps · Email, Google Docs](https://millionrounds.com/workflow/automate-commercial-insurance-submissions-with-google-suite)
- [**AI knowledge assistant with Gemini and OpenAI** 32 steps · calls a model · Google Drive, Pinecone](https://millionrounds.com/workflow/ai-knowledge-assistant-with-gemini-and-openai)
- [**Document-based RAG chat assistant with Google Drive** 32 steps · calls a model · Google Drive, Supabase](https://millionrounds.com/workflow/document-based-rag-chat-assistant-with-google-drive)
- [**Generate business requirement documents with Google Workspace** 28 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/generate-business-requirement-documents-with-google-workspac)
