Showing posts with label pdf. Show all posts
Showing posts with label pdf. Show all posts

Thursday, January 20, 2011

Create PDF files of man pages in Ubuntu

One of the most important feature of linux is its internal online help called man pages which gives a detailed description of any command, its options and syntax. A help on a command can be obtained by simply typing man followed by the command name. For example,
man ls
will give details on the syntax and options of ls command.

If such a detailed entry is needed to be sent to someone over the net, then you may want to convert it into a pdf file. Here's a simple trick that could do it using two simple tools - man and ps2pdf.


man with -t option gives output in postscript format which is well suited for printing.
ps2pdf does the function of printing to a pdf file. So that's the simple trick here. We're going to pipe the output of man -t to ps2pdf and assign it a filename. And we're done.

For example,

man -t ls | ps2pdf - ~/ls_manpage.pdf

The above example creates a pdf file named ls_manpage.pdf in the user's home directory whose contents is that of the man ls command. 

Sunday, November 21, 2010

How to convert PDF documents to JPG/PNG files in Ubuntu

PDFs are so famous that every document that we download now from the internet are in pdf formats. PDF readers are omnipresent that even most of the phones now come with. Whenever I have some document to send through mail I just send it as a pdf document. But there are times when you may want to put a pdf document on a website. The simplest way is to convert the pdf file into jpg/png file which can be easily uploaded to a website. Here's a simple way that converts pdf document to jpeg/png image files in less than 2 seconds.
You need to install imagemagick. On ubuntu, you can do it by typing this in your terminal.
sudo apt-get install imagemagick
Then its just a cake's walk. Execute the following in terminal.
To convert it to jpg image -
convert example.pdf example.jpeg
and if you want to convert it to png -
convert example.pdf example.png
If there are multiple pages in your pdf document then the files will automatically renamed to file-0.jpg file-1.jpg file2-jpg and so on.
Hope that comes in handy next time you want to put a pdf file on your website.