1

Ubuntu 12.04 LTS, 3.8.0-35-generic kernel, Firefox 27.0

  1. If I print a text file to pdf, I get a default filename which is always the same. (it is always "output.pdf")

    • How can I have automatic file name based on timestamp?
    • How can I use that particular printer in command line?
    • What is the name of that (virtual)printer I'm using?
  2. also from firefox, if I print to pdf

    • How can I have automatic filename based on timestamp?

following some commands and the output I received:

~$ lp "$in"
lp: Error - no default destination available.

~$ lpr "$in"
lpr: Error - no default destination available.

~$ dpkg --list | grep ' cups '
ii  cups    1.5.3-0ubuntu8    Common UNIX Printing System(tm) - server

~$ ps -ef|grep cups | grep -v grep
root   867   1  0 14:51 ?   00:00:00 /usr/sbin/cupsd -F

~$ cups --version 
cups: command not found

~$ cups-pdf
cups-pdf: command not found

I would like not to install other PDF printer, because the default one works very well.

5
  • I'm confused: you want to print to pdf from a terminal? Or from Firefox? The title suggests you're trying to print from the terminal (aka command line) but the question seems to be about printing from Firefox.
    – Amanda
    Feb 11, 2014 at 17:18
  • You can run man lp and man lpr for manual pages, which should help.
    – Wilf
    Feb 11, 2014 at 17:52
  • @Amanda hi, more important from command-line/bash. but also with gui interface but on that case with automatic numbering based from timestamp. anyway, possibly with the same virtual printer. Thanks.
    – user247117
    Feb 11, 2014 at 18:19
  • @user247117 Got it, and ... are you trying to produce a PDF? Or send a pdf to your printer and produce a piece of paper with ink on it?
    – Amanda
    Feb 11, 2014 at 19:05
  • @Amanda i don't have any physical printer. i just need to transform text files to pdf.
    – user247117
    Feb 11, 2014 at 19:29

1 Answer 1

1

I'm still not 100% sure what you're trying to do (it would help to know more about what kind of file you're starting with) but you have a lot of options.

From the Ubuntu Forums, try a2ps and ps2pdf

$ a2ps file.txt -o file.ps
$ ps2pdf file.ps file.pdf

a2ps (Anything to Post Script) you'll have to install, ps2pdf(Post Script to PDF) should be installed already.

Or from How to print a regular file to pdf from command line you can try enscript.

Or if you want to write something in Python, reportlab's pdfgen is great.

And if you need to do any work after you've created a PDF, pdftk is great for manipulating finished PDFs or water marking them.

5
  • i need to have pdf file, starting from text file. (for "gui" usage), at the moment i can successfully print to file, from menu "file>print>print to file". The problem is the default filename, which is always the same. i would better learn to customize default output filename based on date/timestamp instead of manually enter filename each time. what printer i'm actually using? ubuntu one? open office one? can You help me to find out? did you check the command output i posted? (about command line), what is the sintax to use the same printer i'm using but with command-line/bash?
    – user247117
    Feb 11, 2014 at 20:56
  • not open office. i have libre office. anyway the text editor i'm printing from, is called Gedit version 3.4.1
    – user247117
    Feb 11, 2014 at 21:08
  • So you have two questions here. If you want to change the default filename in the "Print to File" dialog, that is a separate question from how you can generate a PDF of a text file from the command line. You'll get better answers if you break those apart.
    – Amanda
    Feb 11, 2014 at 21:10
  • See askubuntu.com/questions/142253/more-print-to-file-settings and wiki.gnome.org/Initiatives/GnomeGoals/PrintToFile for more on gedit Print to File settings.
    – Amanda
    Feb 11, 2014 at 21:15
  • i have not idea how to brake them?
    – user247117
    Feb 11, 2014 at 21:39

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