src/main.c

Mon, 03 Aug 2009 14:09:20 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Mon, 03 Aug 2009 14:09:20 +0100
changeset 5
1204ebf9340d
parent 3
4aec27d9d4da
child 8
a2989aa17d21
permissions
-rw-r--r--

added P-touch decoder source

philpem@3 1 /**************************
philpem@3 2 * P-Touch PT-2450DX printer driver
philpem@3 3 *
philpem@3 4 * P. Pemberton, 2009
philpem@3 5 *
philpem@3 6 * Specs:
philpem@3 7 * Printer head is 128 dots, 180dpi, for a total print area of ~18mm vertical
philpem@3 8 * by however long your TZ label tape is.
philpem@3 9 * Printhead size is (128/180)=0.711[.] inches, or 18.0622[.] mm
philpem@3 10 * Each dot is (18.062/128) = 0.1411[.] mm
philpem@3 11 * Printable area is (numdots * 0.1411) mm
philpem@3 12 *
philpem@3 13 * Tape width Margins Printable area
philpem@3 14 * mm dots mm dots mm dots
philpem@3 15 * 6mm 42 1.0mm 7 4mm 28
philpem@3 16 * 9mm 63 1.0mm 7 7mm 49
philpem@3 17 * 12mm 85 2.0mm 14 8mm 57
philpem@3 18 * 18mm 127 3.0mm 21 12mm 85
philpem@3 19 * 24mm 170 3.0mm 128 18mm 128 ***
philpem@3 20 *
philpem@3 21 * 24mm is slightly odd. Because the printhead is only 128 dots (18mm), the
philpem@3 22 * margins are enforced by this, and not the driver software. It is impossible
philpem@3 23 * to print right to the edge of a 24mm label in a PT-2450DX.
philpem@3 24 *
philpem@3 25 **************************/
philpem@3 26
philpem@0 27 #include <stdio.h>
philpem@0 28 #include <stdlib.h>
philpem@3 29 #include "ptouch.h"
philpem@3 30 #include "pt_image.h"
philpem@0 31
philpem@3 32 /****************************************************************************/
philpem@0 33
philpem@0 34 int main(int argc, char **argv)
philpem@0 35 {
philpem@3 36 pt_Device *dev;
philpem@3 37
philpem@3 38 pt_Image *im;
philpem@3 39
philpem@3 40 printf("create image\n");
philpem@3 41 im = ptimage_Create(123, 456);
philpem@3 42
philpem@3 43 printf("delete image\n");
philpem@3 44 ptimage_Free(im);
philpem@3 45
philpem@3 46 return 0;
philpem@0 47
philpem@0 48 // check command line args
philpem@0 49 if (argc < 2) {
philpem@0 50 printf("ERROR: must specify device name\n");
philpem@0 51 return -1;
philpem@0 52 }
philpem@0 53
philpem@3 54 // Open and initialise the printer
philpem@3 55 dev = pt_Initialise(argv[1]);
philpem@3 56
philpem@3 57 if (dev == NULL) {
philpem@3 58 printf("Error opening printer device.\n");
philpem@0 59 return -1;
philpem@0 60 }
philpem@0 61
philpem@3 62 // Close the printer device
philpem@3 63 pt_Close(dev);
philpem@0 64
philpem@0 65 return 0;
philpem@0 66 }