formats

Combine PDFs in Linux

Published on April 1, 2011, by + in linux.




Use ghostscript to easily combine multiple PDFs into one PDF document from the command line.

First make sure you have ghostscript installed:

sudo apt-get install ghostscript

Here is the magic command. Here place the order of existing PDFs in the order you wish them to appear in the combined document.

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=combined.pdf existing_1.pdf existing_2.pdf

The output will look similar to this:

stmiller@brahms:~/asdf$ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=report_final.pdf paul_office_2.pdf paul_email.pdf order.pdf Report04-5.pdf 

GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Processing pages 1 through 1.
Page 1
Processing pages 1 through 1.
Page 1
Processing pages 1 through 1.
Page 1
stmiller@brahms:~/asdf$

Sweet!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home linux Combine PDFs in Linux