I am using Dompdf to generate A5 pdf documents from a html template and Pdfnup (Part of Pdfjam) to combine them into a nice single A4 sheet, which helps saving some paper when printing :)
# Generate an a5 pdf
php dompdf.php mytemplate.html -p 'A5' -f a5doc.pdf
# combine two copies of the generated A5 into a single A4 page
pdfnup a5doc.pdf a5doc.pdf --nup '2x1'
This works just fine; though the second step forces me to install a huge amount of dependencies (i.e. Tex-Latex, pdftex, ecc.) and would clutter my production server. I am wondering if is there any way to combine the generated documents without actually using Pdfnup. For example, is there any way of doing this with pdftk?
Thank you in advance!
You can do it with a combination of Ghostscript and pdftk.
Here's how: https://superuser.com/questions/191373/linux-based-tool-to-chop-pdfs-into-multiple-pages/192293#192293 .
The above linked example shows how to split pages into half. Just modify the steps accordingly, using different parameters to...
pdftk
.Hint: You'd want to use either of pdftk's multistamp
or multibackground
operations (NOT: its shuffle
operation!) to get the wanted final result.