Univers Libre

Ghostscript − Concatenate pages with different orientations

Written on 10 August 2014, 08:35 EDT
Tags: command, ghostscript, pdf.

Concatenate multiple PDF documents while preserving orientation (portrait/landscape) of each page:

$ gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dAutoRotatePages=/PageByPage -sOutputFile=concatenated.pdf $(ls -v doc*.pdf)