@wblock, your code works perfectly well, thanks a lot
. And duplex printing in this case is resolved the same way: using the filter mentioned in [post=225850]#15[/post] before piping it to your
gs command line and then to
smbclient.
OK, here's my full setup for my PCL6 (non-PostScript) printer connected to a MS Windows Vista machine.
/etc/printcap:
Code:
lp|samsung|Samsung ML-2950 Samba printer:\
:lp=/dev/null:\
:if=/usr/local/libexec/samba-if:\
:sd=/var/spool/output/lpd:\
:lf=/var/log/lpd-errs:\
:sh:mx#0:
lp-duplex|samsung-duplex|Samsung ML-2950 Samba duplex:\
:lp=/dev/null:\
:if=/usr/local/libexec/if-duplex:\
:sd=/var/spool/output/lpd-duplex:\
:lf=/var/log/lpd-errs:\
:sh:mx#0:
lpd startup script kept complaining until I added a separate spool for the second printer (logical).
chkprintcap proved to be helpful.
Now here are the filters used.
samba-if for non-duplex printing:
Code:
#!/bin/sh
gs -dSAFER -dNOPAUSE -q -sDEVICE=pxlmono -sOutputFile=- - \
| smbclient "//VLAD/Samsung_ML-2950" -c "print -" -N && exit 0
and
if-duplex for duplex:
Code:
#!/bin/sh
my_code=" << /Duplex true /Tumble false >> setpagedevice"
sed -e '/LanguageLevel/a\
%%Requirements: duplex
' -e '/EndProlog/a\
%%BeginSetup \
'"$my_code"' \
%%EndSetup
' | gs -dSAFER -dNOPAUSE -q -sDEVICE=pxlmono -sOutputFile=- - \
| smbclient "//VLAD/Samsung_ML-2950" -c "print -" -N && exit 0
In this example the needed string is saved into
$my_code variable, so
that some more page-processing code can be added. As I read in
Adobe documentation, there is some "device setup for a particular printer and document" that goes into
%%Requirements: ... and
%%BeginSetup...%%EndSetup sections...
CONCLUSION.Don't mind if you add this example to your
lpd printing article, if you wish. I really couldn't find
any documentation on this particular setup, duplex & smb printing. The documentation mentions "filters" yet gives few examples, so people like myself
don't quite get it don't feel very sure about how to write them...
lp=/dev/null
setting in
/etc/printcap is also quite logical, but not obvious.
So, because of lack of documentation many think that BSD
lpd is all but dead. From this little experience, however, I understood that CUPS and
foomatic are doing more or less the same thing as
lpd + filters, only the latter using much less code.
And this is more instructive, too
.
So, thank you everyone for your kind assistance.