preparing for release of 1.9.18alpha13
[Samba.git] / docs / textdocs / Printing.txt
blob2b9dbfbbeec3f03a2674b6317a12fd205f518b82
1 !==
2 !== Printing.txt for Samba release 1.9.18alpha13 16 Dec 1997
3 !==
4 Contributor:    Unknown <samba-bugs@samba.anu.edu.au>
5 Date:           Unknown
6 Status:         Current
8 Subject:        Dubugging Printing Problems
9 =============================================================================
11 This is a short description of how to debug printing problems with
12 Samba. This describes how to debug problems with printing from a SMB
13 client to a Samba server, not the other way around. For the reverse
14 see the examples/printing directory.
16 Please send enhancements to this file to samba-bugs@samba.anu.edu.au
18 Ok, so you want to print to a Samba server from your PC. The first
19 thing you need to understand is that Samba does not actually do any
20 printing itself, it just acts as a middleman between your PC client
21 and your Unix printing subsystem. Samba receives the file from the PC
22 then passes the file to a external "print command". What print command
23 you use is up to you.
25 The whole things is controlled using options in smb.conf. The most
26 relevant options (which you should look up in the smb.conf man page)
27 are:
28         print command
29         lpq command
30         lprm command
32 Samba should set reasonable defaults for these depending on your
33 system type, but it isn't clairvoyant. It is not uncommon that you
34 have to tweak these for local conditions.
36 On my system I use the following settings:
38         print command = lpr -r -P%p %s
39         lpq command = lpq -P%p
40         lprm command = lprm -P%p %j
42 The % bits are "macros" that get dynamically replaced with variables
43 when they are used. The %s gets replaced with the name of the spool
44 file that Samba creates and the %p gets replaced with the name of the
45 printer. The %j gets replaced with the "job number" which comes from
46 the lpq output.
48 When I'm debugging printing problems I often replace these command
49 with pointers to shell scripts that record the arguments, and the
50 contents of the print file. A simple example of this kind of things
51 might be:
53         print command = cp %s /tmp/tmp.print
55 then you print a file and look at the /tmp/tmp.print file to see what
56 is produced. Try printing this file with lpr. Does it work? If not
57 then your problem with with your lpr system, not with Samba. Often
58 people have problems with their /etc/printcap file or permissions on
59 various print queues. 
61 Another common problem is that /dev/null is not world writeable. Yes,
62 amazing as it may seem, some systems make /dev/null only writeable by
63 root. Samba uses /dev/null as a place to discard output from external
64 commands like the "print command" so if /dev/null is not writeable
65 then nothing will work.
67 Other really common problems:
69 - lpr isn't in the search path when Samba tries to run it. Fix this by
70 using the full path name in the "print command"
72 - the user that the PC is trying to print as doesn't have permission
73 to print. Fix your lpr system.
75 - you get an extra blank page of output. Fix this in your lpr system,
76 probably by editing /etc/printcap. It could also be caused by
77 incorrect setting on your client. For example, under Win95 there is a
78 option Printers|Printer Name|(Right
79 Click)Properties|Postscript|Advanced| that allows you to choose if a
80 Ctrl-D is appended to all jobs. This will affect if a blank page is
81 output. 
83 - you get raw postscript instead of nice graphics on the output. Fix
84 this either by using a "print command" that cleans up the file before
85 sending it to lpr or by using the "postscript" option in smb.conf.
87 Note that you can do some pretty magic things by using your
88 imagination with the "print command" option and some shell
89 scripts. Doing print accounting is easy by passing the %U option to a
90 print command shell script. You could even make the print command
91 detect the type of output and its size and send it to an appropriate
92 printer. 
94 If the above debug tips don't help, then maybe you need to bring in
95 the bug gun, system tracing. See Tracing.txt in this directory.