Date: Thu, 27 Jan 2011 19:22:33 +0100 From: Polytropon <freebsd@edvax.de> To: Bahman Kahinpour <bahman.linux@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: Printing from inside the applications in FreeBSD 8.1 with CUPS Message-ID: <20110127192233.5a67b38e.freebsd@edvax.de> In-Reply-To: <AANLkTi=nxzivgx4fz-XBLkAFCH7A1GqOAXJxO32ZVzb1@mail.gmail.com> References: <AANLkTi=nxzivgx4fz-XBLkAFCH7A1GqOAXJxO32ZVzb1@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 27 Jan 2011 21:21:48 +0330, Bahman Kahinpour <bahman.linux@gmail.com> wrote: > Note that I can not print using simple "lp" command as there a "lp" in > /bin/lp. 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 Laserjet 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 application. :-) 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 the printer. 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. % lpq 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 standard input. > 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 (2.0.0.20_9,1) is: lpr ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME} This is the lpr found FIRST in the path. % which lpr /usr/bin/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. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110127192233.5a67b38e.freebsd>