In gedit, printing a file gives an option of printing to file where the file can be saved as a pdf. How can I do the same thing from the command line?
Command-Line – Print a Regular File to PDF
command linepdfvirtual-printer
command linepdfvirtual-printer
In gedit, printing a file gives an option of printing to file where the file can be saved as a pdf. How can I do the same thing from the command line?
Best Answer
Here's a solution that doesn't involve OpenOffice:
sudo apt-get install enscript
enscript my_text_file.txt -o - | ps2pdf - output.pdf
There are more options to
enscript
, e.g.-B
to omit the page header. Seeman enscript
for all of the options.