oe7drt-website/content/posts/2024/71-combine-multiple-pdf-files/index.md

1 KiB

title summary date lastmod categories tags
Combine multiple PDF files A quick note on how I got multiple PDF files combined into one single one on a linux command line. <small>The thumbnail was created with Google AI (Imagen 3).</small> 2024-10-26T20:27:05+02:00 2024-12-08T11:13:52+0000
computerstuff
command-line
openbsd
freebsd
linux

I sometimes want to combine two or three PDF files into one (to print them two pages on a sheet, mostly).

I did this recently and here I write it down again so I can find it again (I will forget this until the next time I need it again):

$ gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf ...

Found on Stack Overflow.

I also found another solution (further down at the link above) usable, but it produces much bigger files:

$ qpdf --empty --pages *.pdf -- out.pdf