pbm2lwxl-0/ 0000755 0000000 0000000 00000000000 10714063502 0012756 5 ustar 00root root 0000000 0000000 pbm2lwxl-0/Makefile 0000644 0000000 0000000 00000001344 10714063502 0014420 0 ustar 00root root 0000000 0000000 CC=gcc CFLAGS=-g INSTALL_DIR=/usr/local/bin/ default: all all: pbm2lwxl pbm2lwxl: pbm2lwxl.c $(CC) $(CFLAGS) -o pbm2lwxl pbm2lwxl.c tarball: download_html pbm2lwxl.tar.gz pbm2lwxl.tar.gz: Makefile pbm2lwxl.c license.html index.html README ps2lwxl txt2lwxl small2lwxl tar zcvf pbm2lwxl.tar.gz Makefile pbm2lwxl.c license.html index.html README ps2lwxl txt2lwxl small2lwxl upload: pbm2lwxl.tar.gz scp pbm2lwxl.tar.gz whitis@guestweb.dbd.com:public_html/software/pbm2lwxl/ download_html: lynx --source http://www.freelabs.com/~whitis/software/license.html >license.html lynx --source http://www.freelabs.com/~whitis/software/pbm2lwxl/index.html >license.html install: cp pbm2lwxl ps2lwxl txt2lwxl small2lwxl $(INSTALL_DIR) pbm2lwxl-0/README 0000644 0000000 0000000 00000000176 10714063502 0013642 0 ustar 00root root 0000000 0000000 read index.html and license.html. Tux images curtosy of Larry Ewing and/or Neal Tucker http://www.isc.tamu.edu/~lewing/linux/ pbm2lwxl-0/index.html 0000644 0000000 0000000 00000020670 10714063502 0014760 0 ustar 00root root 0000000 0000000
Writing a PBM filter is an appropriate way to write a printer driver for a simple raster based printer.
Many idiotic companies only write windows drivers for their printers and then their products only work with microsoft windows, and often not even will all versions of windows. Write a PBM or ghostscript driver and your product will work with MS-DOS, Windows 3.1, Windows 95, Windows 98, Windows NT, MacOS, OS/2, Linux, FreeBSD, NetBSD, OpenBSD, 4.3BSD, Solaris, Sunos, AIX, HPUX, Irix, Digital Unix, SCO Unix, Ultrix, VMS, NeXTstep, Amiga, Plan 9, SMS/QDOS.
CoStar | LabelWriter II | 9600 | 192 | Should work | |
CoStar | LabelWriter XL+ | 19200 | 448 | Should work | |
CoStar | EL40 | ? | 192? 1-1/2" wide | Should work | |
CoStar | EL60 | ? | 448? 2-1/4" wide | Should work | |
CoStar | Turbo | ? | 448? 2-1/4" wide | Should work | |
Avery | Personal Label Printer | 19200 | 192 | Tested - Ok | |
Avery | Personal Label Printer+??? | 19200 | 448 | Should work | |
Sieko | any | n/a | n/a | Should NOT work. | See below |
Sony | any | n/a | n/a | Unknown | See below |
mpage -1 -o -m720t0lrb -L6 - ascii to postscript ghostscript -sDEVICE=pbm -sOutputFile=- -q -dNOPAUSE -r192x192 -g700x192 -dSAFER - -c quit pnmflip -cw - to rotate 90 degrees pnmnoraw - convert from raw to plain (ascii) pnm format.Note that the ghostscript command shown above generates 700x192 which should be pnmflip'ed to get 192x700 for printing. Change "-L6" to "-L12" on the mpage command to fit more lines on a label.
This program does not use libpnm. No particular reason. It was just faster to write code which read a plain pbm file than to figure out how to use libpnm and if its licensing was acceptable. libpnm is more flexible but we really don't need that flexibility here.
This file is maintained by Mark Whitis (whitis@dbd.com).
pbm2lwxl-0/license.html 0000644 0000000 0000000 00000076017 10714063502 0015301 0 ustar 00root root 0000000 0000000Mark Whitis's Website | Home Page | Linux | Book: Linux Programming Unleashed | My Resume | Genealogical Data | Contact Info | Security | About |
Writing a PBM filter is an appropriate way to write a printer driver for a simple raster based printer.
Many idiotic companies only write windows drivers for their printers and then their products only work with microsoft windows, and often not even will all versions of windows. Write a PBM or ghostscript driver and your product will work with MS-DOS, Windows 3.1, Windows 95, Windows 98, Windows NT, MacOS, OS/2, Linux, FreeBSD, NetBSD, OpenBSD, 4.3BSD, Solaris, Sunos, AIX, HPUX, Irix, Digital Unix, SCO Unix, Ultrix, VMS, NeXTstep, Amiga, Plan 9, SMS/QDOS.
CoStar | LabelWriter II | 9600 | 192?/128? | Should work | |
CoStar | LabelWriter XL | 19200 | 192 | Tested - works | |
CoStar | LabelWriter XL+ | 19200 | 448 | Should work | |
CoStar | EL40 | 19200 | 192 1-1/2" wide | Tested. Works. | |
CoStar | EL60 | 19200 | 448 2-1/4" wide | Tested. Works. | |
CoStar | Turbo | 115200 | 448 2-1/4" wide | Tested, works | |
CoStar | SE250 | 115,200 | 448 | Should work | |
CoStar | SE250+ | ? | 448? | Should work | 115.2Kbps |
CoStar | ASCII | ? | 192? | Should work | 115.2Kbps |
CoStar | ASCII+ | ? | 448 | Should work | 115.2Kbps |
Avery | Personal Label Printer | 9600 | 128 | Tested - lower resolution | approx 128x128 dpi |
Avery | Personal Label Printer+??? | 19200 | 448 | Should work | |
Sieko | any | n/a | n/a | Should NOT work. | See below |
Sony | any | n/a | n/a | Unknown | See below |
CoStar | LW300 | 115200 | 300? 1-1/2" wide | Not tested. Will Propably work. | Has Serial and USB |
CoStar | LW330 | 115200 | 700? 2-1/4" wide | Not Tested. Will probably work. | Has Serial and USB |
CoStar | LW330 Turbo | 115200? | 700? 2-1/4" wide | Not tested. Will probably work. | Has serial and USB. |
These printers do not autobaud; use only the single baud rate supported by the printer. Use the correct label width or you probably won't like the results.
In the commands below, /dist
is the directory on your
system where you download distribution files prior to installation.
Substitute a suitable directory on your system or make /dist
a symbolic link to a directory created for the purpose on a disk partition
with sufficient free space.
cd /dist wget http://www.freelabs.com/~whitis/software/pbm2lwxl/pbm2lwxl.tar.gz cd /usr/local/src mkdir pbm2lwxl cd pbm2lwxl tar zxvf /dist/pbm21wxl.tar.gz make make install
"make install" does not make any attempt to integrate with the printing system on your system.
The labelwriter XL uses 19200. Older models use 9600 The printer uses xon/xoff - configure spooler appropriately or use something like: "stty 19200 ixon -onlcr usage: pbm2lwxl [ width [height] ] For example: # Make sure you specify the correct baud rate for your printer model stty 19200 ixon -onlcr /dev/cua1 width and height are in pixels. width should be 192 (1") or 448 (wide models). You can redirect the output directly to the serial port the printer is attached assuming you don't already have a spooler running on that port and you have already set the baud rate and XON/XOFF flow controls.
Obviously, you need to redirect a PBM file into the standard input of the program.
The script "ps2lwxl" takes a postscript file on standard input and outputs commands to a lwxl. You will need to edit it with the appropriate parameters for your printer/system.
# Make sure you specify the correct baud rate for your printer model stty 19200 ixon -onlcr /dev/cua1As supplied, the script performs rotation of the image using pnmflip. Unfortunately, that does not allow more than one "page" (label) to be printed at a time. A better approach is to remove the pnmflip and do the rotation in postscript by configuring your application program appropriately, or by using the landscap.ps file or incorporating it into the ps2lwxl script (put the full pathname before the " - " in the ghostscript command.
cat /usr/share/ghostscript/5.50/landscap.ps myfile.ps | ps2lwxl >/dev/cua1
mpage -1 -o -m720t0lrb -L6 - ascii to postscript ghostscript -sDEVICE=pbm -sOutputFile=- -q -dNOPAUSE -r192x192 -g700x192 -dSAFER - -c quit pnmflip -cw - to rotate 90 degrees pnmnoraw - convert from raw to plain (ascii) pnm format.Note that the ghostscript command shown above generates 700x192 which should be pnmflip'ed to get 192x700 for printing. Change "-L6" to "-L12" on the mpage command to fit more lines on a label.
This program does not use libpnm. No particular reason. It was just faster to write code which read a plain pbm file than to figure out how to use libpnm and if its licensing was acceptable. libpnm is more flexible but we really don't need that flexibility here.
Apparently, lpd recognizes XON/XOFF on serial ports. This is good since there does not appear to be a way to configure that (the fs printcap directive seems inadequate). So, here is a sample configuration for text.
label0:\ :sd=/var/spool/lpd/label0:\ :mx#0:\ :sh:\ :lp=/dev/cua19:\ :if=/usr/local/bin/txt2lwxl:\ :br#9600:
The Avery Personal label printer prints at 1" per second, according to the meager specifications.
Chip: (Motorola logo) SC408056FN 600100-030 COSTAR REV D 2C83JQQKV9152 (Probably a mask programmed 68HC11 processor) Chip: 74HC04N Chip: 75HC423N Chip: 2x (ST logo) PBL3717A 89134C Chip: Max232N Chip: 2xUA7805C Chip: P8P10 (T0-220) Marking: ASSY PART NO: 60100-032 Marking: COSTAR CORP 400032 REV D
One of the most common problems you will have with these label printers is that a postscript page is laid out so that the text prints at the top of a normal 8-1/2x11 page and the area which is rendered into the bitmap is a small rectangle in the lower left corner. Even if you only print 6 lines on the page, they will typically be at the top. The lower left hand corner is used as an origin (this makes better mathematical sense but printers and monitors work the other way) rather than the top left which causes unexpected things to happen when printing other paper sizes. This is why the funny margin options are used with mpage above.
It might be helpful to define new paper sizes in gs_stad.ps. mpage would probably need to be updated. mpage would benifit from a page definition database which specified where each little page went on the page. This would be useful for all sorts of laser and inkjet printer labels.
pnmcrop is handy with pnmtext to trim the excessive border produced by pnmtext.
Look at the script "fontdemo" for a sample of receipt style printing.
EIMINC can make custom labels specifically for barcoding; they claim these labels are more durable and are IR scanable. They also sell tamper evident labels but I don't think they work in thermal label printers.
grabfont
),
a demonstration of how to use them in receipt printing mode
(fontdemo
) are included.
Not worth the trouble fixing the printtool. Just create the queue entry in /etc/printcap and input filter manually and keep a backoup copy of printcap incase printtool clobbers it.
It would involve a bit of work to extend the redhat printtool/printfilters to handle label printers.
The redhat print tool needs to be extended to understand the concept of one or more postprocessors after ghostscript. Additional fields should be added to their printer database /usr/lib/rhs/rhs-printfilters/printerdb. Printfilters should be added to convert ps-to-pbm and then pbm-to-printer.
redhat does understand the idea of a final filter that actually sends the data directly to the printer (smbprint), etc. although that is all hard coded into the main filter script.
The redhat print filters also seem to have a problem in that if they are starting from ascii they will apparently invoke asc-to-printer; it is not a valid assumption these days that the printer can handle ascii. They seem to make the mistake in assuming that any of the *-to-printer.fpi filters can actually be used. It bypasses its own "DESIRED_TO" format.
### ### dymo label printer ### wget ftp://speakeasy.rpmfind.net/linux/redhat/7.1/en/os/i386/SRPMS//printconf-0.2.12-1.src.rpm rpm -i printconf-0.2.12-1.src.rpm rpm -ba /usr/src/redhat/SPECS/printconf.spec cd /usr/src/redhat/BUILD/printconf-0.2.12/src echo pbm2lwxl >>redhat_gs_driver_list python util/build_striped_printer_db.py foomatic/data japanese printer_db.pickle redhat_gs_driver_list patch printconf-gui <<\...EOF... --- printconf-gui.orig Wed Mar 28 11:51:22 2001 +++ printconf-gui Wed Jul 18 03:22:20 2001 @@ -278,6 +278,12 @@ # This being a printing system, it's probably a good idea to go and see if there are any printers attached locally. # There are much more intelligent approaches to this problem, but the rest of the system isn't sophisticated enough # to care yet, so simply scaning likely devices to see if they can be opened for writing is sufficient. + +# Added serial ports which are needed to support Avery, Dymo, and Costar +# label printers, among others. And yes, we definitely need more than +# for serial ports here. My label printers are attached to +# a byterunner 8 port board with ports from ttyS16-ttyS23 +# - Mark Whitis <whitis@freelabs.com> local_printers = [] for devlpx in [ '/dev/lp0', '/dev/lp1', @@ -286,7 +292,40 @@ '/dev/usb/lp0', '/dev/usb/lp1', '/dev/usb/lp2', - '/dev/usb/lp3']: + '/dev/usb/lp3', + '/dev/ttyS0', + '/dev/ttyS1', + '/dev/ttyS2', + '/dev/ttyS3', + '/dev/ttyS4', + '/dev/ttyS5', + '/dev/ttyS6', + '/dev/ttyS7', + '/dev/ttyS8', + '/dev/ttyS9', + '/dev/ttyS10', + '/dev/ttyS11', + '/dev/ttyS12', + '/dev/ttyS13', + '/dev/ttyS14', + '/dev/ttyS15', + '/dev/ttyS16', + '/dev/ttyS17', + '/dev/ttyS18', + '/dev/ttyS19', + '/dev/ttyS20', + '/dev/ttyS21', + '/dev/ttyS22', + '/dev/ttyS23', + '/dev/ttyS24', + '/dev/ttyS25', + '/dev/ttyS26', + '/dev/ttyS27', + '/dev/ttyS28', + '/dev/ttyS29', + '/dev/ttyS30', + '/dev/ttyS31' + ]: try: os.close (os.open (devlpx, os.O_WRONLY | os.O_NONBLOCK)) local_printers.append({'device':devlpx}) ...EOF... # chown lp /dev/ttyS16 # buggy cp, can't overide -i with -f yes | cp printer_db.pickle /usr/share/printconf/printer_db.pickle yes | cp printconf-gui /usr/sbin/printconf-gui printconf-gui & # Interactive, GUI # after configuring printer in printconf-gui, add :br#19200: in /etc/printcap # (which will unfortunately be erased next time printconf-gui runs) emacs /var/spool/lpd/lbltst/pbm2lwxl-126082.foo # change # "| pnmflip -cw | pnmnoraw | pbm2lwxl" # to # "| pbm2lwxl 448 1500" # which defines a lable size of 2.125x8" (the length will be truncated # based on how many lines ghostscript outputs) # note this will give non-rotated output. If you want rotated output # you will need to reverse the width and height in all label # size definitions, put the pnmflip and pnmnoraw commands back, and # remember to add the options to pbm2lwxl. Better yet, figure out # how to get portrait/landscape printing options to ghostscript # once it is working, you may want to move from /etc/printcap # to /etc/printcap.local so printconf won't hurt it.
If XON/XOFF flow control is not working, garbage may be printed.
If you have any funny settings for xterm in your xdefaults, this will affect grabfont.
DO NOT send me requests for assistance with any version of microsoft windows, with the possible exception of serious porting efforts. Dymo no longer supports the older printer models. If you are looking for a windows driver, look here or do an intelligent search on google. Remember to run a virus checker. If you have programming experience, you can try porting this driver or using dymo-costars windows SDK. But don't bother me me windows end user questions.
This program should port easily to DOS or the dos box on windows. The challange is how to get the output of this program to a serial port. On a pure dos box, you may need a library which supports interrupt driven I/O although simple redirection of standard output to COM1: may work (with appropriate MODE settings for buad rate, no translation, and XON/XOFF) since the data flow is output only except for XON/XOFF. On a dos window in windows, this may already be handled for you by windows if you open COMx:. Don't forget to enable XON/XOFF and disable any translation.
Have I made it perfectly clear that I do not provide tech support for windoze users?
This file is maintained by Mark Whitis (whitis@freelabs.com).
All email messages received must pass the turing test or they will be considered SPAM. If it could have been written by a machine, it was.
Under no circumstances are you to email me with questions regarding windoze, any other microsoft operating system or application, or any software which runs under any form of windoze.
Use the search form at the left to search this site, including Free Electron Lab's, Mark's personal pages, Mark's Linux Pages, and Mark's Genealogy pages. |
Mark Whitis's Website | Home Page | Linux | Book: Linux Programming Unleashed | My Resume | Genealogical Data | Contact Info | Security | About |