papergeneratorapp.com: generate a custom Cambridge IGCSE Mathematics exam paper from real past-paper questions, by topic and total marks, in a few seconds.
I started this in 2023 while sitting the exams myself, because practising a single topic meant hunting through years of past papers. Since launch it has generated 14,000+ papers for 1,500+ students, with usage tripling year on year. It covers Extended Mathematics (0580) and Additional Mathematics (0606).
- Custom papers. Choose the syllabus, tick topics, set a total between 15 and 150 marks, and optionally print each question's source (session, year, paper and variant). The generator picks real questions whose marks add up to exactly the requested total, composes them into A4 pages, and returns a PDF to view, download or print.
- Random question. One question from a chosen topic with its metadata, for quick drills.
- Live counter. The site shows the running total of papers generated.
Browser (index.html, vanilla JS + PDF.js)
│ POST { topic[], mark, subjectId, info }
▼
API Gateway ──▶ AWS Lambda (Python)
├─ SQLite question bank pulled from S3, cached in /tmp with a 5-minute TTL
├─ generator.py: pick questions summing to the exact mark target
├─ ImageEdit.py: paginate question images onto A4, number them, stamp source info
├─ PDF written to S3, returned to the client
└─ DynamoDB counter incremented
Exact-marks selection. Every topic must contribute at least one question and the marks must sum to the target exactly. generator.py does this as a two-phase subset-sum dynamic programme: for each topic it computes every achievable mark total, keeping a few random representative subsets per total, then combines across topics to hit the target. Shuffling before the DP means the same request produces a different paper each time.
Question bank. Thousands of questions cropped from past papers, stored as images in SQLite with topic, marks, session, year, paper and variant. Questions taller than a page are placed alone; shorter ones are stacked.
| File | Purpose |
|---|---|
lambda_function.py |
Lambda entry point: routing (random_question, stats, paper generation), S3 caching, DynamoDB counter, CORS |
generator.py |
Question selection (subset-sum DP) and paper assembly |
ImageEdit.py |
Image composition with Pillow: A4 layout, numbering, source captions, cover tag |
index.html |
The whole front-end: topic picker, marks slider, PDF viewer with zoom, print and download |
The front-end is static and can be served with python -m http.server. The backend expects an S3 bucket holding the question database and fonts, a DynamoDB table for the counter, and a Lambda behind API Gateway; requirements.txt lists the Lambda's dependencies.
Python 3, Pillow, SQLite · AWS Lambda, API Gateway, S3, DynamoDB · HTML, CSS, JavaScript, PDF.js
MIT
Shahu Wagh · shahuwagh.com · github.com/Shahu-123