Merging PDFs and the lovely gnome-open

I came across two very handy tools today: gs and gnome-open. gs (Ghostscript) is an interpreter for PDF languages. You can do lots of cool things with it, for which you can check the man page. The reason I needed it was to combine some PDFs created by my scanner into a single PDF. gs made this super easy:

1
2
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=OUTPUT_FILE.pdf \
 -dBATCH PDF_TO_COMBINE_1.pdf PDF_TO_COMBINE_2.pdf

You just need to change the name of “OUTPUT_FILE.pdf” (the file to be created containing all the input files) as well as the “PDF_TO_COMBINE” files (your input PDF files, in the order you want them in the final doc). It doesn’t take very long to run, might spit back errors regarding format (at least it complained about the PDFs from XSane), but still should make the file. Easy and useful! Thanks to Debian Admin for providing a good example.

gnome-open allows you to open pretty much any file from the command line while in Gnome, using the preferred application for the file’s type. So to open a PDF, instead of navigating to it in a file browser and double clicking it, you just do:

1
gnome-open my_cool_thing.pdf

And it opens right up in Document Viewer (or whatever your preferred app for PDFs is set to). See more examples here. I also added an alias “go”, since that’s a lot shorter and more fun:

1
alias go="gnome-open"

Post to Twitter Post to Delicious Post to Digg Post to Reddit

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

This entry was posted in Desktop and tagged , , , , . Bookmark the permalink.

One Response to Merging PDFs and the lovely gnome-open

  1. tosky says:

    For the sake of completeness, if you use KDE:
    kfmclient exec file
    :)

    You can also combine multiple PDFs (and execute other, more complex, operations) using pdftk:
    http://www.pdfhacks.com/pdftk/

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>