Monday, February 16, 2009

Merge PDF Files on Fedora Linux

To merge or combine two PDF files or more, you can use ghostscript command line, without use a Adobe Proffesional. With GhostScript, merge more easy. To do that, you must have ghostscript on your linux. If you don't have it, please run this command line :

Code:

# yum install ghostscript

Example :

You have two PDF files, say first.pdf and second.pdf. And you want to combine become a PDF file, say firstANDsecond.pdf. Place these 2 PDF files on same folder. And now you run :

Code (in one line and case sensitive):

$ ghostscript -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH first.pdf second.pdf

or

Code (in one line and case sensitive):

$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH first.pdf second.pdf

To merge PDF files, you can use another tool : convert.

Code :

$convert first.pdf second.pdf output.pdf

where first.pdf and second.pdf are the source files, and output.pdf is the destination file.

The difference beetwen “convert” and “gs” tool is on the size of the output file. Based on my test, output file from “gs” tool is 595 kB. Output file from “convert” file is 4.6 MB.

Let's enjoy it.

Muh. Sirojul Munir (msmunir@batan.go.id)

No comments:

Post a Comment