In my previous post I described how I hooked up my printer and scanner to my D-Link DNS-323 NAS device for network printer and scanner services. With that done, I wanted to be able to make photocopies without an extra PC turned on. Should be a piece of cake, right? Scan an image, print it, what can be so hard about that? … famous last words of an IT professional. Of course, I also wanted this to happen on the push of one of the front panel buttons of my scanner.
So, first you need to be able to print locally from the DNS-323 as opposed to a PC queueing a print job on the DNS-323. A quick test: ssh as root to the box,
lp /etc/passwd, does not work, perfect! Printing on the same printer always worked like a charm with CUPS on my ubuntu machines, so off we go and install cups from the optware repository. Try adding a printer definition to cups, but where is my USB printer? Digging really deep inside cups tells me the usb backend detects the printer perfectly well, but cups-deviced does not, nor does
lpinfo -v list it, marf. More research yields, I will need a driver for the Samsung proprietary printer language SPL2 or QPDL, anyway. So, back to square one and take a look at splix and, because I can’t get cups to work, at foomatic-rip.
I installed perl and ghostscript to get foomatic-rip to work and compiled splix for optware. Tested the two in conjunction and, of course, it did not work. The ghostscript version available from optware claims to provide the cups device but I couldn’t get output that splix could process. No big deal, because splix still has the pbm support (apparently from older versions) which I reactivated. So, instead of relying on foomatic-rip to convert an input format to cups raster format and then on splix’s rastertospl2 to convert that to something understandable by the printer, I turned to pbm as an intermediate format. You can download the optware ipkg here. If you want to compile it yourself you can download the source package definition here, until I submit it to optware. This package, of course, preserves the now standard rastertospl2 in addition to pbmtospl2.
Now, you don’t even need foomatic-rip but can just do the following:
cat align.ps | gs -r300 -q -dNOPAUSE -dBATCH -dNOMEDIAATTRS -sDEVICE=pbmraw -sOutputFile=output.pbm -
/opt/lib/cups/filter/pbmtospl2 -P /opt/share/cups/model/samsung/ml2010de.ppd -p A4 output.pbm > output.spl2
Here, align.ps is the alignment testing document available from openprinting.org. Any other PostScript document will do, but be aware that the “gs” command can take quite a while (and we’ll have more of that in the next post of this series).