Printing from inside the applications in FreeBSD 8.1 with CUPS
freebsd at edvax.de
Thu Jan 27 18:22:37 UTC 2011
On Thu, 27 Jan 2011 21:21:48 +0330, Bahman Kahinpour <bahman.linux at gmail.com> wrote:
> Note that I can not print using simple "lp" command as there a "lp" in
FreeBSD uses the standard interface /usr/bin/lp*, while CUPS
brings its own commands at /usr/local/bin/lp*; it also differs
in the amount of commands (e. g. additional lpstat command).
> How can I print from inside the applications?
CUPS should provide a default printer ("lp" is the default
name, but it can be anything else). You can define the
environment variable PRINTER to point to the desired default
printer which will be addressed whenever you print from
inside an application. In my case,
% echo $PRINTER
shows that all lp* commands will address "Laserjet", and
all application data will go to that printer spool.
> Take Firefox or
> gedit for instance. How can I print from those apps using File>Print
> menu? I need to add stuff to those dialogs which open from File>Menu.
No. You don't need an individual printer driver for each
Basically, printing from an application means that this program
will create the print content in PS format and send it to the
printer spool (identified by the default printer name). From
there on, the printer filter (CUPS in your case) will pick up
the PS data and hand it to the printer, or convert it to the
printer's language (e. g. PCL) and then send this result to
When I go File -> Print... in Firefox, "PostScript/default"
is the name of the printer. Set properties if needed (e. g.
A4 paper size, margins, whatever you need). After pressing
Enter, the print job should show up in your printer queue.
Laserjet is ready and printing
Rank Owner Job Files Total Size
1st poly 541 (standard input) 555466 bytes
Note that CUPS may require "lpstat", not the standard "lpq".
Some applications provide a temporary file name, or the name
of the input file; in case of Firefox you can see that the
printing content has been sent to the printer spool via
> There are only two choices "Printer to File" and "Print to LPR".
This should be correct.
> Printing to LPR does not work at all as I think it references /bin/lpr
> instead of /usr/local/bin/lpr.
If you use CUPS, you need to use its print job entry tools,
/usr/local/bin/lp*. In the "properties" dialog window, the
print command of my Firefox (18.104.22.168_9,1) is:
This is the lpr found FIRST in the path.
% which lpr
For CUPS, it does have to be the other lpr. If you use CUPS
*INSTEAD* of the default system tools, there's an option in
"make config" that allows you to overwrite the system tools
in the default location. You can, however, work with symlinks
to "redirect" the commands to their location in the local/
subtree, or simply rename the system tools lp* to lp*.sys.
> (Snapshot attached)
Nothing attached. :-)
> How can I add more
> options in this dialog?
No need. You just have to use the correct tools (CUPS's tools)
to address your default print queue.
> Right now, in order to print I choose Print to File "as PostScript"
> and use command line cat PostScriptFile | /usr/local/bin/lp to print.
This is what Firefox does itself.
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions