Skip to main content

Generate structured exams from PDFs with OpenAI GPT-4o and HTML to PDF

Workflow preview

Workflow preview
100%
Generate structured exams from PDFs with OpenAI GPT-4o and HTML to PDF preview
Open on n8n.io

1. Workflow Overview

ExamForge AI Automated PDF to Structured Exam Generator (MCQ + Essay + Answer Key) Generate structured exams automatically from text based PDF materials using AI. ExamForge AI is a production re...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.code, n8n-nodes-htmlcsstopdf.htmlcsstopdf, n8n-nodes-base.telegram, n8n-nodes-base.if, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Ramdoni.

Original n8n.io source

1.1 Workflow description

Title
Generate structured exams from PDFs with OpenAI GPT-4o and HTML to PDF
Workflow name
Generate structured exams from PDFs with OpenAI GPT-4o and HTML to PDF

πŸš€ ExamForge AI

Automated PDF to Structured Exam Generator (MCQ + Essay + Answer Key)

Generate structured exams automatically from text-based PDF materials using AI.

ExamForge AI is a production-ready n8n workflow that transforms educational content into multiple-choice and essay questions with customizable difficulty and automatic answer key generation.


✨ Features

  • πŸ“„ Upload PDF via Webhook
  • βœ… File size validation (default: max 5MB)
  • 🧹 Automatic text cleaning
  • πŸ“ Token length estimation & safety control
  • 🎯 Customizable MCQ & Essay count
  • 🧠 Difficulty selection (easy / medium / hard)
  • 🌍 Language selection
  • πŸ“¦ Structured JSON AI output
  • πŸ“ Separate Exam PDF & Answer Key PDF
  • πŸ“² Telegram delivery support (optional)
  • πŸ”’ Parameter validation with structured error responses

🧠 What This Workflow Does

  1. Accepts PDF upload via Webhook
  2. Validates file size
  3. Extracts and cleans text content
  4. Estimates text length to prevent token overflow
  5. Validates required parameters:
  • mcq_count
  • essay_count
  • difficulty
  • language
  1. Sends structured prompt to OpenAI
  2. Parses JSON response
  3. Formats exam and answer key separately
  4. Converts both into PDF
  5. Sends results via Telegram or Webhook response

βš™οΈ Requirements

Accounts Required

  • OpenAI account (API key required)
  • Telegram Bot (optional)
  • PDF Munk (API key required)

Environment

  • n8n (self-hosted or cloud)
  • Node version compatible with your n8n installation

πŸ”‘ Credentials Setup

1️⃣ OpenAI

  • Add OpenAI credentials inside n8n
  • Insert your API key
  • Select preferred model (e.g., GPT-4o / GPT-4)

2️⃣ Telegram (Optional)

  • Create a Telegram Bot via BotFather
  • Insert Bot Token into Telegram node
  • Add your Chat ID

πŸ›  Webhook Configuration

Method: POST Content-Type: multipart/form-data

Required Parameters

Parameter Type Required Description
file File Yes PDF document
mcq_count Number Yes Number of multiple-choice questions
essay_count Number Yes Number of essay questions
difficulty String Yes easy / medium / hard
language String Yes Output language

πŸ“₯ Example Request

curl -X POST https://your-n8n-domain/webhook/examforge \
 -F "[email protected]" \
 -F "mcq_count=20" \
 -F "essay_count=5" \
 -F "difficulty=medium" \
 -F "language=Indonesian"

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2.1

Block 2 - Extract from File

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1.1

Block 3 - Message a model

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 2.1

Block 4 - Parse JSON

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - Clean Text

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Convert HTML to PDF - Exam

Type / Role
n8n-nodes-htmlcsstopdf.htmlcsstopdf - htmlcsstopdf
Config choices
Version 1

Block 7 - Convert HTML to PDF - Answer

Type / Role
n8n-nodes-htmlcsstopdf.htmlcsstopdf - htmlcsstopdf
Config choices
Version 1

Block 8 - Send a text message

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 9 - Send a text message1

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 10 - Length Estimation Layer

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Validate Token > 8.000

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 12 - Format Exam Text

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Respond Valid Parameter

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.4

Block 15 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Respond to Webhook

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.4

Block 17 - Condition Valid

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 18 - Validate Parameter & PDF

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 19 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Generate structured exams from PDFs with OpenAI GPT-4o and HTML to PDF
Complexity advanced
Nodes 20
Categories Document Extraction, AI Summarization
Author Ramdoni
Published 22 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13599/13599.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate structured exams from PDFs with OpenAI GPT-4o and HTML to PDF do?

ExamForge AI Automated PDF to Structured Exam Generator (MCQ + Essay + Answer Key) Generate structured exams automatically from text based PDF materials using AI. ExamForge AI is a production re...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.