Large Sample PDFs — Exact File Sizes for Testing
Five PDFs padded to land exactly at — or a fraction of a percent under — their advertised size. Built for testing upload limits, size validation, progress bars, and "max file size" error paths, where a file that's accidentally 2% over the boundary ruins the test. Every file opens as a normal 2-page PDF.
The "at or under, never over" guarantee
When you're testing a 5 MB upload limit you need two files: one that should pass and one that should fail. These files are the pass side — each is generated iteratively until it lands inside a 2% window under its target, and the build fails if a file ever exceeds it. For the fail side, use the next size up (the 10 MB file against a 5 MB limit). The 100 KB, 500 KB and 1 MB files hit their byte targets exactly: 102,400 / 512,000 / 1,048,576 bytes.
How the size is achieved (and why it won't compress)
Each file is a normal 2-page text document plus an embedded attachment of seeded-random
bytes — random data is incompressible, so the file size is stable even if a proxy or CDN
applies gzip on the wire. That also makes these files useful for
compression testing in the opposite direction: a compressor that
claims big wins on sample-pdf-10mb.pdf is lying to you, because there is almost
nothing compressible inside. Honest tools will report ~0% on it.
Because the bytes come from a seeded PRNG, regenerating with the open-source script yields byte-identical files — safe to checksum in CI.
What to test with them
- Upload limits — the classic: does your 5 MB limit accept a 4.98 MB file and reject a 9.98 MB one, and is the error message readable?
- MB vs MiB confusion — the 1 MB file is 1,048,576 bytes (1 MiB). If a "1 MB max" validator rejects it, the backend is counting 1,000,000 bytes. Both conventions are defensible; mixing them silently is the bug.
- Progress indicators — a 10 MB upload on a throttled connection is long enough to watch a progress bar actually move.
- Timeouts and chunking — multipart boundaries, resumable-upload logic, and gateway body-size caps (nginx
client_max_body_sizedefaults to 1 MB — the 1 MB file sits exactly on that fence). - Email attachment limits — most providers cut off between 10 and 25 MB; the 10 MB file probes the low end.
FAQ
Why are the 5 MB and 10 MB files slightly under, not exact?
PDF container overhead (xref table, object headers) varies by a few hundred bytes with content, and the padding is adjusted iteratively. For the three smaller sizes the loop converges on the exact byte count; for 5/10 MB it guarantees "within 2% under" — which is the side you want for a should-pass upload test. If you need byte-exact large files, the generator's tolerance is one constant.
Do the files open like normal PDFs?
Yes — 2 pages of real text in any viewer. The padding lives in an embedded attachment named padding.bin, visible in the inspector and clearly described inside the file.
I need 25 MB / 50 MB / 100 MB.
One line each in the generator script — we keep the hosted set at 10 MB and under so this page stays fast to load. Clone, add sizedDoc(25 * 1024 * 1024, ...), run.
Can I make a big PDF smaller instead?
That's the compress tool — though as noted above, don't expect miracles on these files; they're designed to resist it.