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
21.6k 15 15 gold badges 85 85 silver badges 132 132 bronze badges
answered Dec 5, 2011 at 19:23
Kurt Pfeifle Kurt Pfeifle
89.3k 24 24 gold badges 263 263 silver badges 349 349 bronze badges
Please edit with a workaround for Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS if you know any, thanks.
Commented Jan 5, 2015 at 12:33Download and install the PDF toolkit: pdflabs.com/tools/pdftk-the-pdf-toolkit Make sure to add the pdftk install directory to path during install.
Commented Mar 7, 2015 at 11:16fsutil file createnew [filename].[extension] [# of bytes]
fallocate -l 10G [filename].[extension]
answered Oct 4, 2017 at 18:06
1,245 1 1 gold badge 15 15 silver badges 23 23 bronze badges
How is this relevant with the original question about creating a PDF file?
Commented May 27, 2022 at 16:58
No I got that detail, as subtle as it was. But how does that have something to do with the actual initial question, or with my comment? OP is asking for a valid PDF file, what do you think a PDF validator answers if you pass it a 10 MB chunk of null bytes?
Commented May 29, 2022 at 23:39@anddam I will take a look when I get home. When I answered this in 2017, I came across this question because I also was trying to figure out how to create large PDFs, and this worked for my own testing purposes.
Commented May 30, 2022 at 16:55For those using macOS mkfile might be a good alternative to fallocate or dd
mkfile 100m some100mfile.pdf
answered Jul 2, 2018 at 14:17 3,431 1 1 gold badge 24 24 silver badges 36 36 bronze badgesThis has the same issue of the "Windows" and "Linux" answer with fsutil and fallocate: this does not produce a PDF file. The point is not dumping null or random data into a file, it is to get a valid PDF file.
Commented May 29, 2022 at 23:42@anddam - A valid PDF was not the point of the question. He asked for a quick, low overhead way to create a large file at specific sizes which just so happened to have a PDF extension. I get this from the example he provided and how the question was asked. I've used this on many occasions to test upload size limits.
Commented Jun 5, 2022 at 19:25No, he did not. OP asked for a PDF file and was using imagemagick to output valid PDF files. It wasn't clear what his for loop was intended to do, but the desired output format was very firmly expressed, he used all ".pdf".
Commented Jun 6, 2022 at 21:56pdftk file1.pdf file2.pdf file3.pdf cat output newfile.pdf
note that you should download windows version of pdftk
7,173 3 3 gold badges 26 26 silver badges 42 42 bronze badges answered Feb 4, 2015 at 10:43 321 4 4 silver badges 5 5 bronze badgesIf you want a really big valid PDF file, then
It works for me to create a big file (140MB) after some minutes.
answered Oct 9, 2019 at 16:20 harryssuperman harryssuperman 513 4 4 silver badges 7 7 bronze badgesUnder Linux there is pdfunite (part of poppler) that can concatenate the same pdf files to get one large pdf file:
pdfunite in.pdf in.pdf in.pdf out.pdf
answered May 5, 2020 at 6:33
Patrizio Bekerle Patrizio Bekerle
409 4 4 silver badges 8 8 bronze badges
I had problems using pdftk with the cat parameter had a better success with output.
The following command worked for me:
pdftk file_1.pdf file_1.pdf file_1.pdf file_1.pdf cat output.pdf
Using cat produced the following error:
Error: Unexpected text in page range end, here: output.pdf Exiting. Acceptable keywords, for example: "even" or "odd". To rotate pages, use: "north" "south" "east" "west" "left" "right" or "down" Errors encountered. No output created. Done. Input errors, so no output created.
I created a 172mb PDF is no time at all.