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

OptionPDFDOCX
Small1 page, about 6 KB1 heading plus 5 paragraphs
Medium10 pages, about 41 KB10 headings, 50 paragraphs
Large50 pages, about 196 KB50 headings, 250 paragraphs
LayoutA4 portrait, Helvetica, a "Page N" heading and about 20 paragraphs per pageParagraphs flow continuously; Word decides where pages break
File namerandom_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 with PK and contains [Content_Types].xml and word/document.xml. A text file renamed to .pdf should 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_size is raised, PHP's upload_max_filesize defaults 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/pdf for PDF and application/vnd.openxmlformats-officedocument.wordprocessingml.document for DOCX. Servers that only allow application/msword reject every modern Word file, a bug these downloads reveal immediately.

A boundary test matrix for uploads

  1. An empty (0-byte) file with a valid extension.
  2. A file just under, exactly at, and one byte over the configured limit.
  3. Correct extension, wrong content (a renamed text file) and correct content, wrong extension.
  4. A file name with spaces, a very long name, and a name in Hindi or another non-Latin script.
  5. The same file uploaded twice, and an upload cancelled halfway.
  6. A 50-page document, to see how previews, page counters and text extraction cope.
  7. A truncated file: take a valid PDF from this page and cut it with head -c 20000 to 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 copies

For text rather than files, the hash generator and Lorem Ipsum generator cover the same ground without a download.

How to use

  1. Choose PDF or DOCX.
  2. Pick a size: Small (1 page), Medium (about 10 pages) or Large (about 50 pages).
  3. Pick the text style: Lorem Ipsum paragraphs or short random bio lines.
  4. Click Generate & Download. The file is built in your browser and saved through the normal download prompt.
  5. 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?

No. Sizes are expressed as page counts, and the generated PDFs are roughly 6 KB, 41 KB and 196 KB. For an exact byte size use fsutil on Windows, head -c or dd on Linux and macOS, or the Python one-liner shown above.

Why does my Word document have a different number of pages than advertised?

The DOCX contains headings and paragraphs but no forced page breaks, so the application that opens it decides where pages end. Treat the small, medium and large options as content volume rather than an exact page count.

Is the content the same every time?

No. The paragraphs are generated randomly on each click, and the file name includes a timestamp, so two downloads never collide or compare equal by hash.

Can it generate a password-protected, corrupt or malicious test file?

No. It produces plain, valid documents. To simulate corruption, truncate a generated file with head -c. For malware-scanner tests use the EICAR test file, which scanners recognise by design.

The file opens fine on my computer but my application rejects it. Why?

Check the server-side rules in this order: the size limit (nginx defaults to 1 MB), the accepted MIME types (modern DOCX is application/vnd.openxmlformats-officedocument.wordprocessingml.document, not application/msword), and any magic-byte check.

Does the file or its content get uploaded to DevUtils India?

No. The PDF and DOCX are assembled in your browser tab and handed to the download manager. Nothing is sent to our servers.

Can I get other formats such as XLSX, PNG or ZIP?

Not from this page. For images use the image to Base64 tool, and for archives create one with zip or Compress-Archive around the generated documents.

Advertisement