Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have seen how simple it is for Mac OS to generate pdf from a document without additional software to install.
But I am looking for this functionality in Linux.
One scenario, for example, if I have myDocument.txt that contain an article, how can I convert this into pdf? My next question is, assuming that myDocument.txt is a 3-paged document, will it generate a 3-page continuous pdf and not just 3 separate pdfs?
Any tools for linux that does this? (GUI is fine, but commandline is preferable)

share|improve this question

migrated from Jan 4 '11 at 5:10

This question came from our site for professional and enthusiast programmers.

there is some tools like html2pdf, ghost script to pdf, but you still need the additional software – ajreal Jan 4 '11 at 5:06
There are many ways to do this on Linux, including PDF printers. What distribution are you using? There's a very good chance everything you need is in the repository. – Matthew Flaschen Jan 4 '11 at 5:07
up vote 4 down vote accepted

text2pdf - This is the latest version of text2pdf, and offers a number of improvements over version 1.0. As you might be able to guess from the name, text2pdf converts text files to PDF.

share|improve this answer

For the best way would be to install cups-pdf and add a virtual printer. More information here on Arsgeek

Another way is to Select "Print to File" and select .ps or .pdf

share|improve this answer

Beside all the *2pdf and *topdf tools you might find in your /usr/bin directory, a "Print to PDF file" should be present in your DE of choice. In KDE, for example, the kprinter applet will do this. The plus side of this approach, is that the formatting has already been taken care of, by the application that you will choose to print from, and you might be able to drive that application from the command line with DBUS (or DCOP).

share|improve this answer

OpenOffice Word Processor is typically used in GUI form, but it does have an "Export to PDF" feature. See this answer for hints on how to do it in a scripted form for command line use.

share|improve this answer
in some way, this is helpful to me. I haven't known "Export to PDF" until I read your answer. +1 point for you. Thanks. – Neilvert Noval Aug 18 '11 at 8:07

Using a2ps and ps2pdf:

a2ps --columns=1 file.txt|ps2pdf - output.pdf
share|improve this answer

In the latest version of Ubuntu Linux (Maverick Meerkat), almost all software seem to have the ability to print to PDF. Just give File -> Print, select "Print to file", set output format to PDF, and give the filename and location. If any application prints only to Postscript, convert the file to PS file to PDF using ps2pdf command. CUPS-PDF is not really recommended.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .