📄 PDF files
Test PDF files in a range of sizes
102,400 bytes
application/pdf
104,857,600 bytes
application/pdf
10,240 bytes
application/pdf
10,485,760 bytes
application/pdf
1,048,576 bytes
application/pdf
26,214,400 bytes
application/pdf
512,000 bytes
application/pdf
52,428,800 bytes
application/pdf
5,242,880 bytes
application/pdf
About PDF files
Test PDFs from 10 KB to 100 MB are available free. Use them for upload size-limit testing, exercising PDF libraries, checking mail attachment caps, and load-testing document generation.
A PDF keeps its cross-reference table (xref) at the end of the file, so a transfer cut short renders the whole document unreadable. That makes PDF a good subject for truncation-detection tests.
Typical uses
- Testing size limits on PDF upload
- Verifying viewer libraries such as PDF.js
- Checking mail attachment caps — Gmail allows 25 MB
- Measuring how long OCR or text extraction takes
Related reference and articles
📖 Where people get stuck
PDFs sized to the byte, from 10 KB to 100 MB, for checking upload limits and exercising PDF libraries. They are generated for testing and carry none of the embedded fonts, form fields or annotations a real document would. Use a genuine file when those are what you need to try.
| Case | What happens | What to do |
|---|---|---|
| gzip does not make it smaller | The streams inside a PDF are already Flate-compressed. Compressing again on the wire saves a few percent at best and costs CPU. | Keep application/pdf out of nginx gzip_types — it is not there by default. To cut bandwidth, reduce pages or image resolution instead. |
| A small PDF exhausts memory | Memory follows the decoded content, not the file size. A 1 MB PDF holding a 10,000 by 10,000 pixel image needs hundreds of megabytes to render. | Cap page count and resolution as well as size. With Ghostscript or pdftoppm, set -r (dpi) explicitly and work a page at a time so memory is released. |
| A non-PDF passes as a PDF | Both Content-Type: application/pdf and a .pdf extension are claims made by the sender. Neither is a check. |
Check that the first four bytes are 25 50 44 46 (%PDF). Checking for a trailing %%EOF at the same time also catches truncation. |
Passing on size and format leaves encrypted PDFs, PDFs with embedded JavaScript and PDFs referencing external resources to be handled separately. For viewing, leave it to a sandboxed viewer; when opening one server-side, disable JavaScript execution.