Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create large PDF files (10MB, 50MB, 100MB, 200MB, 500MB, 1GB, etc.) for testing purposes?

Tags:

pdf

testing

qa

I tried this for ((i=1; i<=10; i++)); do convert 100MB.pdf 10MB.pdf 100MB.pdf; done to create 100MB file but very quickly run out of RAM.

Any ideas?

like image 290
tkane Avatar asked Feb 23 '11 14:02

tkane


People also ask

How do I make a PDF 10 MB?

In the latest version of Adobe Acrobat, open the PDF you wish to re-save as a smaller file, choose File, Save as Other, and then Reduced Size PDF. You'll be prompted to select the version compatibility you need and then you can click OK to save.


1 Answers

The most simple tool: use pdftk (or pdftk.exe, if you are on Windows):

pdftk 10_MB.pdf 100_MB.pdf cat output 110_MB.pdf 

This will be a valid PDF. Download pdftk here.

Update: if you want really large (and valid!), non-optimized PDFs, use this command:

pdftk 100MB.pdf 100MB.pdf 100MB.pdf 100MB.pdf 100MB.pdf cat output 500_MB.pdf 

or even (if you are on Linux, Unix or Mac OS X):

pdftk $(for i in $(seq 1 100); do echo -n "100MB.pdf "; done) cat output 10_GB.pdf 
like image 116
Kurt Pfeifle Avatar answered Sep 19 '22 07:09

Kurt Pfeifle