How to merge multiple PDF files onto one page with pdftk?

I have a range of PDF files 1.pdf, 2.pdf, etc. that I would like to merge into one file, with all the PDFs tiled on one page.

Currently, I have tried pdftk to merge these files, but they are put on separate pages:

pdftk 1.pdf 2.pdf ... cat output merged.pdf

Is there a way to, instead, tile the individual PDF files into one master page on merged.pdf?


Solution 1:

I do not know if pdftk can do this, but pdfjam can. It can be installed on debian or derivates with sudo apt install texlive-extra-utils. Then you can do:

pdfjam Page1.pdf Page2.pdf --nup 2x1 --landscape --outfile Page1+2.pdf

It puts 2 pages on one page side by side. With --nup 1x2 --no-landscapeyou can put two pages on one page on top of each other.

Solution 2:

The pdfLaTeX based pdfnup might work for you. If you have lots of pdf-files you may need to make a long pipe of pdfjam or run it several times.

There is also pdfnup in python.

Solution 3:

Not sure what you mean by tiled on one page. I was looking for a way to merge multiple PDFs on one page - on top of another. This can be done with pdftk like this:

pdftk foreground.pdf background background.pdf output merged.pdf