1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/README Wed Aug 05 17:10:56 2009 +0100 1.3 @@ -0,0 +1,137 @@ 1.4 +libptouch: Linux printer driver library for P-Touch label printers 1.5 +(C) 2009 Philip Pemberton <philpem@philpem.me.uk>. 1.6 + 1.7 + 1.8 + 1.9 +Table of Contents 1.10 +================= 1.11 + 1. What is libptouch? 1.12 + 2. Supported printers 1.13 + 3. Building and Using libptouch 1.14 + T. TODO, aka Things That Don't Work Yet. 1.15 + R. References 1.16 + 1.17 + 1.18 +1. What is libptouch? 1.19 +===================== 1.20 +libptouch is a library that allows a user-mode application to print labels 1.21 +using a Brother P-touch series label printer. The goal of the libptouch 1.22 +project is to create a driver that will allow any Linux application to 1.23 +print to a P-touch printer, using a common raster image as a source. 1.24 + 1.25 +Brother only release official Linux drivers for a small number of P-touch 1.26 +printers, and these all rely on the CUPS printing system to function (not to 1.27 +mention the fact that the print filter is completely closed-source). On top 1.28 +of the added complexity of having to feed data through CUPS or LPR, the print 1.29 +quality was actually pretty poor -- the fonts were covered in jagged edges, 1.30 +and printed barcodes looked like they'd been fed through a blender (needless 1.31 +to say my PSC 5281 scanner wouldn't read them). 1.32 + 1.33 +As a result of this, I started working on a library that could take a number 1.34 +of Libgd images, and feed them to the P-touch in sequence. On top of that, I 1.35 +wanted to be able to set printing parameters (that is, turn the auto-cutter 1.36 +and mirroring options on and off) without having to butcher command lines 1.37 +and drop to a shell. Finally, I wanted to be able to run my applications as a 1.38 +(relatively) unprivileged user -- the printing apps should not need to be 1.39 +'setuid root'. 1.40 + 1.41 +So I set to work finding out all I could about the P-touch protocol. It turns 1.42 +out that the standard mode for my PT-2450DX printer was the so-called "PT-CBP" 1.43 +mode, and that documentation for this printing protocol had been released for 1.44 +another printer in the P-touch series, the PT-9500PC[1]. Using the protocol 1.45 +details in the PT-9500PC documentation, and after many long nights of coding, 1.46 +lots of cups of tea and much wasted label tape, I created a library that would 1.47 +eventually be released as libptouch. 1.48 + 1.49 + 1.50 +2. Supported printers 1.51 +===================== 1.52 + 1.53 +NOTE: If you don't see your printer on this list, ask me about adding it. 1.54 + 1.55 ++--------------+--------------------------------------------------------------+ 1.56 +| Printer | Features | 1.57 +| Model +----+----+----------------------------------------------------+ 1.58 +| Number | S | AC | HC | PHW | DPI | MTH | MPH | | 1.59 ++--------------+----+----+----+-----+-----+------+------+---------------------+ 1.60 +| PT-2450DX | Y | Y | | 128 | 180 | 24mm | 18mm | | 1.61 ++--------------+----+----+----+-----+-----+-----------------------------------+ 1.62 + 1.63 +S = Supported/Tested 1.64 + Y = Fully working 1.65 + P = Partially working 1.66 + ? = Not tested 1.67 +AC = Auto Cutter 1.68 +HC = Half Cut 1.69 +MI = Mirror 1.70 +PHW = Printhead width (pixels) 1.71 +DPI = Dots per inch 1.72 +MTH = Max label tape height (mm) 1.73 +MPH = Max printing height (mm) 1.74 + 1.75 +"Y" = Yes 1.76 +" " = No 1.77 + 1.78 + 1.79 +3. Building and Using libptouch 1.80 +=============================== 1.81 +To build libptouch, you will need: 1.82 + GNU gcc version 3.1 or later (libptouch is tested with gcc 4.3.3) 1.83 + GNU make version 3.80 or later (libptouch is tested with make 3.81) 1.84 + libgd version 2.0 or higher (libptouch is tested with libgd 2.0.36) 1.85 + 1.86 +Briefly, this means any common Linux distribution (Debian or RedHat based) 1.87 +released in 2006 or later should successfully build libptouch. As for other 1.88 +Unices, or older versions of Linux.... you're on your own. 1.89 + 1.90 +On Ubuntu or Debian, the following command will install all the packages 1.91 +necessary to build libptouch: 1.92 + $ sudo apt-get install build-essential libgd2-xpm-dev 1.93 + 1.94 +Once you have installed the necessary tools and libraries, you can compile 1.95 +libptouch by using the following command: 1.96 + $ tar -zxf libptouch-$VERSION.tgz 1.97 + $ cd libptouch-$VERSION 1.98 + $ make 1.99 + 1.100 +This will build the libptouch library and documentation from the source code. 1.101 + 1.102 + 1.103 +T. TODO, aka Things That Don't Work Yet. 1.104 +======================================== 1.105 + * Printers with printheads that don't have 128 dots will not work. This 1.106 + basically means you can't use any printer whose maximum label tape width 1.107 + is less than 24mm. 1.108 + 1.109 + * I'd like to implement graphics inversion. Basically, where there is white, 1.110 + the printer will print black. This could be useful for printing 1.111 + white-on-black labels when you're out of white-on-black tape, or vice versa 1.112 + :) 1.113 + 1.114 + * There is no support for serial port printers. At all. 1.115 + 1.116 + * The PT-PC is not, and will likely never be supported, as it uses a 1.117 + different printing protocol and can only print bit image graphics on the 1.118 + central 3.5mm (!) of the label tape. 1.119 + 1.120 + * The QL-series label printers aren't supported either. I'd love to add 1.121 + support for them, but I don't have a QL-series printer to play with. The 1.122 + same applies to the rest of the P-touch (PT-series) printers that aren't 1.123 + listed as "Supported" in the list above. 1.124 + 1.125 + * Data compression. The later PT-series printers support "Packbits" 1.126 + compression of each print line. At the moment, this isn't implemented. 1.127 + Instead, a "COPY N BYTES" compression control byte is sent, followed by 1.128 + a line of print data. Rinse, repeat. 1.129 + 1.130 + * No option to set the feed amount. I'm not even 100% sure if this works 1.131 + on most PT-series printers, but it might be worth implementing. See 1.132 + <http://www.undocprint.org/formats/page_description_languages/brother_p-touch>. 1.133 + 1.134 + 1.135 +R. References 1.136 +============= 1.137 +1. Brother Industries, Ltd. "PT-9500PC Command Reference, CBP-RASTER Mode 1.138 + (PTCBP Mode) Volume" August 29, 2003, version 1.0. 1.139 + Available online: http://etc.nkadesign.com/Printers/QL550LabelPrinter 1.140 +