Penguin
Annotated edit history of CUPSNotes version 35, including all changes. View license author blame.
Rev Author # Line
32 CraigBox 1 !!Printing to PDF
25 LiYan 2
3 If you have an application that can't output natively to PDF, you can create yourself a PDF printer.
4
5 # Get the backend for it - look for PDF Distiller Script from http://printing.kde.org/downloads/
6 # Install this as 'pdf' in /usr/lib/cups/backends, and set it world executable.
7 # You may need to restart CUPS (e.g. on RedHat systems run 'service cups restart')
8 # You probably need GhostScript installed (try looking for a package called gs-common) for ps2pdf(1).
9 # Add a printer, either using the web interface (http://localhost:631/), XimianDesktop's printer interface, or the command line:
27 JohnMcPherson 10 <pre>
11 lpadmin -p PDFcreator -v pdf:/home/chris/PDFfiles -E -P /path/to/distiller.ppd
12 </pre>
25 LiYan 13
14 You can use any "raw" ppd you want really - I used the Raw/Raw (en) option in the installer, and it worked fine. You can download a color postscript ppd file from the [cups-pdf site|http://cip.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/].
15
16 Create the printer with the [URI] of pdf:/where/you/want/the/output.
17
18 Easy as that. Then you can set [Samba] up to print to this printer via [CUPS].
19
20 There are some notes on how this can be used with [Samba] to email PDFs to you on the [SambaPDFPrinter] page (Which also has a PDF Printer setup for LPRng).
21
22 There is also a [cups-pdf|http://cip.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/] virtual backend which can be used to print to pdf from cups. Your distribution should distribute this - for example, Debian (Sarge or Sid) users can "apt-get install cups-pdf".
23
24 ----
32 CraigBox 25 !! Cups and SAMBA
25 LiYan 26
27 See the SambaPrinting page for more information
28
29 ----
32 CraigBox 30 !! Auto-discovery of printers
25 LiYan 31 [CUPS] can do broadcasts over a network to both advertise the availability of local printers as well as to find and "proxy" for remote printers. On a [LAN] this is probably what you want, but if you are on the MetaNet this may result in other people seeing your printers, and you seeing theirs. This can have unpleasant side-effects: for example, my cups found remote printers that were later firewalled/disconnected or removed. Later that day when starting a [GNOME] application, it would hang on start-up as the gnome printing backend tried contacting the remote printers which were now un-contactable.
32
33 Anyway, the lesson is to edit cupsd.conf to disable this. (This is in the /etc/cups/ directory in [Debian] and RedHat.) Either disable browsing completely by adding the line:
34 Browsing off
32 CraigBox 35 Or set the network/address mask for the ~BrowseAllow/~BrowseDeny variables (for incoming broadcasts) and ~BrowseAddress (for outgoing broadcasts). Debian [Sarge] defaults to browsing on, accepting incoming information from anywhere and not sending out any information.
28 BrentAddis 36
37 ----
33 JohnMcPherson 38 !!!Examples of adding printers
39 !!Simple CUPS setup
28 BrentAddis 40
33 JohnMcPherson 41 I plugged a Epson Color Stylus 760 into the [USB] port of a Debian Sarge machine, and this is how I made it go:
28 BrentAddis 42
33 JohnMcPherson 43 * Install CUPS: <tt>apt-get install cupsys cupsys-driver-gimpprint gs-esp</tt>
44 * Edit <tt>/etc/cups/cupsd.conf</tt> and add Apache-like <i>Allow</i> stanzas at the <Location> sections at the bottom: I wanted all of my local network to be able to administer or use the printer, so I added <tt>Allow From 10.1.30.0/24</tt>.
45 * You need to have your USB drivers loaded: in my case, they were a <tt>modprobe ehci-hcd; modprobe uhci-hcd; modprobe usblp</tt> away. I put the module names in /etc/modules so they would be loaded at boot. If you want, you can use hotplug to manage USB: see HotPlugNotes. Ubuntu does this all automatically for you.
46 * Navigate to http://server:631/ and log in. Use credentials of someone in the 'lpadmin' group: either add yourself, or use root.
47 * Click "printers" on the top bar; click "Add a printer". Follow your nose through here. Print a test page at the end to make sure its going.
28 BrentAddis 48
33 JohnMcPherson 49 <i>Hint</i>: If it doesn't go, set '~LogLevel debug' in /etc/cups/cupsd.conf, restart cups, and look at /var/log/cups/error_log.
28 BrentAddis 50
33 JohnMcPherson 51 Congratulations, you now have a printer at ipp://<i>server</i>/printers/<i>printername</i>.
28 BrentAddis 52
33 JohnMcPherson 53 From an Ubuntu Dapper client, click System, Administration, Printing. Double click "New printer", set the type to CUPS printer (IPP), and add the URL above.
28 BrentAddis 54
33 JohnMcPherson 55 Follow your nose again through the rest, and then you should have a working printer.
28 BrentAddis 56
29 PerryLorier 57
28 BrentAddis 58 !! Setting up a USB printer by the command line
27 JohnMcPherson 59
60 These are just some observations of what I did to set up a Brother HL 1440 laser printer (using the [USB] port) on a machine that already had [CUPS] installed, and had an HP Deskjet installed. This was done on debian woody (or close enough to woody) remotely via an ssh connection. These instructions also worked perfectly for a Brother HL 1430 on a Redhat 9 system running XimianDesktop although I didn't use any of the graphic configuration tools. Hopefully these instructions are generic enough to work with any USB printer supported by cups.
25 LiYan 61
62 ! Preparation
63 Make sure the kernel has USB Printer support. I created a kernel module (CONFIG_USB_PRINTER) and made sure it installed ok.
64
65 Make a device file. I assume people using devfs don't need to do this manually. I did:
27 JohnMcPherson 66 <pre>
25 LiYan 67 mkdir /dev/usb
68 mknod /dev/usb/lp0 c 180 0
27 JohnMcPherson 69 </pre>
25 LiYan 70 although some people use the name "/dev/usb/usblp" instead.
71
72 ! Config files
73 Foomatic is the cups package with all the printer description files (*.PPD) and setup stuff.
74
75 To determine which driver cups needs to use, you do
27 JohnMcPherson 76 <pre>
25 LiYan 77 # foomatic-configure -O | less
27 JohnMcPherson 78 </pre>
25 LiYan 79 which lists all the supported printers, and search for your printer. If I search for "1440" I find an entry for the new printer that includes the line
80 <driver>hl1250</driver>
81
82 Now the magic line:
27 JohnMcPherson 83 <verbatim>
84 foomatic-configure -s cups -n Brother -c file:/dev/usb/lp0 \
85 -p Brother-HL-1440 -d hl1250 -o PageSize=A4
86 </verbatim>
25 LiYan 87 (This should all be on one line, without the "\")
88 This says to use the cups printing system, and name the new printer "Brother". The -p and -d options are the printer ID and driver I got from the previous step in the output. Also I used an option to set the default page size to A4.
89
90 Note that this can't be done until the printer is connected, as I got a "client-error-not-possible" error until someone at the remote end plugged the new printer into the USB port.
91
92 You can also access cups by going to http://localhost:631 and authenticating as any user in the "lpadmin" group (I used root). From here I printed a test page and made this the default printer.
93
94 You can also make it the default printer by editing /etc/cups/printers.conf or with the command "lpadmin -d Brother"
95
96 ! /etc/printcap
97 4) Edit /etc/printcap for "[Legacy]" applications. cups does make a printcap file, but in debian the default name is /etc/printcap.cups. Just copy that - it had empty entries for my two installed printers.
98
33 JohnMcPherson 99 ----
100 !!! Random Hints/Printer-specific bugs/workarounds
34 CraigBox 101
102 !! 426 Upgrade Required
103
104 Set <tt>DefaultEncryption Never</tt> in cupsd.conf.
105
33 JohnMcPherson 106 !! Wrong printer/options being used by default
107 remove ~~/.lpoptions (for all users) as that hard-coded the default printer! I don't know what created that file, as only some users had it.
25 LiYan 108
109 Check for a PRINTER environment variable and make sure that it's either unset or set correctly.
110
33 JohnMcPherson 111 !!<tt>cupsd</tt> loading modules on startup
112 On my Debian and Ubuntu systems, CUPS causes the <tt>lp.ko</tt> (and parport-related) modules to be loaded. It turns out that cupsd runs all the programs in the <tt>/usr/lib/cups/backend</tt> directory, and the 'parallel' program in there explicitly loads the lp module. Remove this symlink if you want to stop this behaviour.
25 LiYan 113
33 JohnMcPherson 114 !!Brother HL-1440
31 JohnMcPherson 115 CUPS will recommend and use the hl1250 PPD driver for this printer. Unfortunately, it doesn't handle the page margins quite right. Since no package seems to have a PPD file specifically for this printer, you'll have to work around it. Try one of the following methods:
116
117 __1.__ Set some default options for this printer:
118 <pre>
119 lpoptions -p ''<your printer>'' -o page-left=22 -o page-right=22 -o page-top=22 -o page-bottom=22
120 </pre>
121 If you run "lpoptions" as root, the setting will be valid for all users. I can't tell what unit those distances are in, but this method worked for me.
122 Doing so as root just puts them into the file <tt>/etc/cups/lpoptions</tt>.
123
124 __2.__ add the following to your ppd file (/etc/cups/''printer_name''.ppd):
125 <verbatim>
126 *OpenUI *Margins/Page Margins/Offsets: PickOne
127 *DefaultMargins: Custom
128 *Margins Default/Driver Default: ""
129 *Margins Custom/Custom: "<</.HWMargins[0 0 0 0] /Margins[150 150
130 >>setpagedevice"
131 *CloseUI: *Margins
132 </verbatim>
133
134 (you may need to change the margins to suit).
135
136 __3.__ change the following in your ppd file:
137 <verbatim>
138 59a60
139 < VICE=hl1250%A%Z -sOutputFile=- -"
140 > *JCLBegin: "<1B>%-12345X@PJL JOB<0A>@PJL SET RESOLUTION = 600<0A>"
141 62c63
142 > VICE=hl1250%A%Z -r600 -sOutputFile=- -"
143 </verbatim>
144 (This tells the driver to use 600dpi, since the hl1250 driver apparently doesn't have the margin problems at this resolution).
145
146 __4.__ :
147 > The good news was that by specifying on 1200x600 and changing the
148 > drivers to 0.15 for top, left, and right and 0.20 for the bottom margin,
149 > the CUPS testpage, (postscript) and text prints look as close to their
150 > 'raw' postscript HP printer counterparts as I can get. Without changing
151 > the margin settings and using 1200x600, top lines of text would be cutoff
152 > the page, etc.
153
154 __5.__: Proprietary PPD file
155 There should be an appropriate PPD file on the CD-ROM containing the windows driver that came with the printer. This might be better under CUPS than cups's
156 ppd files. Brother have also freed up the licensing on some of their printing drivers, so maybe their ppd files will be included with cups in the future.
157
25 LiYan 158 !! Useful Command-line tools
27 JohnMcPherson 159 To see a list of all successful print jobs from the current machine (by all users)
160 lpstat -W completed -u
25 LiYan 161
27 JohnMcPherson 162 I've noticed that if my USB printer isn't turned on when cups is started, sometimes after turning the printer on, cups still thinks the printer isn't ready. You can manually re-enable the printer by:
163 <pre>
164 cupsenable ''printername''
165 </pre>
166
167 For the example printer setup above, ''printername'' with be "Brother".
168 Similarly, you can temporarily disable printing to a printer (although cups will still queue jobs for it) with
169 <pre>
170 cupsdisable ''printername''
171 </pre>
172
173 You can check the status of a printer (ie whether cups is accepting jobs, and whether the printer is enabled or not) with
174 <pre>
175 lpstat -a -p
176 </pre>
177 Or if you want more info ("__l__ong listing"):
178 <pre>
179 lpstat -a -l -p
180 </pre>
181 Note that the order of these options matters.
33 JohnMcPherson 182 ----
183 !! Using Netatalk2 with cups
184
185 With the release of sarge, debian are now using automatic cups stuff, rather than the old lpr support.
186
187 This means you cannot just use the old <tt>papd.conf</tt> and hope it works. You'll get such wonderful things as it simply disapearing, and not removing the pid file, without any errors. Lovely thing that.
188
189 So, you'll need to do a few things.
190
191 Cups broadcasting is great, however, it's not always as great as it would seem. It can (and will in our case) pick up other cups broadcasted printers. You need to disable the reception of these printers in your config otherwise pap can also die.
192
193 EG:
194
195 in <tt>/etc/cups/cupsd.conf</tt> find the browse section, and add in, something much like the following:
196 <verbatim>
197 #Allows browsing from the local network
198 BrowseAllow 192.168.2.0/24
199 #Disables printer broadcast from backup server
200 BrowseDeny 192.168.6.10/255.255.255.255
201 </verbatim>
202 Make sure you have:
203 <verbatim>
204 BrowseOrder allow,deny
205 </verbatim>
206 Set as well.
207
208 Once this is done, edit <tt>/etc/netatalk/papd.conf<tt>, and add:
209 <verbatim>
210 cupsautoadd@yourzonehere:op=root:
211 </verbatim>
212
213 This will automatically get the cups printers, and use the ppd that cups uses.
214
215 if pap is not running, either restart netatalk in the normal way, just type papd, which starts it, uses the config, and inserts a pid file.
216
217 The logs should show something like:
218
219 <verbatim>
220 Jul 15 12:13:23 host papd[16668]: restart (2.0.2)
221 Jul 15 12:13:23 host papd[16668]: CUPS support enabled (1.1)
222 Jul 15 12:13:30 host papd[16668]: Authentication disabled: SharpC150
223 Jul 15 12:13:30 host papd[16668]: register SharpC150:LaserWriter@zone1
224 Jul 15 12:13:36 host papd[16668]: Authentication disabled: hplj4-letterhead
225 Jul 15 12:13:36 host papd[16668]: register hplj4-letterhead:LaserWriter@zone1
226 Jul 15 12:13:42 host papd[16668]: Authentication disabled: hplj4
227 Jul 15 12:13:42 host papd[16668]: register hplj4:LaserWriter@zone1
228 Jul 15 12:13:48 host papd[16668]: Authentication disabled: hp8100
229 Jul 15 12:13:48 host papd[16668]: register hp8100:LaserWriter@zone1
230 Jul 15 12:13:54 host papd[16668]: Authentication disabled: hp5000
231 Jul 15 12:13:54 host papd[16668]: register hp5000:LaserWriter@zone1
232 </verbatim>
233 The only error I have so far encountered, is this:
234 <verbatim>
235 can't register SharpC150@greed:LaserWriter@zone1
236 Jul 15 11:24:08 host papd[7929]: Deleting CUPS temp PPD file for SharpC150_greed (/var/spool/cups/tmp/42d6f4186a35b)
237 </verbatim>
238
239 This was because it was a broadcast printer, and cups didn't have a local copy of its ppd. THis is why I recommend disabling cups broadcast receive (send is fine) using ~BrowseDeny.
240
241 It is also possible to setup netatalk to use the cups printers, but add your own settings. I won't go into much detail due to lack of time, however,
242
243 If for example, you wanted to add a cups printer, with a different zone, and maybe running as a different user, you would enter into <tt>papd.conf</tt>:
244 <verbatim>
245 hp5000-test2@another zone:\ - This is the printername that will be broadcast
246 :pr=hp5000:\ - This is the cups printer that will be used (opt)
247 :pd=/usr/share/lib/ppd/anotherdriver.PPD: -The ppd you want to use (opt)
248
249 opt= optional. space constraints.
250 </verbatim>
34 CraigBox 251
252 ---
253
254 !!!Not seeing all the drivers you want?
255
256 Debian doesn't seem to have dependencies to drag in the PPDs for all the foomatic drivers, even if you install the filters.
257
258 Install also the <tt>foomatic-filters-ppds</tt> package.
33 JohnMcPherson 259
35 JimCheetham 260 ----
261 !! Windows printing to Cups, without Samba
27 JohnMcPherson 262
35 JimCheetham 263 There are many howtos on how to set up printing from windows clients to a printer attached to a linux computer via samba, but theres not much I could find on doing it without samba. Heres how I did it:
264
265 !Linux Server Setup
266
267
268 * Set up cups to work locally - this is pretty standard and I will assume you have this sussed already. Most distros tend to use cups these days. Assume your printer is, like mine, called "hp". Lets also assume the linux machine with the printer attached is called "server".
269
270 * You need to sort cups so that it will allow access from your LAN. Assuming a LAN with addresses 192.168.1.x you need this stanza in /etc/cups/cupsd.conf
271
272 <verbatim>
273 <Location /printers>
274 Order Deny,Allow
275 Allow 192.168.1.*
276 </Location>
277 </verbatim>
278
279 * Please note that there is also the possibilty of stronger sytstems involving proper authentication, but if you are not exposing port 631 to the internet you probably aren't doing too much harm allowing it to be set up this way.
280
281 * You can also have different permissions for different printers, if I just wanted to allow access to printer hp, but not others I would instead use:
282
283 <verbatim>
284 <Location /printers/hp>
285 Order Deny,Allow
286 Allow 192.168.1.*
287 </Location>
288 </verbatim>
289
290 !Windows client setup
291
292
293 * On the linux box find the .PPD file relevant to your printer. For any printer that has configured, cups conveniently copies it from "somewhere on your file system" to /etc/cups/ppd/hp.ppd. Make this available to your windows computer, cups makes it available at http://server:631/printers/hp.ppd. NB! windows, in a rare fit of fussiness over case seems to require at least the .PPD extension to be capitalised. Therefore download it from your print server and rename it in capitals. (1)
294
295 * Download the Adobe generic postscript driver for windows (2). Use winzip or similar to unzip them to a directory on your windows box (or use cabextract to extract it on your linux box and share it via samba)
296
297 * Run adobe's setup program. Click through the first couple of boxes and when it asks whether the printer is local or networked, choose networked. In the next box put in the address of the printer like this (If you don't have DNS working on your lan simply use the IP address of the linux box instead of "server"):
298
299 <verbatim>
300 http://server:631/printers/hp
301 </verbatim>
302
303
304 * The next dialog will say "The network printer is not using the Adobe driver. If you know the type of the selected printer Click Yes to install the driver...(and some other options)". Click yes and you will get a dialog box where you can browse for and choose the .PPD file you downloaded. Choose it.
305
306 * The next dialog asks if you want it to be the printer to be the default on the windows box, and if you want to print a test page. Make your choices.
307
308 * The next dialog gives a summary, click "Install" , or "Back" to correct errors. It then installs the driver and asks if you want to configure the printer - click yes and set up your paper preferences etc. (remember to set A4).
309
310 * You are done. You should be able to print from windows applications. To access the printer's special features click "Advanced" in the print dialog box, it will bring up a dialog with all the options specified in the PPD file.
311
312 (1) PPD files are wonderful wonderful things. They describe the
313 capabilities of the printer in a text file format, and are genuinely
314 cross-platform usable. For every option setting they contain ~PostScript
315 code which, embedded in the ~PostScript file sent to the printer, applies
316 the corresponding setting to the job. They allow (for example) Adobe's
317 postscript driver to be aware of the printer options on any printer that has a PPD file associated
318 with it, even if it isn't a postscript printer. PPD files are available
319 from a variety of places, and of course Mac-OS X wants them too, so
320 manufacturers are releasing them more and more. Further info:
321
322 http://www.linuxprinting.org/ppd-doc.html
323 http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/III.PostScript-and-PPDs/III.PostScript-and-PPDs.html (also available as pdf)
324
325
326 (2) www.adobe.com - support menu, downloads, postscript printer drivers
327 (windows) choose your language version, its about 7.5M and named
328 winsteng.exe. It is a self-extracting zip file. UPDATE 30 April 2007: It is getting harder to find the winsteng.exe file. Adobe have changed around their website yet again. The easiest route to find it seems to be to search for "winsteng.exe" through the search box on the adobe site. Alternatively try this url, although I can't guarantee that it won't change: http://www.adobe.com/support/downloads/thankyou.jsp?ftpID=1500&fileID=1438
27 JohnMcPherson 329 ----
25 LiYan 330 See CupsAccounting
331
332 Part of CategoryPrinting

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 5 times)