Random File Generator
Generate dummy PDF or DOCX files for testing uploads and storage.
Configuration
Ready to Generate
Small PDF file with lorem content.
About the Random File Generator
Upload features are tested with real documents far less often than they should be, because nobody has a harmless 50-page PDF lying around. This tool builds one on demand. It produces a genuine PDF (written with the jsPDF library) or a genuine Word document (written with the docx library), fills it with placeholder text, and downloads it through your browser. No server is involved: the file is assembled in memory on your machine and never uploaded anywhere.
What you actually get
| Option | DOCX | |
|---|---|---|
| Small | 1 page, about 6 KB | 1 heading plus 5 paragraphs |
| Medium | 10 pages, about 41 KB | 10 headings, 50 paragraphs |
| Large | 50 pages, about 196 KB | 50 headings, 250 paragraphs |
| Layout | A4 portrait, Helvetica, a "Page N" heading and about 20 paragraphs per page | Paragraphs flow continuously; Word decides where pages break |
| File name | random_file_<size>_<timestamp>.pdf or .docx | |
The PDF sizes above were measured on this exact generator and vary by a few kilobytes from run to run because the text is random. The DOCX page counts are approximate: the document contains no hard page breaks, so Word, LibreOffice and Google Docs each paginate it slightly differently. Two text styles are available. Lorem Ipsum gives classic Latin filler paragraphs; Random Bio gives short comma-separated lines in the style of a social media bio ("educator, film lover, geek"), which is useful when you want the document to look less like filler in a screenshot.
This is a document generator, not a byte-size generator
The sizes are page counts, not exact byte counts. If you need a file that is exactly 10 MB, or random binary content, use the command-line recipes below. If you need an image, the image tool covers that side.Why testers generate documents
- Type validation. A robust upload endpoint checks more than the file extension. A real PDF begins with the bytes
%PDF-; a DOCX is a ZIP archive that begins withPKand contains[Content_Types].xmlandword/document.xml. A text file renamed to.pdfshould be rejected; the files from this page should pass. - Size limits. Defaults are lower than people assume: nginx rejects request bodies over 1 MB unless
client_max_body_sizeis raised, PHP'supload_max_filesizedefaults to 2 MB, and Gmail attachments stop at 25 MB. A 50-page PDF from here is comfortably under all of them, which makes it a good "should succeed" case next to an oversized file that should fail. - Preview and thumbnail pipelines. Services that render page thumbnails, extract text for search or run OCR behave differently on one page and on fifty. The medium and large options exist for exactly this.
- Downstream scanners. Antivirus, data-loss-prevention and PDF-sanitising steps add latency that only shows up with a real multi-page document.
- Correct MIME types. The browser sends
application/pdffor PDF andapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentfor DOCX. Servers that only allowapplication/mswordreject every modern Word file, a bug these downloads reveal immediately.
A boundary test matrix for uploads
- An empty (0-byte) file with a valid extension.
- A file just under, exactly at, and one byte over the configured limit.
- Correct extension, wrong content (a renamed text file) and correct content, wrong extension.
- A file name with spaces, a very long name, and a name in Hindi or another non-Latin script.
- The same file uploaded twice, and an upload cancelled halfway.
- A 50-page document, to see how previews, page counters and text extraction cope.
- A truncated file: take a valid PDF from this page and cut it with
head -c 20000to see how the parser reports corruption.
Exact-size files from the command line
# Windows (Command Prompt): 1 MiB of zero bytes
fsutil file createnew dummy.bin 1048576
# Windows PowerShell: 1 MiB of random bytes
$b = New-Object byte[] 1MB; (New-Object Random).NextBytes($b); [IO.File]::WriteAllBytes('rand.bin', $b)
# Linux / macOS / Git Bash
head -c 1048576 /dev/urandom > random.bin # random bytes, exact size
dd if=/dev/zero of=zeros.bin bs=1M count=10 # 10 MiB of zeros
truncate -s 5M sparse.bin # Linux: sparse file, reads as zeros, occupies no disk
# Any platform with Python
python3 -c "import os; open('r.bin','wb').write(os.urandom(1048576))"Zero-filled and sparse files compress to almost nothing, so use random bytes when the test involves compression, transfer time, deduplication or storage quotas.
Checking what you generated
file random_file_large_*.pdf # reports a PDF document and its version
xxd random_file_large_*.pdf | head -1 # first bytes should read %PDF-
unzip -l random_file_large_*.docx # lists word/document.xml inside the ZIP
pdfinfo random_file_large_*.pdf # page count and size (poppler-utils)
Get-FileHash .\random_file_large_*.pdf # PowerShell: hash to compare copiesFor text rather than files, the hash generator and Lorem Ipsum generator cover the same ground without a download.
How to use
- Choose PDF or DOCX.
- Pick a size: Small (1 page), Medium (about 10 pages) or Large (about 50 pages).
- Pick the text style: Lorem Ipsum paragraphs or short random bio lines.
- Click Generate & Download. The file is built in your browser and saved through the normal download prompt.
- Open it once in a PDF viewer or Word to confirm it renders, then use it in your upload test.
Common use cases
- Checking that an upload form accepts real PDF and DOCX files and rejects renamed text files.
- Exercising document preview, thumbnail and page-count features with a 10 or 50 page file.
- Measuring how long virus scanning, OCR or text extraction takes on a multi-page document.
- Attaching a harmless document to a demo ticket, email template or CMS entry.
- Testing that the correct MIME type is stored and served back on download.
- Producing a corrupt sample by truncating a generated file, to test error handling.
Frequently asked questions
Can I choose an exact file size in bytes or megabytes?
Why does my Word document have a different number of pages than advertised?
Is the content the same every time?
Can it generate a password-protected, corrupt or malicious test file?
The file opens fine on my computer but my application rejects it. Why?
Does the file or its content get uploaded to DevUtils India?
Can I get other formats such as XLSX, PNG or ZIP?
Advertisement