Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com 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

6 Answers 6

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.

http://www.eprg.org/pdfcorner/text2pdf/

share|improve this answer

Using a2ps and ps2pdf:

a2ps --columns=1 file.txt|ps2pdf - output.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

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

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.