README

Wed, 05 Aug 2009 17:10:56 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Wed, 05 Aug 2009 17:10:56 +0100
changeset 17
cf9d239ac1c9
child 18
fd1c6f6066da
permissions
-rw-r--r--

add README

philpem@17 1 libptouch: Linux printer driver library for P-Touch label printers
philpem@17 2 (C) 2009 Philip Pemberton <philpem@philpem.me.uk>.
philpem@17 3
philpem@17 4
philpem@17 5
philpem@17 6 Table of Contents
philpem@17 7 =================
philpem@17 8 1. What is libptouch?
philpem@17 9 2. Supported printers
philpem@17 10 3. Building and Using libptouch
philpem@17 11 T. TODO, aka Things That Don't Work Yet.
philpem@17 12 R. References
philpem@17 13
philpem@17 14
philpem@17 15 1. What is libptouch?
philpem@17 16 =====================
philpem@17 17 libptouch is a library that allows a user-mode application to print labels
philpem@17 18 using a Brother P-touch series label printer. The goal of the libptouch
philpem@17 19 project is to create a driver that will allow any Linux application to
philpem@17 20 print to a P-touch printer, using a common raster image as a source.
philpem@17 21
philpem@17 22 Brother only release official Linux drivers for a small number of P-touch
philpem@17 23 printers, and these all rely on the CUPS printing system to function (not to
philpem@17 24 mention the fact that the print filter is completely closed-source). On top
philpem@17 25 of the added complexity of having to feed data through CUPS or LPR, the print
philpem@17 26 quality was actually pretty poor -- the fonts were covered in jagged edges,
philpem@17 27 and printed barcodes looked like they'd been fed through a blender (needless
philpem@17 28 to say my PSC 5281 scanner wouldn't read them).
philpem@17 29
philpem@17 30 As a result of this, I started working on a library that could take a number
philpem@17 31 of Libgd images, and feed them to the P-touch in sequence. On top of that, I
philpem@17 32 wanted to be able to set printing parameters (that is, turn the auto-cutter
philpem@17 33 and mirroring options on and off) without having to butcher command lines
philpem@17 34 and drop to a shell. Finally, I wanted to be able to run my applications as a
philpem@17 35 (relatively) unprivileged user -- the printing apps should not need to be
philpem@17 36 'setuid root'.
philpem@17 37
philpem@17 38 So I set to work finding out all I could about the P-touch protocol. It turns
philpem@17 39 out that the standard mode for my PT-2450DX printer was the so-called "PT-CBP"
philpem@17 40 mode, and that documentation for this printing protocol had been released for
philpem@17 41 another printer in the P-touch series, the PT-9500PC[1]. Using the protocol
philpem@17 42 details in the PT-9500PC documentation, and after many long nights of coding,
philpem@17 43 lots of cups of tea and much wasted label tape, I created a library that would
philpem@17 44 eventually be released as libptouch.
philpem@17 45
philpem@17 46
philpem@17 47 2. Supported printers
philpem@17 48 =====================
philpem@17 49
philpem@17 50 NOTE: If you don't see your printer on this list, ask me about adding it.
philpem@17 51
philpem@17 52 +--------------+--------------------------------------------------------------+
philpem@17 53 | Printer | Features |
philpem@17 54 | Model +----+----+----------------------------------------------------+
philpem@17 55 | Number | S | AC | HC | PHW | DPI | MTH | MPH | |
philpem@17 56 +--------------+----+----+----+-----+-----+------+------+---------------------+
philpem@17 57 | PT-2450DX | Y | Y | | 128 | 180 | 24mm | 18mm | |
philpem@17 58 +--------------+----+----+----+-----+-----+-----------------------------------+
philpem@17 59
philpem@17 60 S = Supported/Tested
philpem@17 61 Y = Fully working
philpem@17 62 P = Partially working
philpem@17 63 ? = Not tested
philpem@17 64 AC = Auto Cutter
philpem@17 65 HC = Half Cut
philpem@17 66 MI = Mirror
philpem@17 67 PHW = Printhead width (pixels)
philpem@17 68 DPI = Dots per inch
philpem@17 69 MTH = Max label tape height (mm)
philpem@17 70 MPH = Max printing height (mm)
philpem@17 71
philpem@17 72 "Y" = Yes
philpem@17 73 " " = No
philpem@17 74
philpem@17 75
philpem@17 76 3. Building and Using libptouch
philpem@17 77 ===============================
philpem@17 78 To build libptouch, you will need:
philpem@17 79 GNU gcc version 3.1 or later (libptouch is tested with gcc 4.3.3)
philpem@17 80 GNU make version 3.80 or later (libptouch is tested with make 3.81)
philpem@17 81 libgd version 2.0 or higher (libptouch is tested with libgd 2.0.36)
philpem@17 82
philpem@17 83 Briefly, this means any common Linux distribution (Debian or RedHat based)
philpem@17 84 released in 2006 or later should successfully build libptouch. As for other
philpem@17 85 Unices, or older versions of Linux.... you're on your own.
philpem@17 86
philpem@17 87 On Ubuntu or Debian, the following command will install all the packages
philpem@17 88 necessary to build libptouch:
philpem@17 89 $ sudo apt-get install build-essential libgd2-xpm-dev
philpem@17 90
philpem@17 91 Once you have installed the necessary tools and libraries, you can compile
philpem@17 92 libptouch by using the following command:
philpem@17 93 $ tar -zxf libptouch-$VERSION.tgz
philpem@17 94 $ cd libptouch-$VERSION
philpem@17 95 $ make
philpem@17 96
philpem@17 97 This will build the libptouch library and documentation from the source code.
philpem@17 98
philpem@17 99
philpem@17 100 T. TODO, aka Things That Don't Work Yet.
philpem@17 101 ========================================
philpem@17 102 * Printers with printheads that don't have 128 dots will not work. This
philpem@17 103 basically means you can't use any printer whose maximum label tape width
philpem@17 104 is less than 24mm.
philpem@17 105
philpem@17 106 * I'd like to implement graphics inversion. Basically, where there is white,
philpem@17 107 the printer will print black. This could be useful for printing
philpem@17 108 white-on-black labels when you're out of white-on-black tape, or vice versa
philpem@17 109 :)
philpem@17 110
philpem@17 111 * There is no support for serial port printers. At all.
philpem@17 112
philpem@17 113 * The PT-PC is not, and will likely never be supported, as it uses a
philpem@17 114 different printing protocol and can only print bit image graphics on the
philpem@17 115 central 3.5mm (!) of the label tape.
philpem@17 116
philpem@17 117 * The QL-series label printers aren't supported either. I'd love to add
philpem@17 118 support for them, but I don't have a QL-series printer to play with. The
philpem@17 119 same applies to the rest of the P-touch (PT-series) printers that aren't
philpem@17 120 listed as "Supported" in the list above.
philpem@17 121
philpem@17 122 * Data compression. The later PT-series printers support "Packbits"
philpem@17 123 compression of each print line. At the moment, this isn't implemented.
philpem@17 124 Instead, a "COPY N BYTES" compression control byte is sent, followed by
philpem@17 125 a line of print data. Rinse, repeat.
philpem@17 126
philpem@17 127 * No option to set the feed amount. I'm not even 100% sure if this works
philpem@17 128 on most PT-series printers, but it might be worth implementing. See
philpem@17 129 <http://www.undocprint.org/formats/page_description_languages/brother_p-touch>.
philpem@17 130
philpem@17 131
philpem@17 132 R. References
philpem@17 133 =============
philpem@17 134 1. Brother Industries, Ltd. "PT-9500PC Command Reference, CBP-RASTER Mode
philpem@17 135 (PTCBP Mode) Volume" August 29, 2003, version 1.0.
philpem@17 136 Available online: http://etc.nkadesign.com/Printers/QL550LabelPrinter
philpem@17 137