[Samba] Errors printing from Windows to a Samba server
Joseph E. Vornehm, Jr.
jvornehm at hotmail.com
Sat Dec 13 07:03:53 GMT 2003
I've noticed several users on various mailing lists that have had trouble
printing from Windows to a Samba server. I've stumbled onto a fix for my
particular situation, and I thought I would post it for the benefit of
others. It turns out to be a CUPS/Windows interaction issue and not a Samba
problem, but the symptoms tend to point to Samba as the culprit. (I've
posted similar information to the CUPS mailing list.)
Here is the short short version: I have a HP DeskJet 880C. The Windows
880C print drivers prepend about 2200 null characters to the print stream.
The CUPS file mime.types needs a longer limit in some of its contains()
expressions to deal with that fact.
Here are the symptoms: Samba disk shares seem to work fine; viewing the
print queue from Windows may or may not work; running lpr on the Samba
server works fine; printing from Windows to the server produces no errors
but no output. In my case, the Samba server is a Linux machine running
CUPS, and the printer is a HP DeskJet 880C.
Here is the actual problem: It turns out that the Windows print drivers for
the 880C (or the drivers I have, anyway) prepend about 2200 null characters
to the data stream sent to the printer. This causes CUPS to fail to
interpret the "document type" of the data it's receiving. If you print to a
file on the Windows machine (using the 880C drivers and not something like a
generic PostScript driver), transfer the file to the Samba machine, and lpr
it there, lpr comes back with this (CUPS) error:
lpr: unable to print file: client-error-document-format-not-supported
Here is the solution: Log into the Samba server as root. Edit
/etc/cups/mime.types (or similar) using a reliable text editor. Find the
"application/vnd.cups-raw" entry. In my case, it looks like this:
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
string(0,<1B>@) \
(contains(0,128,<1B>%-12345X) + \
(contains(0,1024,"LANGUAGE=PCL") \
contains(0,1024,"LANGUAGE = PCL")))
In the contains() expressions, I changed the 128 and 1024 to 4096. (I
suppose you could make arguments about this hurting print server performance
for high-volume servers, etc., but this works for me.) Here is the changed
section in my mime.types:
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
string(0,<1B>@) \
(contains(0,4096,<1B>%-12345X) + \
(contains(0,4096,"LANGUAGE=PCL") \
contains(0,4096,"LANGUAGE = PCL")))
As far as not being able to see the print queue from Windows, I've seen
several posts about adding "use client driver = yes" to the printer section
of smb.conf to avoid "Access denied, unable to connect" errors. It works
for me, anyway. Here's one such post:
http://www.linux.ie/pipermail/ilug/2003-October/007373.html
Anyway, I hope this information helps. Please CC me on any replies, as I'm
not subscribed to the list.
Joe Vornehm
More information about the samba
mailing list