Codebase list pnm2ppa / 9491ae0
Imported Upstream version 1.04 Didier Raboud 12 years ago
99 changed file(s) with 19826 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 19991002 ajv created CVS repository
1 19991002 ajv Started work on debugging issues
2 19991003 ajv Moved main() to getopt for maintainability
3 19991003 ajv Added all the support files, and ported the
4 calibration suite
5 19991003 ajv Removed multiple target support, debugged other printers
6 Made recompilation to change things unnecessary
7 19991013 ajv Added internationalisation support
8 Added English man page
9 Reduced getopt() to *BSD friendly version
10 Fixed a bug that ajv found, and Giorgio fixed
11 Updated the usage to include build version and all
12 arguments
13 19991020 ajv Added back '-' and post-option file parsing
14 Added I18N stuff
15 Added "verbose" option to output to stderr
16 19991021 giorgio Added all of Giorgio's patches
17 Added X & Y offsets
18 19991021 ajv FreeBSD fixes in Makefile
19 Documentation update, including man page
20 19991105 ajv Documentation update
21 Dutch support - Jimmy Tak
22 "letter" added as valid paper size - Ionutz Borcoman
23 RedHat doco updated - Duncan Haldane
24 19991120 giorgio Much faster output
25 Much better printing in dark regions
26 compression reenabled for black mode
27 --eco mode
28 bug fixes
29 19991127 giorgio Changed back to standard Cartesian distance for colors
30 Gamma correction tool (see separate archive)
31 bug fixes in black printing
32 19991128 ajv re-merged with Giorgio's code base
33 All patches from 19991105 are back
34 updated shift sizes in pnm2ppa.conf
35 fixed permission problem with make install
36 fixed "verbose" and "dump" pnm2ppa.conf keywords
37 19991204 duncan "legal" (US Legal, 8.5in x 14in) added as a valid paper
38 size - Duncan Haldane <duncan_haldane@users.sourceforge.net>
39 20000113 ajv broke out image.c into several files in an attempt
40 to add pgm support without major breakage
41 20000114 ajv Finally fixed annoying memory bug. Both MAXLINES and
42 Max Buf Lines must agree.
43 20000120 klamer Patches to allow calibration to work again.
44 mancini BeOS support
45 duncan RedHat Print filters added to CVS tree
46 ajv Fixed -v and moved yet another global into a struct
47 20000306 duncan Lots of little fixes; --fd working right now;
48 bidirectional shearing adjustments added (user
49 configurable entries "blackshear" and colorshear"
50 in pnm2ppa.conf.
51 20000311 duncan added : -B n option and "blackness n" config file
52 entry to control black ink density (drops per
53 pixel n = 0,1,2,3,4 ) default is 2. Also there are
54 now config file entries blackshear and colorshear
55 for adjusting shearing in bidirectional printing.
56 Fixed various bugs that broke HP820/1000 printing.
57 20000318 duncan Color EcoMode printing now uses bidirectional
58 printsweeps (formerly only FastMode did this)
59 If gMaxPass = 1, you now get bidirectional sweeps
60 (in cut_im_color_swath() , cutswath.c)
61 20000326 duncan ** changes to dither.c:
62 on odd lines, black is
63 now processed (not color), even black pixels are
64 duplicated, so if either of two successive pixels are
65 black, they both are. Changes also fix Tim's report
66 about blurry black/white boundaries.
67 ** changes to image.c
68 If the odd line is not printed
69 (PixMap or EcoMode), image.c now stores the line, and
70 adds the black parts to the next even line.
71 This fixes a bug in where thin (one-pixel wide) black
72 lines (like enscript borders) could be lost because
73 black ink only printed every second pixel, and odd
74 black lines were just copies of the preceeding even
75 line which had been stored.
76 20000331 duncan added support for large papersizes 11x17 and a3
77 (for the 1000 series printers). Added a
78 printer-specific max_pagewidth so papersizes that
79 are too wide for a printer series will not print
80 on that printer.
81 20000402 duncan tweaked bidirectional sweep shearing correction.
82 (removed the +1 right-to-left black shift in
83 cut_im_black_swath() in cutswath.c ).
84 I am not sure if the shearing correction is
85 model or individual printer-specific. (I suspect
86 the second case, in which case it is a calibration
87 issue (The HP Win9x software seems to have calibration
88 adjustments for blackshear.) if any corrections
89 turn out to be generic to a given printer family,
90 (rather than specific to a particular printer)
91 the default can be changed in defaults.h (the
92 variables are:
93 printer->r2l_bw_offset (=blackshear)
94 printer->r2l_color_offset (=colorshear).
95 20000404 duncan added support for pbmraw and pgmraw formats.
96 all three pnmraw formats now work.
97 (changes in image.c, image.h )
98 20000405 duncan added support for pgm, ppm, pbm nonraw formats.
99 added papersize autoconfiguring from the pnm
100 header, so all ghostscript papersizes are now
101 supported (if the printer can accomodate them)
102 The -s option now only controls the gammafile
103 creation papersize. Made bidirectional
104 printing the default (but this can be configured
105 with a "unimode 1" in pnm2ppa.conf, or --uni,
106 --bi command line options.
107 20000408 duncan graceful termination of print run if pnm
108 input is truncated (i.e., if read_line()
109 encounters EOF). printer no longer hangs.
110 Moved text strings to lang.h/text-en.h
111 20000423 duncan clean up way things near sides of swath are
112 handled in cutswath.c
113 20000710 duncan in FS_Color_Dither(), use line[]= (1,1,1)
114 not (0,0,0) for black replacement of dark
115 pixels for which no color match is found.
116 (fixes flashing LED on certain images - those with
117 no black - with --eco on HP820)
118 (0,0,0) = black ink, (1,1,1) = gMaxPass drops of
119 each color.
120 20000928 duncan in cutswath.c, if the vertical position
121 of the black and color sweeps differed by 1 , 2 or 3
122 dots, HP820 got "flashing light syndrome".
123 Fixed by testing for this possibility, and
124 if found, by reducing numlines, and padding the top
125 of a swath with an (even) number of blank lines
126 to keep the height the same.
127 (Thanks to Steven Elliott <selliott4@austin.rr.com>
128 for reporting this bug, and testing the fix.
129 20001010 ajv made input of paths to gamma and config files secure
130 against buffer overruns.
131 duncan In -g mode, check that gamma.ppm is not a symbolic
132 link, and is a regular file, before writing to it
133 (but after opening it).
134
135 20001018 duncan clean up calibration program. now called
136 calibrate_ppa. It does most calibration now.
137
138 moved the job of writing gamma.ppm for color
139 calibration to a new utility calibrate_ppa.c.
140 pnm2ppa -g now just prints the corresponding
141 test page.
142
143 secured syslog messages. No user input is
144 sent to syslog. syslog messages are wrapped, and can
145 be suppressed with a new keyword "silent 1"
146 in /etc/pnm2ppa.conf (but not in subsequently-read
147 config files). all syslog activity now occurs
148 in syslog.c.
149 20001106 reduce memory footprint of calibrate_ppa
150 (it was 36MB!).
151 20001112 fix syslog silent/verbose usage; fix alignment
152 pattern bug in calibrate_ppa. repaired the HP820
153 fix that got broken when the vertical offset was
154 redefined by 600 dots...
155
156
157
158
159
160
161
162
0 English
1
2 You can find the build instructions in ./docs/en/INSTALL
3
4
0 #
1 # Makefile for pnm2ppa
2 #
3
4 INSTALLDIR=/usr/local/bin
5 CONFDIR=/etc
6 MANDIR=/usr/local/man/man1
7
8 CC=gcc
9 INSTALL=install
10
11 # production build
12 CFLAGS=-Wall -pedantic -O2 -g -DNDEBUG
13 LDFLAGS=-lm
14 OBJS = pnm2ppa.o syslog.o ppa.o image.o dither.o cutswath.o hash_ink.o gamma.o
15 SRC = pnm2ppa.c syslog.c ppa.c image.c dither.c cutswath.c hash_ink.c gamma.c
16
17 # production build (beos)
18 #CFLAGS=-Wall -pedantic -O2 -g -DNDEBUG -D__BEOS__
19 #OBJS = pnm2ppa.o syslog.o ppa.o image.o dither.o cutswath.o hash_ink.o gamma.o
20 #SRC = pnm2ppa.c syslog.c ppa.c image.c dither.c cutswath.c hash_ink.c gamma.c
21
22 # debug build
23 #CFLAGS=-Wall -pedantic -g -O2 -DDEBUG=1
24 #LDFLAGS=-lm
25 #-lefence
26 #DOBJS = pnm2ppa.o syslog.o ppa.o image.o cutswath.o debug.o dither.o gamma.o hash_ink.o
27 #OBJS = $(DOBJS)
28 #SRC = pnm2ppa.c syslog.c ppa.c image.c cutswath.c debug.c dither.c gamma.c hash_ink.c
29
30 # debug build (beos)
31 #CFLAGS=-Wall -pedantic -g -DDEBUG=1 -D__BEOS__
32 #OBJS = pnm2ppa.o ppa.o image.o cutswath.o debug.o dither.o hash_ink.o gamma.o syslog.o
33 #SRC = pnm2ppa.c ppa.c image.c cutswath.c debug.c dither.c hash_ink.c gamma.c syslog.c
34
35 # If you have FreeBSD, you need to uncomment the next LDFLAG.
36 # You may also need to install libgnugetopt from the ports collection.
37 # LDFLAGS+=-L/usr/local/lib -lgnugetopt
38
39 # Install under Linux and other versions with the -b (backup) option
40 INSTALL=install -b
41 INSTALLD=install -b -d
42
43 # INSTALL for FreeBSD (doesn't have the -b (backup) option)
44 # XXX FreeBSD users, please tell me what the flag for backup is!
45 #
46 # If you have FreeBSD, uncomment the next line
47 # INSTALL=install
48 # INSTALLD=install -d
49
50 # Language selection. Choose one only.
51
52 LANG=EN
53 #LANG=CZ
54 #LANG=ES
55 #LANG=FR
56 #LANG=IT
57 #LANG=NL
58
59 # Normal Users!
60 #
61 # Do not edit below this line! No user servicable parts below!
62
63 CFLAGS+=-DLANG_$(LANG)
64
65 default: all
66
67 profile:
68 make "CFLAGS=-Wall -pedantic -O2 -g -pg -DNDEBUG"
69
70 debug:
71 make "CFLAGS=-Wall -pedantic -g -O2 -DDEBUG=1 -DLANG_EN" "LDFLAGS=-lm -lefence" "OBJS=$(DOBJS)"
72
73 # the following have been left in for those with good memories
74
75 720: all
76 @@echo After running make install, edit /etc/pnm2ppa.conf and set your printer
77
78 820: all
79 @@echo After running make install, edit /etc/pnm2ppa.conf and set your printer
80
81 1000: all
82 @@echo After running make install, edit /etc/pnm2ppa.conf and set your printer
83
84 all: pnm2ppa calibrate_ppa
85
86 clean:
87 rm -f *.o *~ calibrate_ppa pnm2ppa make_hash_ink gmon.out hash_ink.c
88
89
90 install: pnm2ppa calibrate_ppa
91 $(INSTALL) -m 755 pnm2ppa $(INSTALLDIR)
92 $(INSTALLD) $(MANDIR)
93 $(INSTALL) -m 644 docs/en/pnm2ppa.1 $(MANDIR)
94 # development only - allows root to edit
95 $(INSTALL) -m 644 pnm2ppa.conf $(CONFDIR)
96 # calibration tool
97 $(INSTALL) -m 755 calibrate_ppa $(INSTALLDIR)
98 # final production - much tighter
99 # $(INSTALL) -m 444 pnm2ppa.conf $(CONFDIR)
100 @@echo
101 @@echo Now, edit /etc/pnm2ppa.conf to choose your printer
102
103 uninstall:
104 rm -f $(INSTALLDIR)/pnm2ppa
105 rm -f $(INSTALLDIR)/calibrate_ppa
106 rm -f $(MANDIR)/pnm2ppa.1
107 rm -f $(CONFDIR)/pnm2ppa.conf
108
109 pnm2ppa: $(OBJS)
110 $(CC) $(LDFLAGS) $(CFLAGS) -o pnm2ppa $(OBJS)
111
112 calibrate_ppa: calibrate_ppa.o pnmtools.o gamma.o
113 $(CC) $(LDFLAGS) $(CFLAGS) -o calibrate_ppa calibrate_ppa.o pnmtools.o gamma.o
114
115 calibrate_ppa.o: calibrate_ppa.c global.h image.h defaults.h pnmtools.h
116 $(CC) $(CFLAGS) -c calibrate_ppa.c
117
118 pnmtools.o: pnmtools.c pnmtools.h
119 $(CC) $(CFLAGS) -c pnmtools.c
120
121 cutswath.o: cutswath.c debug.h ppa.h image.h global.h syslog.h
122 $(CC) $(CFLAGS) -c cutswath.c
123
124 image.o: image.c image.h palette.h debug.h fscoeff.h global.h gamma.h syslog.h
125 $(CC) $(CFLAGS) -c image.c
126
127 gamma.o: gamma.c image.h global.h gamma.h
128 $(CC) $(CFLAGS) -c gamma.c
129
130 dither.o: dither.c dither.h image.h palette.h debug.h fscoeff.h global.h hash_ink.h
131 $(CC) $(CFLAGS) -c dither.c
132
133 pnm2ppa.o: pnm2ppa.c pnm2ppa.h image.h ppa.h debug.h global.h gamma.h syslog.h
134 $(CC) $(CFLAGS) -c pnm2ppa.c
135
136 ppa.o: ppa.c ppa.h debug.h global.h syslog.h
137 $(CC) $(CFLAGS) -c ppa.c
138
139 debug.o: debug.c debug.h global.h
140 $(CC) $(CFLAGS) -c debug.c
141
142 syslog.o: syslog.c syslog.h global.h
143 $(CC) $(CFLAGS) -c syslog.c
144
145 make_hash_ink: make_hash_ink.c palette.h hash_ink.h
146 $(CC) $(CFLAGS) -o make_hash_ink make_hash_ink.c
147
148 hash_ink.c: make_hash_ink
149 ./make_hash_ink 4 3 > hash_ink.c
150 ./make_hash_ink 1 5 >> hash_ink.c
151
152 hash_ink.o: hash_ink.c hash_ink.c
153 $(CC) $(CFLAGS) -c hash_ink.c
154
155 # a default rule, in case new .c files pop in
156
157 .c.o: $*.c ppa.h image.h enh-curve.h palette.h debug.h global.h
158 $(CC) $(CFLAGS) -c $*.c
159
160 distrib: clean
161 cd .. && tar cf - pnm2ppa/ | gzip -9 > pnm2ppa.tar.gz
162 sync
163
164
165
166
167
168
169
170
171
172
173
174
175
176
0 English
1
2 Please read the README in ./docs/en/README
3
0 These notes are for the guidance of distributions that include pnm2ppa:
1 ---------------------------------------------------------------------
2
3 Notes on secure installation of pnm2ppa.
4
5 What pnm2ppa does:
6
7 1. It attempts to open and read a configuration file
8 "/etc/pnm2ppa.conf", and then any additional configuration
9 files with paths specified by the -f command line option.
10
11 These paths are checked to be shorter than MAXPATHLEN before
12 they are used, otherwise pnm2ppa terminates.
13
14 GNU getopt() is used to process options.
15
16 2. It opens an input file (-i option) to receive pnm data.
17 The pnm format and page size is taken from the header.
18
19 If the header does not correspond to a valid pnm format, the rest
20 of the data is rejected, and pnm2ppa terminates.
21
22 The input file path is checked to have a length less than
23 MAXPATHLEN, as determined at compilation time.
24
25 3. It opens an output file (-o option) to send ppa data
26 (for the printer).
27
28 The output file path is checked to have a length less than
29 MAXPATHLEN.
30
31
32 4. (unless the --noGamma option is specified) it tries to read color
33 correction data from "/etc/pnm2ppa.gamma", or an alternate file with
34 a path specified by the -F command line option.
35
36 Such paths are also checked to be shorter than MAXPATHLEN before
37 they are used.
38
39 If this data exists, but is not successfully read, pnm2ppa terminates.
40 (See COLOR.txt).
41
42 5. pnm2ppa opens and writes to the syslog with informational messages
43 about its progress, or, if it terminates, with an error message.
44 If it is working in --verbose mode, these messages are also sent
45 to stderr.
46
47 No strings derived from user input to pnm2ppa are included in syslog
48 messages. Syslog messages must fit in a string of length < 128.
49 They can be suppressed with a keyword "silent 1" in the default
50 system configuration file (/etc/pnm2ppa.conf), but not from
51 user-specified config files (from -f option).
52
53 All syslog actions by pnm2ppa are "wrapped": message strings
54 produces in the rest of the program are only sent to the syslog by
55 code in syslog.c. This is also where openlog() and closelog() are
56 called.
57
58
59 ----------------------------------------------------------------------
60 Recommendations:
61
62 -- do *NOT* install pnm2ppa suid/guid, if is possible that a
63 "malicious user" might run it. The output file specified
64 with the -o option could overwrite files to which the user
65 has no write permission.
66
67
68 -- since pnm2ppa works as an output filter for gs, it only needs the
69 same privileges that gs would need. If lpr is available, pipe
70 the pnm2ppa output though "lpr -l ..." to the appropriate printer
71 rather than directly sending it to e.g. /dev/lp0 (in the latter case,
72 write privileges on /dev/lp0 would be needed.)
73
74 --------------------------------------------------------------
75
76 Other (optional) programs in the distribution:
77
78 Do NOT install these suid/gid!
79
80 calibrate.c: This is used to produce various ppmraw format PixMap images
81 used with pnm2ppa for printer calibration. Note: these
82 PixMaps are LARGE (100MB!!) and should generally be piped
83 directly to pnm2ppa.
84
85 THIS SHOULD USUALLY BE INSTALLED.
86
87 parse_vlink.c a utility useful in debugging pnm2ppa that can interpret
88 ppa format output instructions to the printer, whether
89 produced by pnm2ppa, or captured from the Windows9x drivers.
90 It is in the ppa_protocol subdirectory, and is not compiled
91 by default.
92
93 THIS IS NOT USUALY INSTALLED.
94
0 /***************************************************************************
1 calibrate_ppa.c - program to produce PPM data for pnm2ppa calibration
2 -------------------
3 begin : Thu Oct 12 2000
4 copyright : (C) 1998-2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18
19 /* incorporates color features added by Bruno ALIX */
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <unistd.h>
25 #include <getopt.h>
26 #include <sys/param.h>
27
28 #define __PNM2PPA_C__
29 #define __CALIBRATE_PPA_C__
30 #include "global.h"
31 #include "image.h"
32 #include "defaults.h"
33 #include "pnmtools.h"
34
35 int make_ppm_file ( FILE * , image_t *, char *) ;
36
37 int make_test_pattern ( FILE *, int, char * );
38
39
40 //int black_maxlines = 300;
41 int black_maxlines = 128; //put this back to old value for now (duncan)
42
43
44 void
45 show_usage (char *prog)
46 {
47 printf ("usage: %s [ options ] [ -o <outfile> ]] \n\n",
48 prog);
49 printf
50 (" Produces various PixMap (PPM) files used for calibrating pnm2ppa.\n\n");
51 printf (" NOTE: The size of a full-page PixMap is 100MB!!.\n");
52 printf (" These PixMaps should be piped directly to pnm2ppa, except in the case of\n");
53 printf (" the -g option, where the PixMap should be viewed or printed by other means.\n\n");
54 printf (" -g, --gamma produce gamma.ppm (10MB, used in color calibration).\n");
55 printf (" -h, --help displays this help text.\n");
56 printf (" -o <outfile> output to file <outfile>, \"-o -\" means stdout (default)\n");
57 printf (" -p <n> create test pattern number <n>\n");
58 printf (" --align pattern 0: align print heads. (default) \n");
59 printf (" --test pattern 1: test alignment. \n");
60 printf (" --clean pattern 2: clean print head. \n");
61 printf (" --center pattern 3: center paper. \n");
62 printf (" -s <paper> default papersize (a4, legal, letter = us (default))\n");
63 // printf (" -v <printer> Printer model:710=712=720=722;820;1000 (default:7xx)\n");
64 printf ("\n");
65 }
66
67 int
68 main (int argc, char *argv[])
69 {
70 int opt_index;
71 image_t image ;
72 char *progname = NULL;
73 BOOLEAN use_stdout = true ;
74 BOOLEAN gamma = false ;
75 FILE *outFile = NULL ;
76 int testPattern = 0;
77 char *out_filepath = NULL;
78 char c;
79 static struct option long_opts[] = {
80 {"gamma",0,0,'g'},
81 {"align",0,0,0},
82 {"test",0,0,0},
83 {"clean",0,0,0},
84 {"center",0,0,0},
85 {"help",0,0,'h'},
86 {0, 0, 0, 0}
87 };
88
89 gWidth = LETTERWIDTH;
90 gHeight = LETTERHEIGHT ;
91
92
93 // read through the optional arguments before tring to find filenames
94
95 while ((c = getopt_long (argc, argv, "gho:p:s:v:",
96 long_opts, &opt_index)) != EOF)
97 {
98 progname = *argv;
99 switch (c)
100 {
101 case 0:
102 // long options
103 switch (opt_index)
104 {
105 case 0:
106 // --gamma
107 gamma = true;
108 break;
109 case 1:
110 // --align
111 gamma = false;
112 testPattern = 0;
113 break;
114 case 2:
115 // --test
116 gamma = false;
117 testPattern = 1;
118 break;
119 case 3:
120 // --clean
121 gamma = false;
122 testPattern = 2;
123 break;
124 case 4:
125 // --center
126 gamma = false;
127 testPattern = 3;
128 break;
129 case 5:
130 // --help
131 show_usage (*argv);
132 return 0;
133 break;
134
135 default:
136 break;
137 }
138 break;
139
140 case 'g':
141 gamma = true;
142 break;
143
144 case 'h':
145 show_usage (*argv);
146 return 0;
147 break;
148
149
150 case 'o':
151 if (strncmp (optarg, "-", MAXPATHLEN) == 0)
152 {
153 use_stdout = true ;
154 }
155 else
156 {
157 if ( strlen(optarg) < MAXPATHLEN )
158 {
159 char filepath[MAXPATHLEN];
160 strncpy(filepath, optarg, MAXPATHLEN);
161 out_filepath = filepath ;
162 use_stdout = false ;
163 }
164 }
165 break;
166
167 case 'p':
168 // select alternate test pattern
169 gamma = false;
170 testPattern = atoi( optarg );
171 break;
172
173
174 case 's':
175 // paper size stuffer
176 if (!strncmp (optarg, "us", 2) || !strncmp (optarg, "letter", 6))
177 {
178 gWidth = LETTERWIDTH;
179 gHeight = LETTERHEIGHT;
180 }
181 else if (!strncmp (optarg, "legal", 5))
182 {
183 gWidth = LEGALWIDTH;
184 gHeight = LEGALHEIGHT;
185 }
186 else if (!strncmp (optarg, "a4", 2))
187 {
188 gWidth = A4WIDTH;
189 gHeight = A4HEIGHT;
190 }
191 else
192 {
193 fprintf(stderr,"%s: unknown paper size \"%s\"\n",
194 progname, optarg);
195 exit (0);
196 }
197 break;
198
199 case 'v':
200 // printer model
201 if (!strncmp (optarg, "820", 3) || !strncmp (optarg, "1000", 4))
202 black_maxlines = 128;
203 else if (!strncmp (optarg, "71", 2) || !strncmp (optarg, "72", 2))
204 // black_maxlines = 300;
205 black_maxlines = 128; //reverted for the moment
206 else
207 {
208 fprintf(stderr,"%s: unknown printer model \"%s\"\n",
209 progname, optarg);
210 exit (0);
211 }
212 break;
213
214 default:
215 exit (0);
216 break;
217 }
218 }
219
220
221 if (use_stdout)
222 outFile = stdout;
223 else
224 {
225 outFile = fopen( out_filepath , "w");
226 fprintf(stderr,"%s: writing requested PPM data to \"%s\"\n",
227 progname, out_filepath);
228 }
229
230 if (outFile == NULL )
231 {
232 fprintf(stderr,"%s: cannot open output file \"%s\"\n",
233 progname, out_filepath);
234 return 0;
235 }
236
237 if ( gamma )
238 {
239 /* production of PixMap gamma.ppm */
240 make_ppm_file( outFile , &image, progname );
241 }
242 else
243 {
244 /* make PixMap test patterns for printer */
245 make_test_pattern( outFile, testPattern, progname ) ;
246 }
247
248
249 fclose (outFile);
250 return 1 ;
251
252 }
253
254 int
255 make_ppm_file (FILE *outFile , image_t *image , char * progname)
256 {
257 unsigned char *line = NULL ;
258 image->width = gWidth;
259 image->height = gHeight;
260 image->bufferCurLine = 0;
261
262 fprintf (outFile,
263 "P6\n#PPM (PixMap) Image for comparison with printed output of \"pnm2ppa -g\"\n%d %d\n255\n",
264 image->width, 64 + image->height / 20);
265
266 line = malloc (image->width * 3);
267 if (!(line))
268 {
269 fprintf(stderr,"%s: malloc failed\n",
270 progname);
271 exit (1);
272 }
273 else
274 {
275 while ( image->bufferCurLine < image->height)
276 {
277 if ( ProduceGamma (image, line ))
278 {
279 fwrite (line, sizeof (unsigned char), (image->width * 3),
280 outFile);
281 }
282 image->bufferCurLine++;
283 }
284 free (line);
285 }
286 return 1;
287 }
288
289
290 /* various test patterns */
291
292 void centering_grid( void );
293 void make_big_x( void );
294 void make_vertical_line( void );
295 void color_alignment( void );
296 void check_alignment( void );
297 void head_cleaning( void );
298 void color_squares( void );
299 void centering( void );
300
301 /* color coding scheme used */
302
303 /* each color is coded on 2 bits of 1 byte rrggbbxx
304 (light grey is for head cleaning)
305 */
306 enum {
307 WHITE = 0xfc, /* white 11 11 11 00 = 000 = (255,255,255) */
308 BLACK = 0x00, /* black 00 00 00 00 = 444 = (000,000,000) */
309 CYAN = 0xbc, /* cyan 10 11 11 00 = 100 = (128,255,255) */
310 MAGENTA = 0xec, /* magenta 11 10 11 00 = 010 = (255,128,255) */
311 YELLOW = 0xf8, /* yellow 11 11 10 00 = 001 = (255,255,128) */
312 RED = 0xc0, /* red 11 00 00 00 = 044 = (255,000,000) */
313 GREEN = 0x30, /* green 00 11 00 00 = 404 = (000,255,000) */
314 BLUE = 0x0c, /* blue 00 00 11 00 = 004 = (000,000,255) */
315 GREY = 0xa8 /* light grey 10 10 10 00 = 111 = (128,128,128) */
316 };
317
318
319 int
320 make_test_pattern (FILE *outFile, int testPattern , char * progname )
321 {
322 int x;
323 int line, maxlines = 128 ;
324
325 /* create the pattern in strips starting at line line,
326 with a maximum number of lines maxlines in the strip.
327 */
328
329 Width = 8*(gWidth/8); /* make Width a multiple of 8 */
330 Height = gHeight;
331
332 /* pixel dimensions */
333 // Pwidth = Width ;
334 // Pheight = Height ;
335
336 /* each color is coded on 2 bits if 1 byte rrggbbxx */
337
338 fprintf(outFile,"P6\n%d %d\n255\n",Width,Height);
339
340 for ( line = 0; line < Height ; line += maxlines )
341 {
342 BitMap_topline = line;
343 BitMap_bottomline = line + maxlines;
344 if ( BitMap_bottomline > Height)
345 BitMap_bottomline = Height;
346 BitMap_Height = BitMap_bottomline - BitMap_topline;
347 BitMap_Width = Width;
348
349 color_bitmap = (char *)malloc(BitMap_Width*BitMap_Height);
350
351
352 /* set strip to white */
353 memset(color_bitmap,0xff,(BitMap_Width*BitMap_Height));
354
355
356 switch(testPattern)
357 {
358 case 0:
359 color_alignment();
360 break;
361 case 1:
362 check_alignment();
363 break;
364 case 2:
365 head_cleaning();
366 break;
367 case 3:
368 centering();
369 break;
370 // case 4:
371 //centering_grid();
372 //break;
373 // case 4:
374 //color_squares();
375 //break;
376 //case 5:
377 // make_vertical_line();
378 //break;
379 //case 6:
380 //make_big_x();
381 //break;
382
383 default:
384 fprintf(stderr,"%s: unknown test pattern (%d)\n",progname,testPattern);
385 fprintf(stderr,"test pattern 0 : cartridge alignment (default)\n");
386 fprintf(stderr," 1 : check alignment\n");
387 fprintf(stderr," 2 : colored stripes, use for head cleaning\n");
388 fprintf(stderr," 3 : center paper \n");
389 return 1;
390 }
391
392
393 for(x=0; x<BitMap_Width*BitMap_Height; x++)
394 {
395 int v, mask, i;
396
397 /* extract the data from the first 6 bits of each byte
398 of color_bitmap, convert to ppm format, and output it.
399 Each color has 4 intensities, coded in 2 bits):
400 0x00 : 4 drops of ink - ppm value 0
401 0x01 : 3 drops of ink - ppm value 8
402 0x02 : 1 drop of ink - ppm value 128
403 0x03 : 0 drops of ink - ppm value 255
404 */
405
406 for(i=6 ; i > 0 ; i-=2 )
407 {
408 mask = ( 0x03 << i );
409
410 v = ((color_bitmap [x] & mask) >> i);
411 switch(v)
412 {
413 case 0x00: // 4 drops of ink
414 v=0x00;
415 break;
416 case 0x01: // 3 drops of ink
417 v=0x08;
418 break;
419 case 0x02: // 1 drops of ink
420 v=0x80;
421 break;
422 case 0x03: // 0 drops of ink
423 v=0xff;
424 }
425 putc(v, outFile);
426 }
427 }
428 free(color_bitmap);
429 }
430 return 0;
431 }
432
433
434
435
436
437 void
438 centering_grid( void )
439 {
440 /* this pattern is a grid that can be used for centering the page*/
441 int x,y;
442 char buf[128];
443
444
445 for(x=0; x<Width; x+=100)
446 for(y=0; y<Height; y+=100)
447 setplus(x,y,4);
448 for(x=0; x<Width; x+=100)
449 {
450 sprintf(buf,"%d",x);
451 setstring(x+3,(Height/200)*100+3,buf,3);
452 }
453 for(y=0; y<Height; y+=100)
454 {
455 sprintf(buf,"%d",y);
456 setstring((Width/200)*100+3,y+3,buf,3);
457 }
458 for(x=0; x<Width; x+=10)
459
460 for(y=0; y<Height; y+=100)
461 setplus(x,y,((x%100)==50) ? 2 : 1);
462 for(x=0; x<Width; x+=100)
463 for(y=0; y<Height; y+=10)
464 setplus(x,y,((y%100)==50) ? 2 : 1);
465 setCG(Width/2,Height/2);
466 }
467
468
469 void
470 make_vertical_line( void )
471 {
472 int y;
473 for(y=0; y<300; y++)
474 setpixel(Width/2,Height/2-y,BLACK);
475 }
476
477
478 void
479 make_big_x( void )
480 {
481 int y;
482 for(y=0; y<300; y++)
483 {
484 setpixel(y,y,BLACK);
485 setpixel(Width-1-y,Height-1-y,BLACK);
486 }
487 }
488
489
490
491
492
493
494
495 void
496 color_alignment( void )
497 {
498 //add for color test, alignment pattern
499 int x,y,t,shear,direction;
500 int vpos;
501 int hpos;
502 char buf[128];
503
504 /* horizontal black/color offset pattern */
505
506 vpos=300;
507 hpos=Width/2-2000;
508 for(y=1;y<20;y++)
509 {
510 for(x=0;x<100;x++)
511 {
512 setpixel(y*200+hpos,x+vpos,BLACK);
513 setpixel(y*201-10+hpos,x+vpos+100,BLUE);
514 setpixel(y*201-10+1+hpos,x+vpos+100,BLUE);
515 setpixel(y*200+hpos,x+vpos+200,BLACK);
516 }
517 if ((y-10) > 0)
518 sprintf(buf,"+%d",y-10);
519 else
520 sprintf(buf,"%d",y-10);
521 setstring(y*200+hpos,vpos+350,buf,5);
522 }
523 setstring(Width/2 -200,vpos+450,"COLOFFSX",7);
524 /* vertical black/color offset pattern */
525
526 vpos=1200;
527 hpos=Width/2-2150;
528 for (t=1;t<10;t++)
529 {
530 for(y=0;y<101;y++)
531 {
532 setpixel(t*400+hpos+y,vpos,BLACK);
533 setpixel(t*400+hpos+105+y,vpos-5+t*1,BLUE);
534 setpixel(t*400+hpos+105+y,vpos-5+t*1+1,BLUE);
535 setpixel(t*400+hpos+210+y,vpos,BLACK);
536 }
537 if ((t-5) > 0)
538 sprintf(buf,"+%d",t-5);
539 else
540 sprintf(buf,"%d",t-5);
541 setstring(t*400+hpos+150,vpos+50,buf,5);
542
543 }
544 setstring(Width/2-200,vpos+150,"COLOFFSY",7);
545
546
547 /* colorshear setting (left-to-right / right-to-left sweep offsets) */
548
549
550 hpos=Width/2-2000;
551 vpos=2000;
552 direction = 1; /* this is determined by whether sweep is L2R or R2L */
553 for(y=1;y<20;y++)
554 {
555 shear= direction*(y-10);
556 for(x=0;x<128;x++)
557 {
558 setpixel(y*200+hpos,x+vpos+000,BLUE);
559 setpixel(y*200+hpos+1,x+vpos+000,BLUE);
560 setpixel(y*200+hpos+shear,x+vpos+128,BLUE);
561 setpixel(y*200+hpos+1+shear,x+vpos+128,BLUE);
562 setpixel(y*200+hpos,x+vpos+256,BLUE);
563 setpixel(y*200+hpos+1,x+vpos+256,BLUE);
564 setpixel(y*200+hpos+shear,x+vpos+384,BLUE);
565 setpixel(y*200+hpos+1+shear,x+vpos+384,BLUE);
566 setpixel(y*200+hpos,x+vpos+512,BLUE);
567 setpixel(y*200+hpos+1,x+vpos+512,BLUE);
568 }
569 if ((y-10) > 0)
570 sprintf(buf,"+%d",y-10);
571 else
572 sprintf(buf,"%d",y-10);
573 setstring(y*200+hpos,vpos+650,buf,5);
574 }
575 setstring(Width/2-200,vpos+750,"COLORSHEAR ",7);
576
577
578
579 /* blackshear setting (left-to-right / right-to-left sweep offsets) */
580
581 hpos=Width/2-2000;
582 vpos=3500;
583 direction = -1; /* this is determined by whether sweep is L2R or R2L */
584 for(y=1;y<20;y++)
585 {
586 shear = direction*(y-10);
587 for(x=0; x < black_maxlines ;x++)
588 {
589 setpixel(y*200+hpos,x+vpos+000,BLACK);
590 setpixel(y*200+hpos+shear,x+vpos+black_maxlines,BLACK);
591 setpixel(y*200+hpos,x+vpos+2*black_maxlines,BLACK);
592 setpixel(y*200+hpos+shear,x+vpos+3*black_maxlines,BLACK);
593 setpixel(y*200+hpos,x+vpos+4*black_maxlines,BLACK);
594 }
595 if ((y-10) > 0)
596 sprintf(buf,"+%d",y-10);
597 else
598 sprintf(buf,"%d",y-10);
599 setstring(y*200+hpos,vpos+650+5*(black_maxlines-128),buf,5);
600
601 }
602 vpos = vpos + 5*(black_maxlines -128) ;
603 setstring(Width/2-200,vpos+750,"BLACKSHEAR ",7);
604
605 hpos=Width/2;
606 vpos=4800;
607 for(x=0;x<640;x++)
608 {
609 setpixel(hpos,vpos+x,BLACK);
610 setpixel(hpos,vpos+640+x,BLUE);
611 }
612 }
613
614 void
615 check_alignment( void )
616 {
617 // alignment verification pattern
618 int x,y;
619 int vpos, vpos1, vpos2;
620 int hpos, hpos1,hpos2;
621
622
623 /* cross */
624
625 vpos=1000;
626 hpos=Width/2-384;
627 hpos+=384;
628 for (x=0;x<black_maxlines-2;x++)
629 setpixel(hpos,vpos+x,BLACK);
630 vpos += black_maxlines;
631 for (x=0;x<126;x++)
632 setpixel(hpos,vpos+x,BLUE);
633 vpos += 128;
634 for (x=0;x<black_maxlines-2;x++)
635 setpixel(hpos,vpos+x,BLACK);
636 vpos += black_maxlines;
637 for (x=0;x<black_maxlines-2;x++)
638 setpixel(hpos,vpos+x,BLACK);
639 vpos += black_maxlines;
640 for (x=0;x<126;x++)
641 setpixel(hpos,vpos+x,BLUE);
642 vpos += 128;
643 for (x=0;x<black_maxlines-2;x++)
644 setpixel(hpos,vpos+x,BLACK);
645 vpos += black_maxlines;
646
647 vpos-=128+2*black_maxlines;
648 hpos-=128+2*black_maxlines;
649
650 for (y=0;y<black_maxlines-2;y++)
651 setpixel(hpos+y,vpos,BLACK);
652 hpos += black_maxlines;
653 for (y=0;y<126;y++)
654 setpixel(hpos+y,vpos,BLUE);
655 hpos += 128;
656 for (y=0;y<black_maxlines-2;y++)
657 setpixel(hpos+y,vpos,BLACK);
658 hpos += black_maxlines;
659 for (y=0;y<black_maxlines-2;y++)
660 setpixel(hpos+y,vpos,BLACK);
661 hpos += black_maxlines;
662 for (y=0;y<126;y++)
663 setpixel(hpos+y,vpos,BLUE);
664 hpos += 128;
665 for (y=0;y<black_maxlines-2;y++)
666 setpixel(y+hpos,vpos,BLACK);
667
668
669 /* square */
670
671 vpos=3000;
672 hpos1=Width/2-3*(128+black_maxlines);
673 hpos2=Width/2+3*(128+black_maxlines);
674 for (x=0;x<2*black_maxlines -2;x++)
675 {
676 setpixel(hpos1,vpos+x,BLACK);
677 setpixel(hpos2,vpos+x,BLACK);
678 }
679 vpos += 2*black_maxlines;
680 for (x=0;x<254 ;x++)
681 {
682 setpixel(hpos1,vpos+x,BLUE);
683 setpixel(hpos2,vpos+x,BLUE);
684 }
685 vpos +=256;
686 for (x=0;x<2*black_maxlines -2;x++)
687 {
688 setpixel(hpos1,vpos+x,BLACK);
689 setpixel(hpos2,vpos+x,BLACK);
690 }
691 vpos += 2*black_maxlines;
692 for (x=0;x<254 ;x++)
693 {
694 setpixel(hpos1,vpos+x,BLUE);
695 setpixel(hpos2,vpos+x,BLUE);
696 }
697 vpos +=256;
698 for (x=0;x<2*black_maxlines -2;x++)
699 {
700 setpixel(hpos1,vpos+x,BLACK);
701 setpixel(hpos2,vpos+x,BLACK);
702 }
703 vpos += 2*black_maxlines;
704 for (x=0;x<254 ;x++)
705 {
706 setpixel(hpos1,vpos+x,BLUE);
707 setpixel(hpos2,vpos+x,BLUE);
708 }
709
710 vpos1=3000;
711 vpos2 = vpos1+6*(128+black_maxlines);
712 hpos = Width/2 - 3*(128+black_maxlines);
713 for (y=0;y<2*black_maxlines -2;y++)
714 {
715 setpixel(hpos+y,vpos1,BLACK);
716 setpixel(hpos+y,vpos2,BLACK);
717 }
718 hpos += 2*black_maxlines;
719 for (y=0;y<254 ;y++)
720 {
721 setpixel(hpos+y,vpos1,BLUE);
722 setpixel(hpos+y,vpos2,BLUE);
723 }
724 hpos +=256;
725 for (y=0;y<2*black_maxlines -2;y++)
726 {
727 setpixel(hpos+y,vpos1,BLACK);
728 setpixel(hpos+y,vpos2,BLACK);
729 }
730 hpos += 2*black_maxlines;
731 for (y=0;y<254 ;y++)
732 {
733 setpixel(hpos+y,vpos1,BLUE);
734 setpixel(hpos+y,vpos2,BLUE);
735 }
736 hpos +=256;
737 for (y=0;y<2*black_maxlines -2;y++)
738 {
739 setpixel(hpos+y,vpos1,BLACK);
740 setpixel(hpos+y,vpos2,BLACK);
741 }
742 hpos += 2*black_maxlines;
743 for (y=0;y<254 ;y++)
744 {
745 setpixel(hpos+y,vpos1,BLUE);
746 setpixel(hpos+y,vpos2,BLUE);
747 }
748 }
749
750 void
751 centering(void)
752 {
753 int x,y,z;
754 char buf[128];
755
756 for (y = Width/2; y > 0; y-- )
757 {
758 setpixel(y,y, BLACK);
759 setpixel(Width-y,y, BLACK);
760 setpixel(y,Height-y, BLACK);
761 setpixel(Width-y,Height-y, BLACK);
762 setpixel(y,Height/2, BLACK);
763 setpixel(Width-y,Height/2, BLACK);
764 }
765
766 for (x = 0; x < Height; x++)
767 setpixel(Width/2,x, BLACK );
768
769 for (z = 50; z < 601; z += 50)
770 {
771 for (x = z; x <= Height -z; x++)
772 {
773 setpixel(z,x,BLACK);
774 setpixel(Width-z,x,BLACK);
775 }
776 for (y = z; y <= Width -z;y++)
777 {
778 setpixel(y,z,BLACK);
779 setpixel(y,Height-z,BLACK);
780 }
781 sprintf(buf,"%d",z);
782 setstring (Width/2-30,z-15,buf,5);
783 setstring(Width/2-30,Height-z-15,buf,5);
784 setstringv(z-15,Height/2-60,buf,5);
785 setstringv(Width-z-15,Height/2-60,buf,5);
786
787 }
788 setstring(700,Height/2-100,"XOFFSET",7);
789 setstring(Width/2-150,800,"YOFFSET",7);
790
791 }
792
793
794 void
795 head_cleaning( void )
796 {
797 // test page for cleaning
798 int x,y,a,b,c;
799 int vpos;
800 char buf[128];
801
802 vpos=100;
803 for (y=0;y<2500;y++)
804 {
805 a=y%250 ;
806 b=y/50 ;
807 if (a==0)
808 {
809 for (x=0;x<300;x++)
810 {
811 setpixel ( y+100,x+vpos,BLACK);
812 }
813 }
814 else
815 {
816 for (x=0;x<6;x++)
817 {
818 a=x*50+b*1 ;
819 if (a>300) a=a-300;
820 setpixel (y+100,a+vpos,BLACK);
821 }
822 }
823 }
824 for (a=50;a<301;a+=50)
825 {
826 sprintf (buf,"%d",a);
827 setstring (2510+100,vpos-50+a,buf,3);
828 }
829
830 for (y=0;y<(240*8);y++)
831 {
832 a=y%240 ;
833
834 b=y/30 ;
835 vpos=500;
836 if (a==0)
837 {
838 for (x=0;x<128;x++)
839 {
840 setpixel ( y+100,x+vpos,MAGENTA);
841 setpixel ( y+100,x+vpos+128,YELLOW);
842 setpixel ( y+100,x+vpos+256,CYAN);
843 }
844 }
845 else
846 {
847 for (x=0;x<1;x++)
848 {
849 a=x*50+b*2 ;
850 if (a>128) a=a-128;
851 setpixel (y+100,a+vpos,MAGENTA);
852 setpixel (y+100,a+vpos+128,YELLOW);
853 setpixel (y+100,a+vpos+256,CYAN);
854 }
855 }
856 }
857
858 vpos=1300;
859 for (y=0;y<3500;y++)
860 {
861 a=y/500;
862
863 switch (a)
864 {
865 case 0 : b = RED; break;
866 case 1 : b = MAGENTA; break;
867 case 2 : b = BLUE; break;
868 case 3 : b = CYAN; break;
869 case 4 : b = GREEN; break;
870 case 5 : b = YELLOW; break;
871 case 6 : b = RED; break;
872 }
873 for (x=0;x<128;x++)
874 {
875 setpixel (y+100,x+vpos,b);
876 }
877 }
878
879 //grey
880 vpos=2000;
881 for (y=100;y<Width-1000;y++)
882 {
883 for (x=0;x<128;x++)
884 {
885 setpixel (y,x+vpos,GREY);
886 }
887 }
888
889 //magenta,yellow,cyan
890 vpos=2300;
891 for (y=100;y<Width-1000;y++)
892 {
893 for (x=0;x<128;x++)
894 {
895 setpixel (y,x+vpos,MAGENTA);
896 setpixel (y,x+vpos+128,YELLOW);
897 setpixel (y,x+vpos+256,CYAN);
898 }
899 }
900 //black
901 vpos=2800;
902 for (y=100;y<Width-1000;y++)
903 {
904 for (x=0;x<300;x++)
905 {
906 setpixel (y,x+vpos,BLACK);
907 }
908 }
909
910 vpos=3800;
911 for (y=0;y<600;y++)
912 {
913 a=y%50 ;
914 b=y/50 ;
915 c=y/100;
916 if (a==0)
917 {
918 for (x=0;x<300;x++)
919 {
920 setpixel ( y+100,x+vpos,BLACK);
921 }
922 }
923 else
924 {
925 for (x=0;x<25;x++)
926 {
927 a=x*2+c*50 ;
928 a=a+(b%2);
929 setpixel (y+100,a+vpos,BLACK);
930 }
931 }
932 }
933
934
935 for (y=600;y<1701;y++)
936 {
937 a=y%50 ;
938 b=y/50 ;
939 if (a==0)
940 {
941 for (x=0;x<300;x++)
942 {
943 setpixel ( y+100,x+vpos,BLACK);
944 }
945 }
946 else
947 {
948 for (x=0;x<7;x++)
949 {
950 a=(x*50+b*2)%300 ;
951 c=(a+3)%300;
952 setpixel (y+100,a+vpos,BLACK);
953 setpixel (y+100,c+vpos,BLACK);
954 }
955 }
956 }
957
958 for (y=1700;y<2400;y++)
959 {
960 a=(y-1700)/70 ;
961 for (x=0;x<30;x++)
962 {
963 setpixel (y+100,vpos+x*10+a,BLACK);
964 }
965 }
966
967 for (y=2400;y<3100;y++)
968 {
969 a=(y-2400)%70 ;
970 if (a==0)
971 {
972 for (x=0;x<300;x++)
973 {
974 setpixel ( y+100,x+vpos,BLACK);
975 }
976 }
977 }
978 }
979
980
981 void
982 color_squares( void )
983 {
984 int x,y,z;
985 //color squares (Giorgio) (dont work after modifications 15/03/2000)
986 //seems to use a different color coding scheme ..... 125 possible
987 // color values in a byte ...
988
989
990 z=0;
991 for (x=0;x<5;x++)
992 for (y=0;y<5;y++)
993 {
994 setsquare( 300*(x+1), 300+300*(y),200, 1+x,1+y,1+z);
995 setchar( 300*(x+1), 270+300*(y), '0' + x,3);
996 setchar( 40+300*(x+1), 270+300*(y), '0' + y,3);
997 setchar( 80+300*(x+1), 270+300*(y), '0' + z,3);
998 }
999 z=1;
1000 for (x=0;x<5;x++)
1001 for (y=0;y<5;y++)
1002 {
1003 setsquare( 1500+300*(x+1), 300+300*(y),200, 1+x,1+y,1+z);
1004 setchar( 1500+300*(x+1), 270+300*(y), '0' + x,3);
1005 setchar( 1540+300*(x+1), 270+300*(y), '0' + y,3);
1006 setchar( 1580+300*(x+1), 270+300*(y), '0' + z,3);
1007 }
1008 z=2;
1009 for (x=0;x<5;x++)
1010 for (y=0;y<5;y++)
1011 {
1012 setsquare( 3000+300*(x+1), 300+300*(y),200, 1+x,1+y,1+z);
1013 setchar( 3000+300*(x+1), 270+300*(y), '0' + x,3);
1014 setchar( 3040+300*(x+1), 270+300*(y), '0' + y,3);
1015 setchar( 3080+300*(x+1), 270+300*(y), '0' + z,3);
1016 }
1017 z=3;
1018 for (x=0;x<5;x++)
1019 for (y=0;y<5;y++)
1020 {
1021 setsquare( 300*(x+1), 1800+300*(y),200, 1+x,1+y,1+z);
1022 setchar( 300*(x+1), 1770+300*(y), '0' + x,3);
1023 setchar( 40+300*(x+1), 1770+300*(y), '0' + y,3);
1024 setchar( 80+300*(x+1), 1770+300*(y), '0' + z,3);
1025 }
1026 z=4;
1027 for (x=0;x<5;x++)
1028 for (y=0;y<5;y++)
1029 {
1030 setsquare( 1500+300*(x+1), 1800+300*(y),200, 1+x,1+y,1+z);
1031 setchar( 1500+300*(x+1), 1770+300*(y), '0' + x,3);
1032 setchar( 1540+300*(x+1), 1770+300*(y), '0' + y,3);
1033 setchar( 1580+300*(x+1), 1770+300*(y), '0' + z,3);
1034 }
1035 }
1036
0 /***********************************************************************
1 cutswath.c - function to cut a swath of a PNM file for PPA printers
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <assert.h>
21
22 #define __CUTSWATH_C__
23
24 #include "syslog.h"
25 #include "global.h"
26 #include "debug.h"
27 #include "defaults.h"
28 #include "ppa.h"
29 #include "image.h"
30
31 #include "lang.h"
32
33 int b_left, b_right, b_vpos , b_dir ;
34 int c_left, c_right, c_vpos , c_dir ;
35
36 /* sweep_data->direction must be set already */
37
38 /* Upon successful completion, sweep_data->image_data and
39 sweep_data->nozzle_data have been set to pointers which this routine
40 malloc()'d. */
41
42 /* Upon successful completion, all members of *sweep_data have been set
43 except direction, vertical_pos, and next. */
44
45 /* Returns: 0 if unsuccessful
46 1 if successful, but with non-printing result (end of page)
47 2 if successful, with printing result
48 3 if unsuccessful, exceeded buffer size */
49
50 int
51 cut_im_black_swath (image_t *image, ppaPrinter_t *printer,
52 int maxlines, ppaSweepData_t *sweep_data)
53 {
54 unsigned char *data[4], *ppa, *place, *maxplace;
55 int width8, p_width8;
56 int k, i, j, left, right, numlines;
57 int left_limit , right_limit , bottom_limit, top_limit;
58 int top_vpos , bottom_vpos, sweep_offset;
59 int non_blanklines, pre_blanklines, post_blanklines ;
60 int even_non_blanklines, even_pre_blanklines, even_post_blanklines ;
61 int odd_non_blanklines, odd_pre_blanklines, odd_post_blanklines ;
62 int start_even, start_odd;
63 int vpos_shift=600; /* "vertical position" = line number - vpos_shift */
64 BOOLEAN at_bottom ;
65
66 BOOLEAN got_nonblank;
67 int horzpos, hp2;
68 ppaNozzleData_t nozzles[2];
69
70 /* better have (black) maxlines a multiple of 4;
71 color uses half this number, and that must be even !*/
72
73 assert ( !(maxlines %4));
74
75 /* safeguard against the user freeing these */
76 for (k = 0; k < gMaxPass; k++)
77 {
78 sweep_data->image_data[k] = NULL;
79 }
80 sweep_data->nozzle_data = NULL;
81
82 /* read the data from the input file */
83 width8 = (image->width + 7) / 8;
84 for (k = 0; k < gMaxPass; k++)
85 {
86 if ((data[k] = malloc (width8 * maxlines)) == NULL)
87 {
88 snprintf(syslog_message,message_size,"cut_im_black_swath(): %s",
89 gMessages[E_CS_BADMALLOC]);
90 wrap_syslog (LOG_CRIT,"%s",syslog_message);
91 return 0;
92 }
93 }
94
95 /* prevent weird user settings of the margins
96 * from causing segfaults
97 */
98 left_limit = printer->left_margin / 8;
99 if ( left_limit < 0 )
100 left_limit = 0;
101 right_limit = ( gWidth - printer->right_margin ) / 8;
102 if (right_limit > width8 )
103 right_limit = width8;
104 bottom_limit = gHeight - printer->bottom_margin ;
105 if (bottom_limit > gHeight )
106 bottom_limit = gHeight;
107 if ( bottom_limit < 0 )
108 bottom_limit = 0;
109 top_limit = printer->top_margin ;
110 if ( top_limit < 0 )
111 top_limit = 0 ;
112 if ( top_limit > bottom_limit )
113 top_limit = bottom_limit ;
114
115 /* ignore lines that are above the upper margin */
116 while (image->blackCurLine < top_limit)
117 {
118 if (!im_black_readline (image, data, 0))
119 {
120 snprintf(syslog_message,message_size,"cut_im_black_swath(): %s",
121 gMessages[E_CS_BADTOPMARG]);
122 wrap_syslog (LOG_CRIT,"%s",syslog_message);
123
124 for (k = 0; k < gMaxPass; k++)
125 {
126 free (data[k]);
127 }
128 return 0;
129 }
130 }
131
132 /* eat all lines that are below the lower margin */
133 if (image->blackCurLine >= bottom_limit )
134 {
135 while (image->blackCurLine < image->height)
136 if (!im_black_readline (image, data, 0))
137 {
138 snprintf(syslog_message,message_size,"cut_im_black_swath(): %s",
139 gMessages[E_CS_BADBOTMARG]);
140 wrap_syslog (LOG_CRIT,"%s",syslog_message);
141
142 for (k = 0; k < gMaxPass; k++)
143 {
144 free (data[k]);
145 }
146 return 0;
147 }
148 for (k = 0; k < gMaxPass; k++)
149 {
150 free (data[k]);
151 }
152 return 1;
153 }
154
155 left = right_limit - 1;
156 right = left_limit;
157
158 /* eat all beginning blank lines and then up to maxlines or lower margin */
159 got_nonblank = false;
160 numlines = 0;
161 pre_blanklines = 0;
162 post_blanklines = 0;
163 sweep_offset = 0;
164 at_bottom = false ;
165 while (( image->blackCurLine + pre_blanklines < bottom_limit)
166 && ((numlines + pre_blanklines + post_blanklines ) < maxlines)
167 && ((!gColorMode) || got_nonblank
168 || ((image->buflines < MAXBUFFLINES)
169 || (image->buftype == bitmap))))
170 {
171 if (!im_black_readline (image, data, width8 * numlines))
172 {
173 snprintf(syslog_message,message_size,"cut_im_black_swath(): %s",
174 gMessages[E_CS_BADNEXTLINE]);
175 wrap_syslog (LOG_CRIT,"%s",syslog_message);
176 for (k = 0; k < gMaxPass; k++)
177 {
178 free (data[k]);
179 }
180 return 0;
181 }
182 if (!got_nonblank)
183 {
184 for (i = left_limit ; i < right_limit; i++)
185 {
186 if (data[0][i])
187 {
188 left = i;
189 got_nonblank = true;
190 right = i;
191 for (j = right_limit - 1; j > left ; j--)
192 {
193 if (data[0][j])
194 {
195 right = j;
196 break;
197 }
198 }
199 /* begin a new swath;, nonblank pixels occur in
200 * bytes "left" through "right", inclusive,
201 * where
202 * left_limit <= left <= right < right_limit.
203 * This range will be expanded if necessary
204 * as the swath is constructed
205 */
206 DPRINTF("cut_im_black_swath: begin swath, line %d\n",
207 image->blackCurLine ) ;
208
209 /* vertical position of top of swath */
210 top_vpos = image->blackCurLine - vpos_shift ;
211
212 /* predicted vertical position of bottom of swath */
213 bottom_vpos = top_vpos + maxlines - 1 ;
214 if ( bottom_vpos > bottom_limit - vpos_shift)
215 {
216 at_bottom = true;
217 bottom_vpos = bottom_limit - vpos_shift ;
218 /* make sure we are at least 12 dots below the previous
219 black swath vertical position (this is only
220 a possible problem if we are at the bottom limit)*/
221 if ( b_vpos + 12 - bottom_vpos > 0 )
222 {
223 post_blanklines += (b_vpos + 12 - bottom_vpos) ;
224 bottom_vpos += post_blanklines ;
225 }
226 }
227
228 DPRINTF("cut_im_black_swath: shifted bottom_limit=%d, bottom_vpos=%d\n",
229 bottom_limit - vpos_shift , bottom_vpos) ;
230
231 /* sweep_offset is the difference in vertical position
232 of consecutive color and black sweeps.
233 Flashing lights happen on the HP820 if this
234 is -3, -2, -1, 1 , 2 or 3! */
235
236 /* test previous color swath vertical positions */
237 sweep_offset = bottom_vpos - c_vpos ;
238
239 if ( ( sweep_offset >= -4 ) &&
240 ( sweep_offset < 4 ) &&
241 ( sweep_offset != 0 || at_bottom) )
242 {
243 if ( ( at_bottom ) &&
244 ( c_vpos + 5 - sweep_offset < top_vpos + maxlines - 1 ))
245 {
246 /* we are at the bottom margin , and can add post_blanklines*/
247 post_blanklines += 4 - sweep_offset ;
248 }
249 else
250 {
251 /* we are in the middle of the page */
252 if ( ( sweep_offset > 0 ) && ( ! at_bottom ))
253 {
254 /* shift swath upward to have same vpos */
255 pre_blanklines = sweep_offset ;
256 }
257 else
258 {
259 /* shift swath up to have vertical position vpos - 5 */
260 pre_blanklines = 5 + sweep_offset ;
261 }
262 }
263 }
264 /* will add pre_blanklines blank lines at the top of the swath
265 and post_blanklines at the end of the swath. */
266 break;
267 }
268 }
269 }
270 if (got_nonblank)
271 {
272 int newleft = left, newright = right;
273
274 /* find left-most nonblank */
275 for (i = left_limit ; i < left; i++)
276 {
277 if (data[0][width8 * numlines + i])
278 {
279 newleft = i;
280 break;
281 }
282 }
283 /* find right-most nonblank */
284 for (j = right_limit - 1; j > right; j--)
285 {
286 if (data[0][width8 * numlines + j])
287 {
288 newright = j;
289 break;
290 }
291 }
292 numlines++;
293
294 if (newright < newleft)
295 {
296 DPRINTF ("Code error! newleft=%d, newright=%d, left=%d, right=%d\n",
297 newleft, newright, left, right);
298 for (k = 0; k < gMaxPass; k++)
299 {
300 free (data[k]);
301 }
302 return 0;
303 }
304
305 /* if the next line might push us over the buffer size, stop here! */
306 /* ignore this test for the 720 right now. Will add better */
307 /* size-guessing for compressed data in the near future! */
308 if (numlines % 2 == 1 && printer->version != HP7X0)
309 {
310 int l = newleft, r = newright, w;
311
312 l--;
313 r += 3;
314 w = r - l;
315
316 if ((w + 24) * numlines > printer->bufsize)
317 {
318 numlines--;
319 im_unreadline (image, data[0] + width8 * numlines);
320 break;
321 }
322 else
323 {
324 left = newleft;
325 right = newright;
326 }
327 }
328 else
329 {
330 left = newleft;
331 right = newright;
332 }
333 }
334 }
335
336 if ((gColorMode) && (image->buflines >= MAXBUFFLINES)
337 && (image->buftype == color))
338 {
339 DPRINTF ("cut_im_black_swath: exceeding buffer size: buflines=%d, MAX=%d\n",
340 image->buflines, MAXBUFFLINES);
341 if ((!got_nonblank))
342 {
343 for (k = 0; k < gMaxPass; k++)
344 {
345 free (data[k]);
346 }
347 return 3;
348 }
349 }
350
351 if ((!got_nonblank))
352 {
353 /* eat all lines that are below the lower margin */
354 if (image->blackCurLine >= bottom_limit )
355 {
356 while (image->blackCurLine < image->height)
357 if (!im_black_readline (image, data, 0))
358 {
359 snprintf(syslog_message,message_size,"cut_im_black_swath(): %s",
360 gMessages[E_CS_BADBOTMARG]);
361 wrap_syslog (LOG_CRIT,"%s",syslog_message);
362
363 for (k = 0; k < gMaxPass; k++)
364 {
365 free (data[k]);
366 }
367 return 0;
368 }
369 for (k = 0; k < gMaxPass; k++)
370 {
371 free (data[k]);
372 }
373 return 1;
374 }
375 for (k = 0; k < gMaxPass; k++)
376 {
377 free (data[k]);
378 }
379 return 0;
380 /* error, since didn't get to lower margin, yet blank */
381 }
382
383
384 /* calculate vertical position */
385 sweep_data->vertical_pos = image->blackCurLine ;
386
387 /* subtract that 600 dot adjustment here */
388 sweep_data->vertical_pos -= vpos_shift;
389
390 DPRINTF("cut_im_black_swath: end swath, line %d numlines=%d left=%d right=%d\n",
391 image->blackCurLine, numlines, left, right) ;
392 /* width of the swath in bytes */
393
394
395 /* calculate number of blank lines added at top and bottom of swath */
396
397 non_blanklines = numlines ;
398 numlines += pre_blanklines ;
399 if ( (numlines + post_blanklines) % 2 )
400 post_blanklines++ ;
401 numlines += post_blanklines ;
402 assert (maxlines >= numlines );
403 sweep_data->vertical_pos += post_blanklines ;
404
405 even_pre_blanklines = odd_pre_blanklines = pre_blanklines / 2 ;
406 even_non_blanklines = odd_non_blanklines = non_blanklines / 2 ;
407 even_post_blanklines = odd_post_blanklines = post_blanklines / 2 ;
408
409 start_even= 0;
410 start_odd = 1;
411
412 if ( (pre_blanklines %2 == 0) &&
413 !(non_blanklines % 2 == 0) &&
414 !(post_blanklines % 2 == 0))
415 {
416 even_non_blanklines++ ;
417 odd_post_blanklines++;
418 start_even= 0;
419 start_odd = 1;
420 }
421 if ( !(pre_blanklines %2 == 0) &&
422 !(non_blanklines % 2 == 0) &&
423 (post_blanklines % 2 == 0))
424 {
425 even_pre_blanklines++;
426 odd_non_blanklines++;
427 start_even= 1;
428 start_odd = 0;
429 }
430 if ( !(pre_blanklines %2 == 0) &&
431 (non_blanklines % 2 == 0) &&
432 !(post_blanklines % 2 == 0))
433 {
434 even_pre_blanklines++;
435 odd_post_blanklines++;
436 start_even= 1;
437 start_odd = 0;
438 }
439
440
441 assert (( even_pre_blanklines + odd_pre_blanklines +
442 even_non_blanklines + odd_non_blanklines +
443 even_post_blanklines + odd_post_blanklines ) == numlines );
444
445 if (pre_blanklines)
446 {
447 DPRINTF("cut_im_black_swath: offset %d; add pre_blanklines=%d lines\n",
448 sweep_offset, pre_blanklines);
449 }
450 if (post_blanklines)
451 {
452 DPRINTF("cut_im_black_swath: offset %d; add post_blanklines=%d lines\n",
453 sweep_offset, post_blanklines);
454 }
455
456
457 /* change sweep params */
458 /* ensures at least 4 bytes sweep width */
459 right +=3;
460 left-- ;
461 p_width8 = right - left;
462
463
464 if ((ppa = malloc ((p_width8 + 24) * numlines)) == NULL)
465 {
466 snprintf(syslog_message,message_size,"cut_im_black_swath(): %s",
467 gMessages[E_CS_BADPPAMALLOC]);
468 wrap_syslog (LOG_CRIT,"%s",syslog_message);
469
470 for (k = 0; k < gMaxPass; k++)
471 {
472 free (data[k]);
473 }
474 return 0;
475 }
476
477 place = ppa;
478
479
480 /* always left-to-right if gUnimode is true */
481 if (gUnimode)
482 sweep_data->direction = left_to_right;
483 else if ((b_vpos > c_vpos) || (c_vpos > sweep_data->vertical_pos))
484 {
485 if (b_dir == left_to_right)
486 sweep_data->direction = right_to_left;
487 else
488 sweep_data->direction = left_to_right;
489 } else {
490 if (c_dir == left_to_right)
491 sweep_data->direction = right_to_left;
492 else
493 sweep_data->direction = left_to_right;
494 }
495
496 DPRINTF("cut_im_black_swath: prev b_left %d b_right %d b_vpos %d b_dir %d\n",
497 b_left, b_right, b_vpos, b_dir);
498 DPRINTF("cut_im_black_swath: cur left %d right %d vpos %d dir %d\n",
499 left, right, sweep_data->vertical_pos, sweep_data->direction);
500 b_left = left;
501 b_right = right;
502 b_vpos = sweep_data->vertical_pos;
503 b_dir = sweep_data->direction;
504 DPRINTF("cut_im_black_swath: c_left %d c_right %d c_vpos %d c_dir %d\n",
505 c_left, c_right, c_vpos, c_dir);
506
507 /* place 0's in the first 12 columns */
508 memset (place, 0, numlines / 2 * 12);
509 place += numlines / 2 * 12;
510
511 if (sweep_data->direction == left_to_right)
512 DPRINTF ("black: sweep_data->direction == left_to_right\n");
513 else if (sweep_data->direction == right_to_left)
514 DPRINTF ("black: sweep_data->direction == right_to_left\n");
515 else
516 DPRINTF ("black: sweep_data->direction == *** ERROR: NOT SET! \n");
517
518 if (sweep_data->direction == right_to_left) /* right-to-left */
519 {
520 for (i = p_width8 + 11; i >= 0; i--)
521 {
522 int x ;
523 if (i >= 12 )
524 {
525 x = i - 12;
526 if( left + x < left_limit || left + x >= right_limit )
527 {
528 /* never print data outside the limits */
529 memset (place, 0, numlines / 2);
530 place += numlines / 2;
531 }
532 else
533 {
534 if ( even_pre_blanklines > 0)
535 {
536 /* first pre_blanklines lines are blank */
537 memset (place, 0, even_pre_blanklines) ;
538 place += even_pre_blanklines ;
539 }
540 for (j = 0; j < even_non_blanklines; j++)
541 {
542 *place++ = data[0][((j * 2) + start_even ) * width8 + left + x];
543 }
544 if ( even_post_blanklines > 0 )
545 {
546 /* last post_blanklines lines are blank */
547 memset (place, 0, even_post_blanklines) ;
548 place += even_post_blanklines ;
549 }
550 }
551 }
552 else
553 {
554 memset (place, 0, numlines / 2);
555 place += numlines / 2;
556 }
557
558 if (i < p_width8)
559 {
560 x = i ;
561 if( left + x < left_limit || left + x >= right_limit )
562 {
563 /* never print data outside the limits */
564 memset (place, 0, numlines / 2);
565 place += numlines / 2;
566 }
567 else
568 {
569 if ( odd_pre_blanklines > 0)
570 {
571 /* first pre_blanklines lines are blank */
572 memset (place, 0, odd_pre_blanklines) ;
573 place += odd_pre_blanklines ;
574 }
575 for (j = 0; j < odd_non_blanklines; j++)
576 {
577 *place++ = data[0][((j * 2) + start_odd ) * width8 + left + x];
578 }
579 if ( odd_post_blanklines > 0 )
580 {
581 /* last post_blanklines lines are blank */
582 memset (place, 0, odd_post_blanklines) ;
583 place += odd_post_blanklines ;
584 }
585 }
586 }
587 else
588 {
589 memset (place, 0, numlines / 2);
590 place += numlines / 2;
591 }
592 }
593 }
594 else /* sweep_data->direction == left_to_right */
595 {
596 for (i = 0; i < p_width8 + 12; i++)
597 {
598 int x;
599 if (i < p_width8)
600 {
601 x = i;
602 if( left + x < left_limit || left + x >= right_limit )
603 {
604 /* never print data outside the limits */
605 memset (place, 0, numlines / 2);
606 place += numlines / 2;
607 }
608 else
609 {
610 if ( odd_pre_blanklines > 0)
611 {
612 /* first pre_blanklines lines are blank */
613 memset (place, 0, odd_pre_blanklines) ;
614 place += odd_pre_blanklines ;
615 }
616 for (j = 0; j < odd_non_blanklines; j++)
617 {
618 *place++ = data[0][((j * 2) + start_odd) * width8 + left + x];
619 }
620 if ( odd_post_blanklines > 0 )
621 {
622 /* last post_blanklines lines are blank */
623 memset (place, 0, odd_post_blanklines) ;
624 place += odd_post_blanklines ;
625 }
626 }
627 }
628 else
629 {
630 memset (place, 0, numlines / 2);
631 place += numlines / 2;
632 }
633
634 if (i >= 12)
635 {
636 x = i - 12;
637 if( left + x < left_limit || left + x >= right_limit )
638 {
639 /* never print data outside the limits */
640 memset (place, 0, numlines / 2);
641 place += numlines / 2;
642 }
643 else
644 {
645 if ( even_pre_blanklines > 0)
646 {
647 /* first pre_blanklines lines are blank */
648 memset (place, 0, even_pre_blanklines) ;
649 place += even_pre_blanklines ;
650 }
651 for (j = 0; j < even_non_blanklines; j++)
652 {
653 *place++ = data[0][((j * 2) + start_even) * width8 + left + x];
654 }
655 if ( even_post_blanklines > 0 )
656 {
657 /* last post_blanklines lines are blank */
658 memset (place, 0, even_post_blanklines) ;
659 place += even_post_blanklines ;
660 }
661 }
662 }
663 else
664 {
665 memset (place, 0, numlines / 2);
666 place += numlines / 2;
667 }
668 }
669 }
670
671 /* done with data */
672 for (k = 0; k < gMaxPass; k++)
673 {
674 if (data[k] != NULL)
675 {
676 free (data[k]);
677 }
678 }
679
680 /* place 0's in the last 12 columns */
681 memset (place, 0, numlines / 2 * 12);
682 place += numlines / 2 * 12;
683 maxplace = place;
684
685 /* create sweep data */
686 sweep_data->image_data[0] = ppa;
687 sweep_data->data_size = maxplace - ppa;
688 sweep_data->in_color = false;
689
690 horzpos = left * 8 ;
691
692 horzpos += (sweep_data->direction == left_to_right) ? 1 : 0;
693
694 if (sweep_data->direction == right_to_left )
695 horzpos += printer->r2l_bw_offset ;/* correct bidirectional shearing */
696
697 hp2 = horzpos + (p_width8 + 24) * 8;
698
699
700 sweep_data->left_margin = horzpos;
701 sweep_data->right_margin = hp2 + printer->marg_diff;
702
703 for (i = 0; i < 2; i++)
704 {
705 nozzles[i].DPI = 600;
706 nozzles[i].pins_used_d2 = numlines / 2;
707 nozzles[i].unused_pins_p1 = 301 - numlines;
708 nozzles[i].first_pin = 1;
709 if (i == 0)
710 {
711 nozzles[i].left_margin = horzpos + printer->marg_diff;
712 nozzles[i].right_margin = hp2 + printer->marg_diff;
713 if (sweep_data->direction == right_to_left)
714 nozzles[i].nozzle_delay = 0;
715 else
716 nozzles[i].nozzle_delay = 6; //6
717 }
718 else
719 {
720 nozzles[i].left_margin = horzpos;
721 nozzles[i].right_margin = hp2;
722 if (sweep_data->direction == right_to_left)
723 nozzles[i].nozzle_delay = 2;
724 else
725 nozzles[i].nozzle_delay = 0;
726 }
727 }
728
729 sweep_data->nozzle_data_size = 2;
730 sweep_data->nozzle_data = malloc (sizeof (nozzles));
731 if (sweep_data->nozzle_data == NULL)
732 return 0;
733 memcpy (sweep_data->nozzle_data, nozzles, sizeof (nozzles));
734
735 return 2;
736 }
737
738 #define UNUSABLE 1
739 #define CYAN (0<<1)
740 #define MAGENTA (1<<1)
741 #define YELLOW (2<<1)
742 #define ODD (1<<3)
743 #define EVEN (0<<3)
744 #define XSHIFT 4
745 #define XPOS(x) ((x)<<XSHIFT)
746
747
748 /* number of "special" columns at left of sweep */
749 /* different versions for left-to-right and right-to-left sweeps */
750 static int Right_size = 42;
751 static int Right_l2r[] = {
752 UNUSABLE,
753 UNUSABLE,
754 UNUSABLE,
755 UNUSABLE,
756 CYAN | EVEN | XPOS (0),
757 CYAN | ODD | XPOS (0),
758 CYAN | EVEN | XPOS (1),
759 UNUSABLE,
760 UNUSABLE,
761 CYAN | ODD | XPOS (1),
762 CYAN | EVEN | XPOS (2),
763 UNUSABLE,
764 UNUSABLE,
765 CYAN | ODD | XPOS (2),
766 CYAN | EVEN | XPOS (3),
767 UNUSABLE,
768 MAGENTA | EVEN | XPOS (0),
769 CYAN | ODD | XPOS (3),
770 CYAN | EVEN | XPOS (4),
771 UNUSABLE,
772 MAGENTA | ODD | XPOS (0),
773 MAGENTA | EVEN | XPOS (1),
774 CYAN | ODD | XPOS (4),
775 CYAN | EVEN | XPOS (5),
776 UNUSABLE,
777 UNUSABLE,
778 MAGENTA | ODD | XPOS (1),
779 MAGENTA | EVEN | XPOS (2),
780 CYAN | ODD | XPOS (5),
781 CYAN | EVEN | XPOS (6),
782 UNUSABLE,
783 UNUSABLE,
784 MAGENTA | ODD | XPOS (2),
785 MAGENTA | EVEN | XPOS (3),
786 CYAN | ODD | XPOS (6),
787 CYAN | EVEN | XPOS (7),
788 UNUSABLE,
789 YELLOW | EVEN | XPOS (0),
790 MAGENTA | ODD | XPOS (3),
791 MAGENTA | EVEN | XPOS (4),
792 CYAN | ODD | XPOS (7),
793 CYAN | EVEN | XPOS (8)
794 };
795 static int Right_r2l[] = {
796 UNUSABLE,
797 UNUSABLE,
798 UNUSABLE,
799 CYAN | EVEN | XPOS (0),
800 UNUSABLE,
801 CYAN | EVEN | XPOS (1),
802 CYAN | ODD | XPOS (0),
803 UNUSABLE,
804 UNUSABLE,
805 CYAN | EVEN | XPOS (2),
806 CYAN | ODD | XPOS (1),
807 UNUSABLE,
808 UNUSABLE,
809 CYAN | EVEN | XPOS (3),
810 CYAN | ODD | XPOS (2),
811 MAGENTA | EVEN | XPOS (0),
812 UNUSABLE,
813 CYAN | EVEN | XPOS (4),
814 CYAN | ODD | XPOS (3),
815 UNUSABLE,
816 MAGENTA | EVEN | XPOS (1),
817 MAGENTA | ODD | XPOS (0),
818 CYAN | EVEN | XPOS (5),
819 CYAN | ODD | XPOS (4),
820 UNUSABLE,
821 UNUSABLE,
822 MAGENTA | EVEN | XPOS (2),
823 MAGENTA | ODD | XPOS (1),
824 CYAN | EVEN | XPOS (6),
825 CYAN | ODD | XPOS (5),
826 UNUSABLE,
827 UNUSABLE,
828 MAGENTA | EVEN | XPOS (3),
829 MAGENTA | ODD | XPOS (2),
830 CYAN | EVEN | XPOS (7),
831 CYAN | ODD | XPOS (6),
832 YELLOW | EVEN | XPOS (0),
833 UNUSABLE,
834 MAGENTA | EVEN | XPOS (4),
835 MAGENTA | ODD | XPOS (3),
836 CYAN | EVEN | XPOS (8),
837 CYAN | ODD | XPOS (7)
838 };
839
840 /* number of "special" columns at left of sweep */
841 static int Left_size = 32;
842 static int Left_l2r[] = {
843 YELLOW | ODD | XPOS (0),
844 YELLOW | EVEN | XPOS (0),
845 YELLOW | ODD | XPOS (1),
846 YELLOW | EVEN | XPOS (1),
847 YELLOW | ODD | XPOS (2),
848 YELLOW | EVEN | XPOS (2),
849 YELLOW | ODD | XPOS (3),
850 UNUSABLE,
851 MAGENTA | ODD | XPOS (0),
852 YELLOW | EVEN | XPOS (3),
853 YELLOW | ODD | XPOS (4),
854 MAGENTA | EVEN | XPOS (0),
855 MAGENTA | ODD | XPOS (1),
856 YELLOW | EVEN | XPOS (4),
857 YELLOW | ODD | XPOS (5),
858 MAGENTA | EVEN | XPOS (1),
859 MAGENTA | ODD | XPOS (2),
860 YELLOW | EVEN | XPOS (5),
861 YELLOW | ODD | XPOS (6),
862 UNUSABLE,
863 MAGENTA | EVEN | XPOS (2),
864 MAGENTA | ODD | XPOS (3),
865 YELLOW | EVEN | XPOS (6),
866 YELLOW | ODD | XPOS (7),
867 UNUSABLE,
868 CYAN | ODD | XPOS (0),
869 MAGENTA | EVEN | XPOS (3),
870 MAGENTA | ODD | XPOS (4),
871 YELLOW | EVEN | XPOS (7),
872 YELLOW | ODD | XPOS (8),
873 CYAN | EVEN | XPOS (0),
874 CYAN | ODD | XPOS (1)
875 };
876
877 /* the final odd yellow swing buffer doesnt fit in right-to-left
878 * color sweeps. Instead of redesigning the structure of the Left of
879 * the sweep (If it works, dont fix it ...)
880 * I'll just arrange that no printable data ever uses
881 * this last position .. (the leftmost printed dot) (duncan)
882 */
883
884 static int Left_r2l[] = {
885 UNUSABLE,//YELLOW | ODD | XPOS (0), //this data doesnt fit, what to do?
886 YELLOW | ODD | XPOS (1),
887 YELLOW | EVEN | XPOS (0),
888 YELLOW | ODD | XPOS (2),
889 YELLOW | EVEN | XPOS (1),
890 YELLOW | ODD | XPOS (3),
891 YELLOW | EVEN | XPOS (2),
892 MAGENTA | ODD | XPOS (0),
893 UNUSABLE,
894 YELLOW | ODD | XPOS (4),
895 YELLOW | EVEN | XPOS (3),
896 MAGENTA | ODD | XPOS (1),
897 MAGENTA | EVEN | XPOS (0),
898 YELLOW | ODD | XPOS (5),
899 YELLOW | EVEN | XPOS (4),
900 MAGENTA | ODD | XPOS (2),
901 MAGENTA | EVEN | XPOS (1),
902 YELLOW | ODD | XPOS (6),
903 YELLOW | EVEN | XPOS (5),
904 UNUSABLE,
905 MAGENTA | ODD | XPOS (3),
906 MAGENTA | EVEN | XPOS (2),
907 YELLOW | ODD | XPOS (7),
908 YELLOW | EVEN | XPOS (6),
909 CYAN | ODD | XPOS (0),
910 UNUSABLE,
911 MAGENTA | ODD | XPOS (4),
912 MAGENTA | EVEN | XPOS (3),
913 YELLOW | ODD | XPOS (8),
914 YELLOW | EVEN | XPOS (7),
915 CYAN | ODD | XPOS (1),
916 CYAN | EVEN | XPOS (0)
917 };
918
919 #define GET_USABLE(A,i) (!(A[i] & 0x1))
920 #define GET_COLOR(A,i) ((A[i] >> 1) & 0x3);
921 #define GET_ODD(A,i) ((A[i] >> 3) & 0x1);
922 #define GET_X(A,i) ((A[i] >> 4));
923
924 int
925 cut_im_color_swath (image_t *image, ppaPrinter_t *printer, int maxlines,
926 ppaSweepData_t *sweep_data)
927 {
928 unsigned char *data[4], *ppa, *place, *maxplace;
929 int width8, p_width8;
930 int k, i, j, left , right, numlines;
931 int left_limit, right_limit, bottom_limit, top_limit ;
932 int top_vpos , bottom_vpos, sweep_offset ;
933 int non_blanklines, pre_blanklines, post_blanklines ;
934 int even_non_blanklines, even_pre_blanklines, even_post_blanklines ;
935 int odd_non_blanklines, odd_pre_blanklines, odd_post_blanklines ;
936 BOOLEAN at_bottom ;
937 int start_even, start_odd;
938 int vpos_shift=600; /* "vertical position" = line number - vpos_shift */
939
940 BOOLEAN got_nonblank;
941 int horzpos, hp2;
942 ppaNozzleData_t nozzles[6];
943
944 /* maxlines needs to be even */
945 assert( !(maxlines % 2 ));
946
947 place = NULL;
948 ppa = NULL;
949 maxplace = NULL;
950
951 /* safeguard against the user freeing these */
952 for (k = 0; k < gMaxPass; k++) //mocho
953 {
954 sweep_data->image_data[k] = NULL;
955 }
956 sweep_data->nozzle_data = NULL;
957
958 /* read the data from the input file */
959 width8 = (image->width / 2 + 7) / 8;
960 DPRINTF ("width8 * 3 * maxlines = %d\n", width8 * 3 * maxlines);
961 for (k = 0; k < gMaxPass; k++) //mocho
962 {
963 if ((data[k] = malloc (width8 * 3 * maxlines + 8)) == NULL)
964 {
965 snprintf(syslog_message,message_size,"cut_im_color_swath(): %s",
966 gMessages[E_CS_BADMALLOC]);
967 wrap_syslog (LOG_CRIT,"%s",syslog_message);
968 return 0;
969 }
970 }
971
972 /* protect against weird margin settings */
973
974 left_limit = printer->left_margin / 2 / 8;
975 if ( left_limit < 0 )
976 left_limit = 0 ;
977 right_limit = (gWidth - printer->right_margin) / 2 / 8;
978 if ( right_limit > width8 )
979 right_limit = width8 ;
980 bottom_limit = gHeight - printer->bottom_margin ;
981 if ( bottom_limit > gHeight)
982 bottom_limit = gHeight ;
983 if ( bottom_limit < 0 )
984 bottom_limit = 0;
985 top_limit = printer->top_margin ;
986 if ( top_limit < 0 )
987 top_limit = 0 ;
988 if ( top_limit > bottom_limit )
989 top_limit = bottom_limit ;
990
991
992 /* ignore lines that are above the upper margin */
993 while (image->colorCurLine < top_limit )
994 if (!im_color_readline (image, data, 0))
995 {
996 snprintf(syslog_message,message_size,"cut_im_color_swath(): %s",
997 gMessages[E_CS_BADTOPMARG]);
998 wrap_syslog (LOG_CRIT,"%s",syslog_message);
999
1000 for (k = 0; k < gMaxPass; k++) // mocho
1001 {
1002 free (data[k]);
1003 }
1004 return 0;
1005 }
1006
1007 /* eat all lines that are below the lower margin */
1008 if (image->colorCurLine >= bottom_limit )
1009 {
1010 while (image->colorCurLine < image->height)
1011 if (!im_color_readline (image, data, 0))
1012 {
1013 snprintf(syslog_message,message_size,"cut_im_color_swath(): %s",
1014 gMessages[E_CS_BADBOTMARG]);
1015 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1016
1017 for (k = 0; k < gMaxPass; k++)
1018 {
1019 free (data[k]); //mocho
1020 }
1021 return 0;
1022 }
1023 for (k = 0; k < gMaxPass; k++)
1024 {
1025 free (data[k]); //mocho
1026 }
1027 DPRINTF (" cut_im_color_swath: return 1 on line %d\n", __LINE__);
1028 return 1;
1029 }
1030
1031
1032 left = right_limit - 1;
1033 right = left_limit;
1034
1035 got_nonblank = false;
1036 numlines = 0;
1037 pre_blanklines = 0;
1038 post_blanklines = 0;
1039 at_bottom = false ;
1040 sweep_offset = 0;
1041 /* eat all beginning blank lines and then up to maxlines or lower margin */
1042 while (
1043 ( image->colorCurLine + (2* pre_blanklines) < bottom_limit ) &&
1044 ( (numlines + pre_blanklines + post_blanklines) < maxlines)
1045 && (got_nonblank ||
1046 ((image->buflines < MAXBUFFLINES) || (image->buftype == color))))
1047 {
1048 if (!im_color_readline (image, data, width8 * 3 * numlines)) //mocho
1049 {
1050 snprintf(syslog_message,message_size,"cut_im_color_swath(): %s",
1051 gMessages[E_CS_BADNEXTLINE]);
1052 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1053
1054 for (k = 0; k < gMaxPass; k++)
1055 {
1056 free (data[k]); //mocho
1057 }
1058 return 0;
1059 }
1060 if (!got_nonblank)
1061 {
1062 for (i = left_limit * 3; i < right_limit * 3; i++)
1063 {
1064 if ((data[gMaxPass - 1][i]))
1065 {
1066 left = i / 3;
1067 got_nonblank = true;
1068 right = left;
1069 for (j = right_limit * 3 - 1; j > left * 3 + 2; j--)
1070 {
1071 if ((data[gMaxPass - 1][j]))
1072 {
1073 right = j / 3;
1074 break;
1075 }
1076 }
1077 /* begin a new swath;, nonblank pixels occur in
1078 * bytes "left" through "right", inclusive,
1079 * where
1080 * left_limit <= left <= right < right_limit.
1081 * This range will be expanded if necessary
1082 * as the swath is constructed
1083 */
1084 DPRINTF("cut_im_color_swath: begin swath, line %d\n",
1085 image->colorCurLine ) ;
1086
1087 /* vertical position of top of swath */
1088 top_vpos = image->colorCurLine - vpos_shift + printer->ColBwOffsY ;
1089
1090 /* predicted vertical position of bottom of swath */
1091 bottom_vpos = top_vpos + 2* ( maxlines - 1);
1092 if ( bottom_vpos > bottom_limit - vpos_shift + printer->ColBwOffsY )
1093 {
1094 at_bottom = true;
1095 bottom_vpos = bottom_limit - vpos_shift + printer->ColBwOffsY ;
1096 /* make sure we are at least 20 dots below the previous
1097 color swath vertical position (this is only
1098 a possible problem if we are at the bottom limit)*/
1099 if ( ( c_vpos + 21 - bottom_vpos )/2 > 0)
1100 {
1101 post_blanklines += (c_vpos + 21 - bottom_vpos) /2 ;
1102 bottom_vpos += 2 * post_blanklines ;
1103 }
1104 }
1105
1106 DPRINTF("cut_im_color_swath: shifted bottom_limit=%d, bottom_vpos=%d\n",
1107 bottom_limit - vpos_shift, bottom_vpos) ;
1108
1109 /* sweep_offset is the difference in vertical position
1110 of consecutive color and black sweeps.
1111 Flashing lights happen on the HP820 if this
1112 is -3, -2, -1, 1 , 2 or 3! */
1113
1114 /* compare to last black vpos */
1115 sweep_offset = bottom_vpos - b_vpos ;
1116
1117 if ( ( sweep_offset >= -4 ) &&
1118 ( sweep_offset < 4 ) &&
1119 ( (sweep_offset !=0 ) || at_bottom ))
1120 {
1121 if ( (at_bottom) &&
1122 ( b_vpos + 2 * ((5 - sweep_offset ) / 2) < top_vpos + 2 * ( maxlines - 1 ) ) )
1123 {
1124 /* we are at bottom of page, and can add post_blanklines */
1125 post_blanklines += ( 5 - sweep_offset ) /2 ;
1126 }
1127 else
1128 {
1129 /* we are in the middle of the page ;
1130 add pre_blanklines to shift swath end up */
1131 if ( sweep_offset == 3 )
1132 {
1133 /* shift swath upward to vpos - 7 */
1134 pre_blanklines = 5;
1135 }
1136 else if ( sweep_offset == 2 )
1137 {
1138 /* shift swath upward to vpos - 6 */
1139 pre_blanklines = 4;
1140 }
1141 else if ( sweep_offset == 1 )
1142 {
1143 /* shift swath upward to vpos - 7 */
1144 pre_blanklines = 4;
1145 }
1146 else if ( sweep_offset == -1 )
1147 {
1148 /* shift swath upward to vpos -7 */
1149 pre_blanklines = 3;
1150 }
1151 else if ( sweep_offset == -2 )
1152 {
1153 /* shift swath upward to vpos -6 */
1154 pre_blanklines = 2;
1155 }
1156 else if ( sweep_offset == -3 )
1157 {
1158 /* shift swath upward to vpos - 7 */
1159 pre_blanklines = 2;
1160 }
1161 else if ( sweep_offset == -4 )
1162 {
1163 /* shift swath upward to vpos - 6 */
1164 pre_blanklines = 1;
1165 }
1166 }
1167 }
1168 /*will add pre_blanklines blank lines at the top of the swath
1169 and post_blanklines at the end of the swath.
1170 Note that allowance has been made for a possible
1171 extra post_blankline to compensate for odd numlines */
1172 break;
1173 }
1174 }
1175 }
1176
1177 if (got_nonblank)
1178 {
1179 /* find left-most nonblank */
1180 for (i = left_limit * 3; i < left * 3; i++)
1181 {
1182 // fprintf(stderr, "left: %d ", i);
1183 if ((data[gMaxPass - 1][width8 * 3 * numlines + i]))
1184 {
1185 left = i / 3;
1186 break;
1187 }
1188 }
1189 /* find right-most nonblank */
1190 for (j = right_limit * 3 - 1 ; j > right * 3 + 2 ; j--)
1191 {
1192 // fprintf(stderr, "right: %d ", i);
1193 if ((data[gMaxPass - 1][width8 * 3 * numlines + j]))
1194 {
1195 right = j / 3;
1196 break;
1197 }
1198 }
1199 numlines++;
1200 }
1201 }
1202
1203 if ((image->buflines >= MAXBUFFLINES) && (image->buftype == bitmap))
1204 {
1205 DPRINTF
1206 ("cut_im_color_swath: exceeding buffer size: image.buflines=%d, MAX=%d\n",
1207 image->buflines, MAXBUFFLINES);
1208 if ((!got_nonblank))
1209 {
1210 for (k = 0; k < gMaxPass; k++)
1211 free (data[k]);
1212 return 3;
1213 }
1214 }
1215
1216
1217 if ((!got_nonblank))
1218 {
1219 /* eat all lines that are below the lower margin */
1220 if (image->colorCurLine >= bottom_limit)
1221 {
1222 while (image->colorCurLine < image->height)
1223 if (!im_color_readline (image, data, 0))
1224 {
1225 snprintf(syslog_message,message_size,"cut_im_color_swath(): %s",
1226 gMessages[E_CS_BADBOTMARG]);
1227 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1228
1229 for (k = 0; k < gMaxPass; k++)
1230 {
1231 free (data[k]); //mocho
1232 }
1233 return 0;
1234 }
1235 for (k = 0; k < gMaxPass; k++)
1236 {
1237 free (data[k]); //mocho
1238 }
1239 DPRINTF
1240 ("cut_im_color_swath: return 1 on line %d; ccl: %d; height: %d\n",
1241 __LINE__, image->colorCurLine, bottom_limit );
1242 return 1;
1243 }
1244 for (k = 0; k < gMaxPass; k++)
1245 {
1246 free (data[k]); //mocho
1247 }
1248 return 0;
1249 /* error, since didn't get to lower margin, yet blank */
1250 }
1251
1252 sweep_data->vertical_pos = image->colorCurLine + printer->ColBwOffsY ;
1253
1254 /* subtract that 600 dot adjustment here */
1255 sweep_data->vertical_pos -= vpos_shift;
1256
1257 DPRINTF("cut_im_color_swath: end swath, line %d numlines=%d left=%d right=%d\n",
1258 image->colorCurLine, numlines, left, right ) ;
1259
1260
1261
1262 /* calculate number of blank lines added at top and bottom of swath */
1263
1264 non_blanklines = numlines ;
1265 numlines += pre_blanklines ;
1266 if ( (numlines + post_blanklines) % 2 )
1267 post_blanklines++ ;
1268 numlines += post_blanklines ;
1269 assert (maxlines >= numlines );
1270 sweep_data->vertical_pos += 2 * post_blanklines ;
1271
1272
1273 even_pre_blanklines = odd_pre_blanklines = pre_blanklines / 2 ;
1274 even_non_blanklines = odd_non_blanklines = non_blanklines / 2 ;
1275 even_post_blanklines = odd_post_blanklines = post_blanklines / 2 ;
1276
1277 start_even= 0;
1278 start_odd = 1;
1279
1280 if ( (pre_blanklines %2 == 0) &&
1281 !(non_blanklines % 2 == 0) &&
1282 !(post_blanklines % 2 == 0))
1283 {
1284 even_non_blanklines++ ;
1285 odd_post_blanklines++;
1286 start_even= 0;
1287 start_odd = 1;
1288 }
1289 if ( !(pre_blanklines %2 == 0) &&
1290 !(non_blanklines % 2 == 0) &&
1291 (post_blanklines % 2 == 0))
1292 {
1293 even_pre_blanklines++;
1294 odd_non_blanklines++;
1295 start_even= 1;
1296 start_odd = 0;
1297 }
1298 if ( !(pre_blanklines %2 == 0) &&
1299 (non_blanklines % 2 == 0) &&
1300 !(post_blanklines % 2 == 0))
1301 {
1302 even_pre_blanklines++;
1303 odd_post_blanklines++;
1304 start_even= 1;
1305 start_odd = 0;
1306 }
1307
1308
1309 assert ( numlines % 2 == 0);
1310 assert (( even_pre_blanklines +
1311 even_non_blanklines +
1312 even_post_blanklines ) == numlines/2 );
1313 assert (( odd_pre_blanklines +
1314 odd_non_blanklines +
1315 odd_post_blanklines ) == numlines/2 );
1316
1317
1318 if (pre_blanklines)
1319 {
1320 DPRINTF("cut_im_color_swath: offset %d; add pre_blanklines=%d lines\n",
1321 sweep_offset, pre_blanklines);
1322 }
1323 if (post_blanklines)
1324 {
1325 DPRINTF("cut_im_color_swath: offset %d; add post_blanklines=%d lines\n",
1326 sweep_offset, post_blanklines);
1327 }
1328
1329
1330 /* printing in the leftmost and rightmost bytes of the color
1331 * swath leads to problems, so expand the swath width to avoid
1332 * using these locations. Nothing will ever get printed in these
1333 * expanded ends of the swath. (They are either whitespace,
1334 * or outside the limits, where data is rejected below)
1335 */
1336 left -= 2;
1337 right += 3;
1338 p_width8 = right - left ;
1339
1340 /* enforce a minimum swath width of 8 bytes */
1341 if ( p_width8 < 8 )
1342 {
1343 if (left > left_limit + 8 )
1344 left = left - 8 + p_width8 ;
1345 else
1346 right = right + 8 - p_width8 ;
1347 }
1348 p_width8 = right - left ;
1349
1350 /* always left-to-right if gUnimode is true */
1351 if (gUnimode)
1352 sweep_data->direction = left_to_right;
1353 else if ((b_vpos > c_vpos) && (b_vpos < sweep_data->vertical_pos))
1354 {
1355 if (b_dir == left_to_right)
1356 sweep_data->direction = right_to_left;
1357 else
1358 sweep_data->direction = left_to_right;
1359 } else
1360 {
1361 if (c_dir == left_to_right)
1362 sweep_data->direction = right_to_left;
1363 else
1364 sweep_data->direction = left_to_right;
1365 }
1366
1367 DPRINTF("cut_im_color_swath: b_left %d b_right %d b_vpos %d b_dir %d\n",
1368 b_left, b_right, b_vpos, b_dir);
1369 DPRINTF("cut_im_color_swath: prev c_left %d c_right %d c_vpos %d c_dir %d\n",
1370 c_left, c_right, c_vpos, c_dir);
1371 DPRINTF("cut_im_color_swath: cur left %d right %d vpos %d dir %d\n",
1372 left, right, sweep_data->vertical_pos, sweep_data->direction);
1373 c_left = left;
1374 c_right = right;
1375 c_vpos = sweep_data->vertical_pos;
1376 c_dir = sweep_data->direction;
1377
1378
1379 for (k = 0; k < gMaxPass; k++)
1380 {
1381 if ((ppa = malloc ( (p_width8 + 3 ) * numlines * 3)) == NULL)
1382 {
1383 snprintf(syslog_message,message_size,"cut_im_color_swath(): %s",
1384 gMessages[E_CS_BADPPAMALLOC]);
1385 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1386
1387 for (k = 0; k < gMaxPass; k++)
1388 free (data[k]);
1389 return 0;
1390 }
1391
1392 place = ppa;
1393
1394 if (sweep_data->direction == right_to_left)
1395 {
1396 for (i = (p_width8 + 1) * 6 - 1 ; i >= 0; i--)
1397 {
1398 int color, x, odd, y ;
1399 j = (p_width8 + 1) * 6 - 1 - i ;
1400 if (i < Left_size )
1401 {
1402 if (!GET_USABLE (Left_r2l, i))
1403 {
1404 memset (place, 0x00, numlines / 2);
1405 place += numlines / 2;
1406 continue;
1407 }
1408 odd = GET_ODD (Left_r2l, i );
1409 color = GET_COLOR (Left_r2l, i);
1410 x = GET_X (Left_r2l, i );
1411 }
1412 else if (j < Right_size )
1413 {
1414 if (!GET_USABLE (Right_r2l,j))
1415 {
1416 memset (place, 0x00, numlines / 2);
1417 place += numlines / 2;
1418 continue;
1419 }
1420 color = GET_COLOR (Right_r2l, j);
1421 odd = GET_ODD (Right_r2l, j);
1422 x = p_width8 - 3 - GET_X (Right_r2l, j);
1423 }
1424 else
1425 {
1426 color = (i / 2 - 15) % 3;
1427 odd = (i + 1) % 2;
1428 x = (i - 24) / 6 - 1 + odd + (color == 0 ? 0 :/* cyan */
1429 color == 1 ? 4 :/* magenta */
1430 8); /* yellow */
1431 }
1432 if (x + left < left_limit || x + left >= right_limit)
1433 {
1434 /* never print data that is outside the limits */
1435 memset (place, 0x00, numlines / 2);
1436 place += numlines / 2;
1437 }
1438 else
1439 {
1440 int new_pre_blanklines , new_non_blanklines , new_post_blanklines;
1441 int new_start;
1442 if (odd)
1443 {
1444 /* odd lines */
1445 new_pre_blanklines = odd_pre_blanklines ;
1446 new_non_blanklines = odd_non_blanklines ;
1447 new_post_blanklines = odd_post_blanklines ;
1448 new_start = start_odd;
1449 }
1450 else
1451 {
1452 /* even lines */
1453 new_pre_blanklines = even_pre_blanklines ;
1454 new_non_blanklines = even_non_blanklines ;
1455 new_post_blanklines = even_post_blanklines ;
1456 new_start = start_even;
1457 }
1458 if ( new_pre_blanklines > 0 )
1459 {
1460 /* first pre_blanklines lines are blank */
1461 memset(place, 0x00, new_pre_blanklines ) ;
1462 place += new_pre_blanklines ;
1463 }
1464 for (y = 0; y < new_non_blanklines ; y++)
1465 {
1466 int index ;
1467 index = ( (y * 2 + new_start) * width8 * 3 +
1468 (x + left ) * 3 + color ) ;
1469
1470 if (index >= (width8 * 3 * maxlines ))
1471 {
1472 DPRINTF ("index out of range! index = %d\n", index);
1473 index = (width8 * 3 * maxlines ) - 1;
1474 }
1475
1476 assert ( index < width8 * 3 * maxlines && index >= 0 );
1477 *place++ = data[k][index];
1478 }
1479 if ( new_post_blanklines > 0 )
1480 {
1481 /* last post_blanklines lines are blank */
1482 memset(place, 0x00, new_post_blanklines ) ;
1483 place += new_post_blanklines ;
1484 }
1485 }
1486 }
1487
1488 }
1489 else /* sweep direction is left-to-right */
1490 {
1491 for (i = 0; i < (p_width8 + 1) * 6 ; i++)
1492 {
1493 int color, x, odd, y;
1494 j = (p_width8 + 1) * 6 - 1 - i ;
1495 if (i < Left_size)
1496 {
1497 if (!GET_USABLE (Left_l2r, i))
1498 {
1499 memset (place, 0x00, numlines / 2);
1500 place += numlines / 2;
1501 continue;
1502 }
1503 color = GET_COLOR (Left_l2r, i);
1504 odd = GET_ODD (Left_l2r, i);
1505 x = GET_X (Left_l2r, i);
1506 }
1507 else if ( j < Right_size )
1508 {
1509 if (!GET_USABLE (Right_l2r, j))
1510 {
1511 memset (place, 0x00, numlines / 2);
1512 place += numlines / 2;
1513 continue;
1514 }
1515 color = GET_COLOR (Right_l2r, j);
1516 odd = GET_ODD (Right_l2r, j);
1517 x = p_width8 -3 - GET_X (Right_l2r,j);
1518 }
1519 else
1520 {
1521 color = (i / 2 - 15) % 3;
1522 odd = i % 2;
1523 x = (i - 24) / 6 - 1 + odd + (color == 0 ? 0 :/* cyan */
1524 color == 1 ? 4 :/* magenta */
1525 8); /* yellow */
1526 }
1527 if (x + left < left_limit || x + left >= right_limit)
1528 {
1529 /* never print data that is outside the limits */
1530 memset (place, 0x00, numlines / 2);
1531 place += numlines / 2;
1532 }
1533 else
1534 {
1535 int new_pre_blanklines , new_non_blanklines , new_post_blanklines;
1536 int new_start;
1537 if (odd)
1538 {
1539 /* odd lines */
1540 new_pre_blanklines = odd_pre_blanklines ;
1541 new_non_blanklines = odd_non_blanklines ;
1542 new_post_blanklines = odd_post_blanklines ;
1543 new_start = start_odd;
1544 }
1545 else
1546 {
1547 /* even lines */
1548 new_pre_blanklines = even_pre_blanklines ;
1549 new_non_blanklines = even_non_blanklines ;
1550 new_post_blanklines = even_post_blanklines ;
1551 new_start = start_even;
1552 }
1553 if ( new_pre_blanklines > 0 )
1554 {
1555 /* first pre_blanklines lines are blank */
1556 memset (place, 0x00, new_pre_blanklines ) ;
1557 place += new_pre_blanklines ;
1558 }
1559 for (y = 0; y < new_non_blanklines; y++)
1560 {
1561 int index ;
1562 index = ((y * 2 + new_start) * width8 * 3 +
1563 (x + left ) * 3 + color);
1564
1565 if (index >= (width8 * 3 * maxlines + 8))
1566 {
1567 DPRINTF ("index out of range! index = %d\n",index);
1568 index = (width8 * 3 * maxlines + 8) - 1;
1569 }
1570
1571 assert ( index < width8 * 3 * maxlines + 8 && index >= 0 );
1572 *place++ = data[k][index];
1573 }
1574 if ( new_post_blanklines > 0 )
1575 {
1576 /* last post_blanklines lines are blank */
1577 memset(place, 0x00, new_post_blanklines) ;
1578 place += new_post_blanklines ;
1579 }
1580 }
1581 }
1582 }
1583 maxplace = place;
1584
1585 /* create sweep data */
1586 sweep_data->image_data[k] = ppa;
1587 }
1588
1589 sweep_data->data_size = maxplace - ppa;
1590 sweep_data->in_color = true;
1591
1592 horzpos = (left - 7) * 8 * 2 + printer->ColBwOffsX - 600 ;
1593
1594 horzpos += (sweep_data->direction == left_to_right) ? 2 : 12 ;
1595
1596 if (sweep_data->direction == right_to_left )
1597 horzpos += printer->r2l_col_offset ; /*correct bidirectional shearing*/
1598
1599 hp2 = 16 + horzpos + p_width8 * 2 * 8;
1600 sweep_data->left_margin = horzpos;
1601 sweep_data->right_margin = hp2 + 0x74; /* printer->color_marg_diff */
1602
1603 DPRINTF("sweep data: left_margin = %d, right margin = %d\n",
1604 sweep_data->left_margin, sweep_data->right_margin);
1605
1606 for (i = 0; i < 6; i++)
1607 {
1608 nozzles[i].DPI = 300;
1609 nozzles[i].pins_used_d2 = numlines / 2;
1610 nozzles[i].unused_pins_p1 = 65 - numlines;
1611 nozzles[i].first_pin = 1;
1612 if (i == 0)
1613 {
1614 nozzles[i].left_margin = horzpos + 0x74;
1615 nozzles[i].right_margin = hp2 + 0x74;
1616 if (sweep_data->direction == right_to_left)
1617 nozzles[i].nozzle_delay = 0;
1618 else
1619 nozzles[i].nozzle_delay = 0;
1620 }
1621 if (i == 1)
1622 {
1623 nozzles[i].left_margin = horzpos + 0x64;
1624 nozzles[i].right_margin = hp2 + 0x64;
1625 if (sweep_data->direction == right_to_left)
1626 nozzles[i].nozzle_delay = 0;
1627 else
1628 nozzles[i].nozzle_delay = 0;
1629 }
1630 if (i == 2)
1631 {
1632 nozzles[i].left_margin = horzpos + 0x3A;
1633 nozzles[i].right_margin = hp2 + 0x3A;
1634 if (sweep_data->direction == right_to_left)
1635 nozzles[i].nozzle_delay = 0x0A;
1636 else
1637 nozzles[i].nozzle_delay = 0x0A;
1638 }
1639 if (i == 3)
1640 {
1641 nozzles[i].left_margin = horzpos + 0x3A;
1642 nozzles[i].right_margin = hp2 + 0x3A;
1643 if (sweep_data->direction == right_to_left)
1644 nozzles[i].nozzle_delay = 0x0A;
1645 else
1646 nozzles[i].nozzle_delay = 0x0A;
1647
1648 }
1649 if (i == 4)
1650 {
1651 nozzles[i].left_margin = horzpos + 0x10;
1652 nozzles[i].right_margin = hp2 + 0x10;
1653 if (sweep_data->direction == right_to_left)
1654 nozzles[i].nozzle_delay = 0x04;
1655 else
1656 nozzles[i].nozzle_delay = 0x04;
1657
1658 }
1659 if (i == 5)
1660 {
1661 nozzles[i].left_margin = horzpos + 0x00;
1662 nozzles[i].right_margin = hp2 + 0x00;
1663 if (sweep_data->direction == right_to_left)
1664 nozzles[i].nozzle_delay = 0x04;
1665 else
1666 nozzles[i].nozzle_delay = 0x04;
1667
1668 }
1669 }
1670
1671 sweep_data->nozzle_data_size = 6;
1672 sweep_data->nozzle_data = malloc (sizeof (nozzles));
1673 if (sweep_data->nozzle_data == NULL)
1674 return 0;
1675 memcpy (sweep_data->nozzle_data, nozzles, sizeof (nozzles));
1676
1677 DPRINTF ("cut_im_color_swath: return 2 on line %d\n", __LINE__);
1678
1679 for (k = 0; k < gMaxPass; k++)
1680 free (data[k]);
1681
1682 return 2;
1683
1684 }
1685
1686 /*
1687
1688 Here, we should call cut_im_black_swath and cut_im_color_swath to begin.
1689
1690 Then, we need to determine which of these swaths comes earlier on the page
1691 and print it first. Then we should re-call the appropriate cut_im_*_swath
1692 function to refill that buffer and repeat this procedure.
1693
1694 */
1695
1696
1697 int
1698 ppa_print_page (ppaPrinter_t *printer, image_t *image)
1699 {
1700 ppaSweepData_t sweeps[3], *curblack, *curcolor, *prev, *tmp;
1701 int reload[2] = { 1, 1 };
1702 int done[2] = { 0, 0 };
1703 int k,found[2];
1704 int firstfound;
1705 int color_maxlines=64, black_maxlines=300;
1706
1707
1708 /* note: a full-size (all nozzles) color swath is 64 even lines (300dpi);
1709 a full-size (all nozzles) black swath is 300 lines (150 even + 150 odd);
1710 is is necessary to restrict black swath to 128 lines (64 even + 64 odd)
1711 on some printer models, when printing in dual inks, color+black ?
1712 HP7x0: NO, but there is some artifact at the begining of
1713 each black swath that does not immediately follow a black
1714 swath. (see the calibrate_ppa --align output....)
1715 so leave the setting at 128 in gColorMode for now.
1716 (duncan, 2000-10-24)
1717 HP820: YES flashes lights ... (maybe it will work if what
1718 produces the artifacts on HP7x0 is fixed..?)
1719 HP1000: ?
1720 */
1721
1722 switch (printer->version)
1723 {
1724 case HP7X0:
1725 black_maxlines=300;
1726 color_maxlines=64;
1727 if (gColorMode)
1728 black_maxlines = color_maxlines * 2 ;
1729 break;
1730 case HP820:
1731 black_maxlines=300;
1732 color_maxlines=64;
1733 if (gColorMode)
1734 black_maxlines = color_maxlines * 2 ;
1735 break;
1736 case HP1000:
1737 black_maxlines=300;
1738 color_maxlines=64;
1739 if (gColorMode)
1740 black_maxlines = color_maxlines * 2 ;
1741 break;
1742 default:
1743 break;
1744 }
1745
1746 DPRINTF("ppa_print_page(): black_maxlines=%d, color_blacklines=%d\n",
1747 black_maxlines, color_maxlines );
1748
1749 /* initialize vertical position markers, etc. */
1750 c_vpos = b_vpos = 0;
1751
1752 firstfound=0;
1753
1754 curblack = &sweeps[0];
1755 curcolor = &sweeps[1];
1756
1757 prev = NULL;
1758
1759 DPRINTF ("ppa_print_page: chkpt 1\n");
1760
1761
1762
1763 /* note: the bidirectional print sweep code is not
1764 quite perfect as not every right-to-left sweep gets
1765 followed by a left-to-right sweep. However, the empirical
1766 choices below for the initialization of
1767 sweeps[2].direction seem to make the opposite direction
1768 sweeps come after each other, most of the time. Different
1769 choices were needed in gColorMode and !gColorMode... (duncan)
1770 */
1771
1772
1773 sweeps[0].direction = left_to_right;
1774 sweeps[0].next = NULL;
1775 sweeps[1].direction = left_to_right;
1776 sweeps[1].next = NULL;
1777 sweeps[2].direction = right_to_left;
1778 sweeps[2].next = NULL;
1779
1780 if ( !gColorMode)
1781 {
1782 done[1] = 1;
1783 sweeps[0].direction = right_to_left;
1784 sweeps[1].direction = left_to_right;
1785 sweeps[2].direction = left_to_right;
1786 }
1787
1788 sweeps[1].next = NULL;
1789 found[0]=found[1]=0;
1790
1791 while (!done[0] || !done[1])
1792 {
1793
1794 DPRINTF("ppa_print_page: statistics follows\n");
1795 DPRINTF("done[0]=%d\tdone[1]=%d\nreload[0]=%d\treload[1]=%d\nfound[0]=%d\tfound[1]=%d\n",
1796 done[0],done[1],reload[0],reload[1],found[0],found[1]);
1797
1798 if (reload[0])
1799 {
1800 reload[0] = 0;
1801
1802 switch (cut_im_black_swath (image, printer, black_maxlines, curblack))
1803 {
1804 case 0:
1805 snprintf(syslog_message,message_size,"ppa_print_page(): %s cut_im_black_swath()",
1806 gMessages[E_CS_ERROR]);
1807 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1808 return 1;
1809 break;
1810 case 1:
1811 done[0] = 1;
1812 break;
1813 case 2:
1814 found[0]=1;
1815 if (!firstfound)
1816 {
1817 firstfound=1;
1818 curcolor->direction=right_to_left;
1819 }
1820 break;
1821 case 3:
1822 reload[0]=1;
1823 found[0]=0;
1824 break;
1825 default:
1826 snprintf(syslog_message,message_size,"ppa_print_page(): %s",
1827 gMessages[E_CS_BADSWITCH]);
1828 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1829 return 1;
1830 }
1831 }
1832 if (reload[1] && !done[1])
1833 {
1834 reload[1] = 0;
1835 switch (cut_im_color_swath (image, printer, color_maxlines, curcolor))
1836 {
1837 case 0:
1838 snprintf(syslog_message,message_size, "ppa_print_page(): %s cut_im_color_swath()",
1839 gMessages[E_CS_ERROR]);
1840 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1841 break;
1842 return 1;
1843 case 1:
1844 DPRINTF("ppa_print_page: cut_im_color_swath returned 1\n");
1845 done[1] = 1;
1846 break;
1847 case 2:
1848 found[1]=1;
1849 if (!firstfound)
1850 {
1851 firstfound=1;
1852 curblack->direction=right_to_left;
1853 }
1854 break;
1855 case 3:
1856 reload[1]=1;
1857 found[1]=0;
1858 break;
1859 default:
1860 snprintf(syslog_message,message_size,"ppa_print_page(): %s ",
1861 gMessages[E_CS_BADSWITCH]);
1862 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1863 return 1;
1864 }
1865 }
1866
1867 if (done[0] && done[1])
1868 break;
1869
1870 if ( (!done[0] && found[0] &&
1871 (done[1] || !found[1] || curblack->vertical_pos < curcolor->vertical_pos)) )
1872
1873 {
1874 DPRINTF("ppa_print_page: chkpt 2\n");
1875
1876 reload[0] = 1;
1877 DPRINTF("ppa_print_page: chkpt 3\n");
1878 if (prev)
1879 {
1880 prev->next = curblack;
1881 DPRINTF("ppa_print_sweep 1\n");
1882 ppa_print_sweep (printer, prev);
1883 for (k = 0; k < gMaxPass; k++)
1884 free (prev->image_data[k]);
1885 free (prev->nozzle_data);
1886 }
1887 else
1888 prev = &sweeps[2];
1889
1890 /* move the current sweep into the 'prev' position */
1891 tmp = curblack;
1892 curblack = prev;
1893 prev = tmp;
1894 }
1895 else
1896 if ( (!done[1] && found[1]) ) // && (done[0] || !found[0] ||curblack->vertical_pos > curcolor->vertical_pos)))
1897 {
1898 DPRINTF("ppa_print_page: chkpt 4 \n");
1899
1900 reload[1] = 1;
1901
1902 if (prev)
1903 {
1904 prev->next = curcolor;
1905 DPRINTF("ppa_print_sweep 2\n");
1906 ppa_print_sweep (printer, prev);
1907 for (k = 0; k < gMaxPass; k++)
1908 free (prev->image_data[k]);
1909 free (prev->nozzle_data);
1910 }
1911 else
1912 prev = &sweeps[2];
1913
1914 tmp = curcolor;
1915 curcolor = prev;
1916 prev = tmp;
1917 }
1918 }
1919
1920 DPRINTF ("ppa_print_page: chkpt 5\n");
1921
1922 if (prev)
1923 {
1924 DPRINTF ("ppa_print_page: chkpt 6 about to clear prev\n");
1925
1926 prev->next = NULL;
1927 DPRINTF ("ppa_print_sweep 3\n");
1928 ppa_print_sweep (printer, prev);
1929 for (k = 0; k < gMaxPass; k++)
1930 free (prev->image_data[k]);
1931 free (prev->nozzle_data);
1932 DPRINTF ("ppa_print_page: chkpt 7 cleared prev\n");
1933 }
1934
1935 DPRINTF ("ppa_print_page: chkpt 8 Finish.\n");
1936
1937 for (k=0; k < gMaxPass; k++)
1938 free(image->buffer[k]);
1939
1940 return 0;
1941 }
0 /***************************************************************************
1 debug.c - debug support routines for pnm2ppa
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Andrew van der Stock
5 email : ajv@greebo.net
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifdef DEBUG
18
19 #include <stdio.h>
20 #include <stdarg.h>
21
22 #define __DEBUG_C__
23
24 #include "debug.h"
25
26 void
27 DPRINTF (char *format, ...)
28 {
29 va_list p;
30
31 va_start (p, format);
32 vfprintf (stderr, format, p);
33 va_end (p);
34 }
35
36 #endif
0 /***************************************************************************
1 debug.h - debug header
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Andrew van der Stock
5 email : ajv@greebo.net
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _DEBUG_H_
18 #define _DEBUG_H_
19
20 #ifdef DEBUG
21
22 /* debugging macros */
23
24 /* debugging routines */
25 void DPRINTF (char *format, ...);
26
27 #else
28
29 /* removal routines */
30
31 #define DPRINTF if(1){}else printf
32
33 #endif
34
35 #endif
0 /***************************************************************************
1 defaults.h - contains model-specific defaults for various parameters
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _DEFAULTS_H
18 #define _DEFAULTS_H
19
20 /* Refer to CALIBRATION file about these settings */
21
22 #define MAXPRNNAMELEN 64
23
24 typedef enum
25 {
26 NOPRINTER = 0xff,
27 HP7X0 = 0,
28 HP820,
29 HP1000
30 }
31 printerModel_t;
32
33 typedef struct
34 {
35 printerModel_t model;
36 char name[MAXPRNNAMELEN];
37 char friendlyname[MAXPRNNAMELEN];
38 int ColBwOffsX;
39 int ColBwOffsY;
40 int x_offset;
41 int y_offset;
42 int r2l_bw_offset;
43 int r2l_col_offset;
44 int top_margin;
45 int bottom_margin;
46 int left_margin;
47 int right_margin;
48 int marg_diff;
49 size_t bufsize;
50 int min_pagewidth;
51 int max_pagewidth;
52 int min_pageheight;
53 int max_pageheight;
54 }
55 printerDefault_t;
56
57 #ifdef __PNM2PPA_C__
58
59 // we only initialise the once
60
61 printerDefault_t gPrinterDefaults[] = {
62 {
63 HP7X0,
64 "HP7x0",
65 "HP 710C, 712C, 720C, 722C Series Printers",
66 -5, /* colxoff */
67 43, /* colyoff */
68 160, /* x_offset */
69 50, /* y_offset */
70 0, /* r2l_bw_offset */
71 0, /* r2l_col_offset */
72 10, /* top_margin */
73 150, /* bottom_margin */
74 10, /* left_margin */
75 10, /* right_margin */
76 2, /* margin difference */
77 200 * 1024, /* buffer size */
78 1800, /* min pagewidth 3" */
79 5100, /* max pagewidth 8.5"*/
80 1800, /* min pageheight 3" */
81 8400 /* max pageheight 14" */
82 },
83 {
84 HP820,
85 "HP820",
86 "HP 820 Series Printers",
87 35, /* colxoff */
88 43, /* colyoff */
89 160, /* x_offset */
90 50, /* y_offset */
91 0, /* r2l_bw_offset */
92 0, /* r2l_col_offset */
93 80, /* top_margin */
94 150, /* bottom_margin */
95 80, /* left_margin */
96 80, /* right_margin */
97 0x62, /* margin difference */
98 200 * 1024, /* buffer size */
99 1800, /* min pagewidth 3" */
100 5100, /* max pagewidth 8.5"*/
101 1800, /* min pageheight 3" */
102 8400 /* max pageheight 14" */
103 },
104 {
105 HP1000,
106 "HP1000",
107 "HP 1000 Series Printers",
108 35, /* colxoff */
109 43, /* colyoff */
110 160, /* x_offset */
111 50, /* y_offset */
112 0, /* r2l_bw_offset */
113 0, /* r2l_col_offset */
114 10, /* top_margin */
115 150, /* bottom_margin */
116 10, /* left_margin */
117 10, /* right_margin */
118 0x62, /* margin difference */
119 200 * 1024, /* buffer size */
120 2400, /* min pagewidth 4" */
121 7800, /* max pagewidth 13" */
122 3600, /* min pageheight 6" */
123 11400 /* max pageheight 19" */
124 },
125 {
126 NOPRINTER,
127 "",
128 "",
129 0, /* colxoff */
130 0, /* colyoff */
131 0, /* x_off */
132 0, /* y_off */
133 0, /* r2l_bw_offset */
134 0, /* r2l_col_offset */
135 0, /* top */
136 0, /* bottom */
137 0, /* left */
138 0, /* right */
139 0, /* margin difference */
140 0, /* buffer size */
141 0, /* min pagewidth */
142 0, /* max pagewidth */
143 0, /* min pageheight */
144 0 /* max pageheight */
145 }
146 };
147
148 #else
149 extern printerDefault_t *gPrinterDefaults;
150 #endif
151
152 #endif
153
154
155
156
157
158
159
0 /***************************************************************************
1 dither.c - floyd-steinberg & halftone dither routines
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #include <stdio.h>
18 #include <assert.h>
19
20 #define __DITHER_C__
21
22 #include "global.h"
23 #include "debug.h"
24
25 #include "image.h"
26 #include "fscoeff.h"
27 #include "palette.h"
28 #include "hash_ink.h"
29
30 int
31 ink_lookup(int R, int G, int B, int MaxPass,
32 float *d, int *bx, int *by, int *bz, int *br, int *bg, int *bb)
33 { /* Try to find correct color value in hashed structure instead of
34 * exhaustive search in (MaxPass+1)^3 ink possibilities */
35
36 struct hash_ink **arr = 0, *cur;
37 int r, g, b, h;
38 float d1;
39 int shift = 0; /* Keep the compiler quiet! */
40
41 /* *d = -1; */
42 if (MaxPass == 4) /* standard mode */
43 {
44 arr = arr_max4;
45 shift = shift4;
46 }
47 else if (MaxPass == 1) /* --eco mode */
48 {
49 arr = arr_max1;
50 shift = shift1;
51 }
52 /* Add here other supported MaxPass arrays */
53
54 if (arr == 0) /* not supported MaxPass value by int_lookup() */
55 return 0;
56
57 r = R >> shift;
58 g = G >> shift;
59 b = B >> shift;
60
61 h = (r << (16 - shift * 2)) + (g << (8-shift)) + (b);
62 /* h e [0, 4096> for shift = 4 */
63
64 cur = arr[h];
65
66 while( cur != 0 )
67 /* the code added below is an edited copy of the code found below
68 in FS_Color_Dither */
69 {
70 r = (int) R - (int) cur->data[0];
71 g = (int) G - (int) cur->data[1];
72 b = (int) B - (int) cur->data[2];
73
74 d1 = /* 0.5 * */ r * r + g * g + b * b;
75
76
77 if (d1 <= *d)
78 {
79 *d = d1;
80 *bx = gMaxPass + 1 - cur->x;
81 *by = gMaxPass + 1 - cur->y;
82 *bz = gMaxPass + 1 - cur->z;
83 *br = r;
84 *bg = g;
85 *bb = b;
86 }
87
88 cur = cur->next;
89 }
90
91 return MaxPass;
92 }
93
94 void
95 FS_Color_Dither (image_t *image, unsigned char *line)
96 {
97 short dd;
98 int i, i_max ;
99 int x, bx, y, by, z, bz;
100 float d, d1;
101 int R, G, B, dr, dg, db;
102 int br, bg, bb, r, g, b, oldr, oldb, oldg;
103 static short *err_coeff_e = 0;
104 static short *err_coeff_se = 0;
105 static short *err_coeff_s = 0;
106 static short *err_coeff_sw = 0;
107 int MaxPass = 0;
108 int *error;
109
110 if (image->bufferCurLine % 2 == 1)
111 {
112 error = gErrVec_bw;
113 }
114 else
115 {
116 error = gErrVec;
117 MaxPass = gMaxPass;
118 }
119
120 r = g = b = dr = dg = db = 0;
121 br = r;
122 bg = g;
123 bb = b;
124
125 if (err_coeff_e == NULL)
126 {
127 err_coeff_e = fs_err_coeff_e + 255;
128 err_coeff_se = fs_err_coeff_se + 255;
129 err_coeff_s = fs_err_coeff_s + 255;
130 err_coeff_sw = fs_err_coeff_sw + 255;
131
132 dd = 25;
133
134 for (i = -255; i < 256; i++)
135 {
136 err_coeff_e[i] = i * 8 / dd; //8
137 err_coeff_se[i] = i * 5 / dd; //5
138 err_coeff_s[i] = i * 8 / dd; //8
139 err_coeff_sw[i] = i * 4 / dd; //4
140 }
141 }
142
143 /* Only even lines are treated for color ;
144 pixels are treated in pairs, and
145 reduced to 300dpi resolution */
146
147 i_max = image->width * 3 ;
148
149 if (image->bufferCurLine % 2 == 0)
150 {
151 /*treatment of even lines */
152 for (i = 0; i < i_max ; i += 6)
153 {
154
155 oldr = br;
156 oldb = bb;
157 oldg = bg;
158
159 br = bg = bb = 0;
160
161 /* avoid the (0,0,0) entry for black if
162 * no match is found (initial d too small)
163 * use (1,1,1) instead (gMaxPass drops of each color)
164 */
165 bx = by = bz = 1 ;
166
167 /* if either of a pair of successive pixels is black,
168 make both black (produces 300dpi black resolution) */
169 if ( (i+3) != i_max)
170 {
171 if ( !line[i + 3] && !line[i + 4] && !line[i + 5] )
172 line[i]= line[i + 1] = line[i + 2] = 0 ;
173 }
174
175 if ( !line[i] && !line[i + 1] && !line[i + 2] )
176 {
177 /* pixel is black */
178 error[i + 0] = 0;
179 error[i + 1] = 0;
180 error[i + 2] = 0;
181 dr = dg = db = 0;
182 /* make next pixel black, too */
183 if ( (i + 3) != i_max )
184 {
185 line[i + 3] = line[i + 4] = line[i + 5] = 0 ;
186 }
187 }
188 else
189 if (((line[i] < 255) || (line[i + 1] < 255)
190 || (line[i + 2] < 255)))
191 {
192 /* pixel is colored */
193
194 /*
195 find the "requested color by considering previous
196 errors
197 */
198
199
200 R =
201 gEnh_curve_r[(int) (line[i] + line[i + 3]) / 2] +
202 error[i] + dr;
203 R = (R < 0 ? 0 : R);
204 R = (R > 255 ? 255 : R);
205 G =
206 gEnh_curve_g[(int) (line[(i + 1)] + line[i + 4]) / 2] +
207 error[i + 1] + dg;
208 G = (G < 0 ? 0 : G);
209 G = (G > 255 ? 255 : G);
210 B =
211 gEnh_curve_b[(int) (line[(i + 2)] + line[i + 5]) / 2] +
212 error[i + 2] + db;
213 B = (B < 0 ? 0 : B);
214 B = (B > 255 ? 255 : B);
215
216
217
218 /*
219 * now convert this RGB value to drops of ink per pixel.
220 * The table is set up as a hashing table .
221 */
222
223
224 if (!gGammaMode)
225 {
226 // yet another fine mocho fix! :-)
227 br = R / 2;
228 bg = G / 2;
229 bb = B / 2;
230 //d = ((2.0 + (float)R / 256.0) * R * R + 4 * G * G + (2 + (255.0 - (float)R) / 256.0) * B * B)*0.7;
231
232 if (gMaxPass == 4)
233 {
234 d = (R * R + G * G + B * B) * 1.3;
235 }
236 else
237 {
238 /* does the "1.3" need adjusting for gMaxPass = 1?
239 * This sets "very dark" pixels to black.
240 */
241 d = (R * R + G * G + B * B) * 1.3;
242 }
243 }
244 else
245 {
246 /* this is for the special case when gamma.ppm is
247 * being generated.
248 */
249 d = 2147483647; //just a large initial value
250 }
251
252 #ifdef CHECK_HASHING
253 {
254 /* code for checking correctness of hash_ink (by ink_lookup)
255 Not sensible in production code! */
256 int sbx, sby, sbz, sbr, sbg, sbb;
257 float sd;
258 int s_result;
259
260 sd = d;
261 sbx = bx;
262 sby = by;
263 sbz = bz;
264 sbr = br;
265 sbg = bg;
266 sbb = bb;
267
268 s_result = ink_lookup(R, G, B, MaxPass,
269 &sd, &sbx, &sby, &sbz, &sbr, &sbg, &sbb);
270 #else
271 if (! ink_lookup(R, G, B, MaxPass,
272 &d, &bx, &by, &bz, &br, &bg, &bb))
273 {
274 /* ink_lookup failed -- so use old code as fallback */
275 static int unsupported_flag = 0;
276
277 if (unsupported_flag != MaxPass)
278 {
279 unsupported_flag = MaxPass;
280 DPRINTF("WARNING:Unsupported MaxPass value %d by ink_lookup\n", MaxPass);
281 }
282 #endif
283 /* this code scans the 625 (gMaxPass=4) or
284 * 8 (gMaxPass=1) possible combinations of
285 * (z,y,x) drops of (Cyan,Magenta,Yellow) ink
286 * to best match the RGB value for the pixel,
287 * using the tabulated values in hp_pal
288 * in pallette.h
289 */
290
291 for (z = 0; z < MaxPass + 1; z++)
292 for (x = 0; x < MaxPass + 1; x++)
293 for (y = 0; y < MaxPass + 1; y++)
294 if (!
295 (((x == 4) && (y > 2) && (z > 2)) ||
296 ((y == 4) && (x > 2) && (z > 2)) ||
297 ((z == 4) && (y > 2) && (x > 2))))
298
299 {
300
301 //rmean = ((int) R + (int) hp_pal[4-x][4-y][4-z][0]) / 2;
302
303 r =
304 (int) R - (int) hp_pal[4 - x][4 - y][4 -
305 z]
306 [0];
307 g =
308 (int) G - (int) hp_pal[4 - x][4 - y][4 -
309 z]
310 [1];
311 b =
312 (int) B - (int) hp_pal[4 - x][4 - y][4 -
313 z]
314 [2];
315
316 //d1 = (2.0 + (float)rmean / 256.0) * r * r +
317 // 4 * g * g +
318 // (2 + (255.0 - (float)rmean) / 256.0) * b * b;
319
320 d1 = /* 0.5 * */ r * r + g * g + b * b;
321
322 /* the next test also excludes "too dark"
323 * pixels with a small initial d value.
324 */
325
326 if (d1 <= d)
327 {
328 d = d1;
329 bx = gMaxPass + 1 - x;
330 by = gMaxPass + 1 - y;
331 bz = gMaxPass + 1 - z;
332 br = r;
333 bg = g;
334 bb = b;
335 }
336 }
337 #ifdef CHECK_HASHING
338 if (s_result != 0)
339 {
340 /* if (d != sd)
341 debug( R, G, B, d, gMaxPass + 1 - bx,
342 gMaxPass + 1 - by, gMaxPass + 1 - bz ); */
343 assert(d == sd);
344 /* The assertions below are deleted; there might
345 be equivalent solutions (w.r.t. distance d)
346 with different values for bx, by, bz
347 assert(sbx == bx);
348 assert(sby == by);
349 assert(sbz == bz);
350 assert(br == sbr);
351 assert(bg == sbg);
352 assert(bb == sbb); */
353 }
354 }
355 #else
356 }
357 #endif
358
359
360 if ( true /* || (bx==0 && by==0 && bz==0) */ )
361 {
362 // careful! floats cannot be compared easily
363 if (!(d == 0.0) && ((i + 8) < image->width * 3))
364 {
365
366 dr = err_coeff_e[br];
367 dg = err_coeff_e[bg];
368 db = err_coeff_e[bb];
369
370 error[i + 0] = err_coeff_s[br];
371 error[i + 1] = err_coeff_s[bg];
372 error[i + 2] = err_coeff_s[bb];
373
374 if (i > 3)
375 {
376 error[i - 6] += err_coeff_sw[br];
377 error[i - 5] += err_coeff_sw[bg];
378 error[i - 4] += err_coeff_sw[bb];
379 }
380
381 }
382 else
383 error[i + 0] = error[i + 1] =
384 error[i + 2] = dr = dg = db = 0;
385 }
386
387 /*
388 *Put in line[...] the times each color component
389 *have to be printed
390 * gMaxPass + 1 - bz = number of drops of Cyan
391 * gMaxPass + 1 - by = number of drops of Magenta
392 * gMaxPass + 1 - bx = number of drops of Yellow
393 */
394
395 line[i] = (unsigned char) bz;
396 line[i + 1] = (unsigned char) by;
397 line[i + 2] = (unsigned char) bx;
398 if ((i + 3) != i_max)
399 {
400 line[i + 3] = line[i];
401 line[i + 4] = line[i + 1];
402 line[i + 5] = line[i + 2];
403 }
404 }
405
406 else
407 {
408 /* pixel is white */
409 error[i + 0] = error[i + 1] = error[i + 2] = dr = dg = db = 0;
410 line[i] = line[i + 1] = line[i + 2] = 255;
411 if ( (i + 3) != i_max)
412 {
413 /* white out next pixel, */
414 line[i + 3] = line[i + 4] = line[i + 5] = 255;
415 }
416 }
417 if (i < image->width * 3 - 8)
418 {
419 error[i] += err_coeff_se[oldr];
420 error[i + 1] += err_coeff_se[oldg];
421 error[i + 2] += err_coeff_se[oldb];
422 }
423
424 }
425 }
426 else
427 {
428 /* treatment of odd lines (black only) */
429 for (i = 0; i < i_max ; i += 6)
430 {
431 /* if either of two successive pixels are black,
432 make both black */
433 if ( (i+3) != i_max)
434 {
435 if ( !line[i + 3] && !line[i + 4] && !line[i + 5] )
436 line[i] = line[i + 1] = line[i + 2] = 0;
437 else if ( !line[i] && !line[i + 1] && !line[i + 2] )
438 line[i + 3] = line[i + 4] = line[i + 5] = 0;
439 }
440 /* white out non-black pixels */
441
442 if ( line[i] || line[i + 1] || line[i + 2] )
443 {
444 line[i] = line[i + 1] = line [i + 2] = 255 ;
445 if ( (i+3) != i_max )
446 line[i + 3] = line[i + 4] = line [i + 5] = 255 ;
447 }
448
449 }
450 }
451 }
452
453 void
454 HT_Black_Dither (image_t *image, unsigned char *line)
455 {
456 int i, j, k, i_max;
457
458 unsigned int halftone[5][5] = {
459 {120, 180, 450, 270, 30},
460 {240, 510, 720, 600, 330},
461 {420, 630, 750, 660, 390},
462 {360, 570, 690, 540, 210},
463 {60, 300, 480, 150, 90}
464 };
465
466 i_max = image->width * 3;
467 j = 0;
468 k = image->bufferCurLine % 5;
469 for (i = 0; i < i_max; i += 3)
470 {
471
472 /* make black pixels come in pairs */
473 if ( !(i % 6) && (i + 3) != i_max )
474 {
475 if (!line[i] && !line[i + 1] && !line[i + 2] )
476 line[i + 3] = line [i + 4] = line[i + 5] = 0;
477 else
478 if (!line[i + 3] && !line[i + 4] && !line[i + 5] )
479 line[i] = line [i + 1] = line[i + 2] = 0;
480 }
481
482
483 if ( line[i] + line[i + 1] + line[i + 2] < halftone[j][k])
484 {
485 line[i] = line[i + 1] = line[i + 2] = 0;
486 }
487
488 else
489 {
490 line[i] = line[i + 1] = line[i + 2] = 255;
491 }
492 if (j == 4)
493 j = 0;
494 else
495 j++;
496 }
497 }
498
499 void
500 HT_Color_Dither (image_t *image, unsigned char *line)
501 {
502 int i = 0, i_max;
503
504 unsigned char halftoner[5][5] = {
505 {40, 60, 150, 90, 10},
506 {80, 170, 240, 200, 110},
507 {140, 210, 250, 220, 130},
508 {120, 190, 230, 180, 70},
509 {20, 100, 160, 50, 30}
510 };
511 unsigned char halftoneg[5][5] = {
512 {40, 80, 140, 120, 20},
513 {60, 170, 210, 190, 100},
514 {150, 240, 250, 230, 160},
515 {90, 200, 220, 180, 50},
516 {10, 110, 130, 70, 30}
517 };
518 unsigned char halftoneb[5][5] = {
519 {100, 230, 220, 110, 40},
520 {60, 160, 180, 130, 80},
521 {150, 50, 70, 140, 170},
522 {240, 90, 30, 120, 210},
523 {200, 10, 20, 190, 250}
524 };
525
526 /* Only even lines are evaluated ;
527 pixels are treated in pairs, and
528 reduced to 300dpi resolution */
529
530
531 i_max = image->width * 3 ;
532
533 if (image->bufferCurLine % 2 == 0)
534 {
535 /* treatment of even lines */
536 for (i = 0; i < i_max ; i += 6)
537 {
538
539 /* if either of two successive pixels are black, make both black */
540 if ( (i+3) != i_max)
541 {
542 if ( !line[i + 3] && !line[i + 4] && !line[i + 5] )
543 line[i] = line[i + 1] = line[i + 2] = 0;
544 }
545
546
547 if (line[i] || line[i + 1] || line[i + 2])
548 if (image->bufferCurLine % 2 == 0)
549 {
550 if (line[i] < halftoner[i % 5][image->bufferCurLine % 5])
551 line[i] = 1;
552 else
553 line[i] = 255;
554 if (line[i + 1] < halftoneg[i % 5][image->bufferCurLine % 5])
555 line[i + 1] = 1;
556 else
557 line[i + 1] = 255;
558 if (line[i + 2] < halftoneb[i % 5][image->bufferCurLine % 5])
559 line[i + 2] = 1;
560 else
561 line[i + 2] = 255;
562 }
563 if ( (i+3) != i_max)
564 {
565 line[i + 3] = line[i];
566 line[i + 4] = line[i + 1];
567 line[i + 5] = line[i + 2];
568 }
569 }
570 }
571 else
572 {
573 /* treatment of odd lines (black only) */
574 for (i = 0; i < i_max ; i += 6)
575 {
576 /* if either of two successive pixels are black,
577 make both black */
578 if ( (i+3) != i_max)
579 {
580 if ( !line[i + 3] && !line[i + 4] && !line[i + 5] )
581 line[i] = line[i + 1] = line[i + 2] = 0;
582 else if ( !line[i] && !line[i + 1] && !line[i + 2] )
583 line[i + 3] = line[i + 4] = line[i + 5] = 0;
584 }
585
586 /* white out non-black pixels */
587 if ( line[i] || line[i + 1] || line[i + 2] )
588 {
589 line[i] = line[i + 1] = line [i + 2] = 255 ;
590 if ( (i+3) != i_max )
591 line[i + 3] = line[i + 4] = line [i + 5] = 255 ;
592 }
593
594 }
595 }
596 }
597
598
599
0 /***************************************************************************
1 dither.h - function prototypes for dither.c
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _DITHER_H
18 #define _DITHER_H
19
20 void FS_Color_Dither (image_t * im, unsigned char *line);
21 void HT_Black_Dither (image_t * im, unsigned char *line);
22 void HT_Color_Dither (image_t * im, unsigned char *line);
23
24 #endif /* ; */
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1 <HTML>
2 <HEAD>
3 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
4 <TITLE>PPA Printer calibration for pnm2ppa</TITLE>
5
6
7 </HEAD>
8 <BODY>
9 Next
10 Previous
11 Contents
12 <HR>
13 <H1>PPA Printer calibration for pnm2ppa</H1>
14
15 <H2>The pnm2ppa project team
16 <A HREF="mailto:ppa-rpms@sourceforge.net">ppa-rpms@users.sourceforge.net</A></H2>v0.4, October 28, 2000
17 <P><HR>
18 <EM>Information and instructions
19 for printer calibration using pnm2ppa.
20 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>
21 (Updated for pnm2ppa-1.02 and later.)</EM>
22 <HR>
23 <P><B> Overview of Printer Calibration.</B>
24 <P>There are three main tasks you may need to carry out to fine-tune
25 your PPA printer:
26 <UL>
27 <LI>Adjust the x-offset and y-offset to <B>correctly center
28 the printed page on the paper</B></LI>
29 <LI>Adjust the relative offsets between black and colored ink
30 printing - <B>this should be done each time you replace an ink
31 cartridge</B>.</LI>
32 <LI> Match the colors of printed images to some other output device
33 - this is <B>color correction</B> and is
34 described in
35 <A HREF="./COLOR.html">COLOR.html</A> (or COLOR.txt).</LI>
36 </UL>
37 <P>These instructions assume that you are already able to print postscript
38 files with your PPA printer. If your print filters
39 are properly configured, something like &quot;<CODE>lpr test.ps</CODE>&quot;
40 will successfully invoke ghostscript and pnm2ppa
41 to print the postscript file test.ps. Alternatively, you may be using
42 shell scripts like &quot;lprbw&quot;, &quot;lprcolor&quot;
43 and &quot;lpreco&quot; supplied with the
44 pnm2ppa source code, and modified by you for your defaults; you may also
45 have defined special printing devices in <CODE>/etc/printcap</CODE>, e.g.
46 a &quot;coloreco&quot; device so you print
47 with <CODE>lpr -P coloreco test.ps</CODE>. These details vary with
48 the operating system and distribution you use.
49 <P>
50 <P><B> (1) Centering the printed page on the paper. </B>
51 <P>This is done by adjusting the x-offset and y-offset parameters
52 <B>xoffset</B> and <B>yoffset</B>
53 in the <CODE>pnm2ppa</CODE> configuration file (usually
54 <CODE>/etc/pnm2ppa.conf</CODE>). The parameters are given in units of
55 1/600 inch; increasing <CODE>xoffset</CODE> moves the image
56 to the right, and increasing <CODE>yoffset</CODE> moves it downwards.
57 These offsets now have default values defined for each printer model,
58 and you will probably not need to adjust them.
59 Uncomment and make small adjustments to the default
60 values for these in the configuration file, until the printout is satisfactory.
61 (You can also use the '-x' and '-y'
62 command-line parameters.)
63 <P>
64 <P>There are two ways to check the offsets.
65 <UL>
66 <LI>either <B>using the "<CODE>calibrate_ppa</CODE>" program.</B> </LI>
67 <LI>or <B>printing a suitable test page</B>.
68 </LI>
69 </UL>
70 <P>
71 <P>The "<CODE>calibrate_ppa</CODE>" program is a
72 stand-alone program distributed with <CODE>pnm2ppa</CODE> which
73 creates various test patterns in the raw
74 pixmap format accepted by pnm2ppa. (The three paper sizes,
75 US Letter, US Legal, and A4, are supported).
76 If your paper size is A4, and your printer filter accepts
77 the "<CODE>-l</CODE>" (direct output) option to <CODE>lpr</CODE>,
78 the command to run is:
79 <BLOCKQUOTE><CODE>
80 <PRE>
81 calibrate_ppa -s a4 --center | pnm2ppa --bw -i - -o - | lpr -l
82 </PRE>
83 </CODE></BLOCKQUOTE>
84
85 (Substitute "letter" or "legal" for "a4" to change
86 the papersize; if no paper size is specified, it is assumed to
87 be <CODE>letter</CODE>.)
88 <P>
89 <P>
90 <P>If "<CODE>lpr -l</CODE>" is not valid, you need to know which port your
91 printer is attached to. Assuming it is <CODE>/dev/lp0</CODE>, the above
92 command becomes
93 <CODE> calibrate_ppa -s a4 --center | pnm2ppa --bw -i - -o /dev/lp0</CODE>.
94 <P>
95 <P>The pattern shows distances from the edge of the printed page
96 in units of 50 dots (1/12 inch), and diagonal lines that should
97 point to the corners. Change <CODE>xoffset</CODE> and <CODE>yoffset</CODE>
98 in the configuration file (usually <CODE>/etc/pnm2ppa.conf</CODE>
99 to center the pattern. The configuration file is
100 supplied with commented-out entries like
101 <CODE>#xoffset 160</CODE> showing the default value. Remove
102 the &quot;<CODE>#</CODE>&quot; to activate the entry.
103 <P>In Red Hat or Mandrake Linux distributions, a suitable test page is
104 <CODE>/usr/lib/rhs/rhs-printfilters/testpage.ps</CODE>
105 (US Letter paper) or
106 <CODE>/usr/lib/rhs/rhs-printfilters/testpage-a4.ps</CODE>
107 (A4 paper). (If these are not available, similar test pages
108 are supplied in the pnm2ppa source distribution.)
109 These pages have margins drawn at standard distances from the
110 edges of the paper, and can also be used to check the centering,
111 but are not as accurate
112 <P>
113 <P>
114 <P>
115 <P><B> (2) Calibrating the X and Y Color Head Offsets. </B>
116 <P>The color ink offsets now have to be calibrated with respect to the black ink.
117 Because the relative position of the two ink cartridges
118 can move slightly,
119 <B>this must be done whenever an ink cartridge is removed and replaced</B>.
120 <P>To print an alignment calibration pattern on a4 paper, run
121 <BLOCKQUOTE><CODE>
122 <PRE>
123 calibrate_ppa -s a4 --align | pnm2ppa --fd -i - -o - | lpr -l
124 </PRE>
125 </CODE></BLOCKQUOTE>
126 <P>On the printed page, there are four alignment patterns,
127 corresponding to configuration file
128 parameters <B>ColOffsX</B>, <B>ColOffsY</B>, <B>colorshear</B>
129 and <B>blackshear</B>. The central alignment patterns,
130 labelled &quot;0&quot; should be perfectly aligned. If they are
131 not, first
132 correct the shearing patterns, (see below).
133 Then identify the best-aligned <B>ColOffsX</B>
134 and <B>ColOffsY</B> patterns, and add or subtract the
135 positive or negative number below the pattern from the value in
136 the configuration file.
137 <P>Check the result by printing the alignment test pattern:
138 <BLOCKQUOTE><CODE>
139 <PRE>
140 calibrate_ppa --test | pnm2ppa -fd -i - -o - | lpr -l
141 </PRE>
142 </CODE></BLOCKQUOTE>
143
144 The lines in the cross and square should be perfectly straight now.
145 <P>The calibration can also be done by printing the test page
146 <CODE>test.ps</CODE> (found in the tarball
147 <CODE>pnm2ppa-1.0.tar.gz</CODE>; or installed
148 with the <CODE>pnm2ppa</CODE> documentation. (This is often in
149 <CODE>/usr/doc/pnm2ppa*/</CODE>.)
150 <P>On the printout you see several images:
151 <UL>
152 <LI>top left, you see a square with both black and colored items.
153 These should align correctly, or you have to change your settings.</LI>
154 <LI>You see a large vertical bar, and also a horizontal bar.
155 On the sides of the vertical bar there are a blue and a green line.
156 These should align with the 0 mark.</LI>
157 <LI> You also see a small vertical, and horizontal, bar, with a
158 red bar on its side.</LI>
159 </UL>
160 <P>If these items do NOT line up, you should take the following steps:
161 <UL>
162 <LI>(1) take for the large bar the number of the tickmark just smaller
163 than the place where the green and blue lines point to. The minor
164 tick marks are 25 points.</LI>
165 <LI>(2) To this number, add the number of the tick mark at which a red tick
166 mark exactly lines up. This might not work if the offsets are way off;
167 in that case, apply the correction of step 1, and print again.</LI>
168 <LI>(3) Add the horizontal offset to the value
169 of <B>ColOffsX</B>, and the vertical offset to
170 the value of <B>ColOffsY</B> in the configuration file.</LI>
171 </UL>
172 <P>Now you can print test.ps again to see whether this procedure worked.
173 <P>
174 <P><B>Shearing adjustments</B>
175 <P>If bidirectional printing causes &quot;shearing&quot; of vertical lines
176 (horizontal offsets of those parts of the line printed
177 by left-to-right print-head sweeps relative to those printed on
178 right-to-left sweeps) you can make small adjustments (in 1/600 inch)
179 units using the <B>blackshear</B> and <B>colorshear</B>
180 parameters in the configuration file. You can also suppress
181 bidirectional printing with a <B>unimode 1</B>
182 configuration file entry.
183 <P>The third and fourth lines on the color head offset calibration page
184 (see above) correspond to color and black print head shearing corrections.
185 If the central alignment patterns (labeled &quot;0&quot;)
186 are not aligned, add or subtract the positive or negative number
187 below the best-aligned pattern from the <CODE>colorshear</CODE>
188 and <CODE>blackshear</CODE> values in the configuration file.
189 <P><B>Cleaning the Print Heads</B>
190 <P>You can use <CODE>calibrate_ppa</CODE> to clean the print heads by
191 printing patterns that exercise all the ink nozzles:
192 <BLOCKQUOTE><CODE>
193 <PRE>
194 calibrate_ppa --clean | pnm2ppa -p -i - -o - | lpr -l
195 calibrate_ppa --clean | pnm2ppa --bw -i - -o - | lpr -l
196 </PRE>
197 </CODE></BLOCKQUOTE>
198
199 The first of these commands prints a cleaning pattern
200 with colored ink, the second uses black ink.
201 <P>
202 <P><B>Other adjustments</B>
203 <P>The parameter <B>blackness</B> adjusts the number of black ink
204 drops printed per pixel. It takes values 1, 2, 3, or 4 (2 is the
205 default). Other values, like 0, suppress black ink.
206 <P>Inks can also be suppressed by configuration file
207 entries
208 <CODE>black_ink 0</CODE>,
209 <CODE>color_ink 0</CODE>,
210 <CODE>cyan_ink 0</CODE>,
211 <CODE>magenta_ink 0</CODE>,
212 or <CODE>yellow_ink 0</CODE>.
213 These are mainly useful for debugging
214 the printer driver.
215 <P>
216 <HR>
217 Next
218 Previous
219 Contents
220 </BODY>
221 </HTML>
0 PPA Printer calibration for pnm2ppa
1 The pnm2ppa project team ppa-rpms@users.sourceforge.net
2 v0.4, October 28, 2000
3
4 Information and instructions for printer calibration using pnm2ppa.
5 http://sourceforge.net/projects/pnm2ppa (Updated for pnm2ppa-1.02 and
6 later.)
7
8 OOvveerrvviieeww ooff PPrriinntteerr CCaalliibbrraattiioonn..
9
10 There are three main tasks you may need to carry out to fine-tune your
11 PPA printer:
12
13 +o Adjust the x-offset and y-offset to ccoorrrreeccttllyy cceenntteerr tthhee pprriinntteedd
14 ppaaggee oonn tthhee ppaappeerr
15
16 +o Adjust the relative offsets between black and colored ink printing
17 - tthhiiss sshhoouulldd bbee ddoonnee eeaacchh ttiimmee yyoouu rreeppllaaccee aann iinnkk ccaarrttrriiddggee.
18
19 +o Match the colors of printed images to some other output device -
20 this is ccoolloorr ccoorrrreeccttiioonn and is described in COLOR.html (or
21 COLOR.txt).
22
23 These instructions assume that you are already able to print
24 postscript files with your PPA printer. If your print filters are
25 properly configured, something like "lpr test.ps" will successfully
26 invoke ghostscript and pnm2ppa to print the postscript file test.ps.
27 Alternatively, you may be using shell scripts like "lprbw", "lprcolor"
28 and "lpreco" supplied with the pnm2ppa source code, and modified by
29 you for your defaults; you may also have defined special printing
30 devices in /etc/printcap, e.g. a "coloreco" device so you print with
31 lpr -P coloreco test.ps. These details vary with the operating
32 system and distribution you use.
33
34
35 ((11)) CCeenntteerriinngg tthhee pprriinntteedd ppaaggee oonn tthhee ppaappeerr..
36
37 This is done by adjusting the x-offset and y-offset parameters xxooffffsseett
38 and yyooffffsseett in the pnm2ppa configuration file (usually
39 /etc/pnm2ppa.conf). The parameters are given in units of 1/600 inch;
40 increasing xoffset moves the image to the right, and increasing
41 yoffset moves it downwards. These offsets now have default values
42 defined for each printer model, and you will probably not need to
43 adjust them. Uncomment and make small adjustments to the default
44 values for these in the configuration file, until the printout is
45 satisfactory. (You can also use the '-x' and '-y' command-line
46 parameters.)
47
48
49 There are two ways to check the offsets.
50
51 +o either uussiinngg tthhee ""calibrate_ppa" program.
52
53 +o or pprriinnttiinngg aa ssuuiittaabbllee tteesstt ppaaggee.
54
55
56 The "calibrate_ppa" program is a stand-alone program distributed with
57 pnm2ppa which creates various test patterns in the raw pixmap format
58 accepted by pnm2ppa. (The three paper sizes, US Letter, US Legal, and
59 A4, are supported). If your paper size is A4, and your printer filter
60 accepts the "-l" (direct output) option to lpr, the command to run is:
61
62
63 calibrate_ppa -s a4 --center | pnm2ppa --bw -i - -o - | lpr -l
64
65
66 (Substitute "letter" or "legal" for "a4" to change the papersize; if
67 no paper size is specified, it is assumed to be letter.)
68
69
70
71 If "lpr -l" is not valid, you need to know which port your printer is
72 attached to. Assuming it is /dev/lp0, the above command becomes
73 calibrate_ppa -s a4 --center | pnm2ppa --bw -i - -o /dev/lp0.
74
75
76 The pattern shows distances from the edge of the printed page in
77 units of 50 dots (1/12 inch), and diagonal lines that should point to
78 the corners. Change xoffset and yoffset in the configuration file
79 (usually /etc/pnm2ppa.conf to center the pattern. The configuration
80 file is supplied with commented-out entries like #xoffset 160 showing
81 the default value. Remove the "#" to activate the entry.
82
83 In Red Hat or Mandrake Linux distributions, a suitable test page is
84 /usr/lib/rhs/rhs-printfilters/testpage.ps (US Letter paper) or
85 /usr/lib/rhs/rhs-printfilters/testpage-a4.ps (A4 paper). (If these
86 are not available, similar test pages are supplied in the pnm2ppa
87 source distribution.) These pages have margins drawn at standard
88 distances from the edges of the paper, and can also be used to check
89 the centering, but are not as accurate
90
91
92
93
94 ((22)) CCaalliibbrraattiinngg tthhee XX aanndd YY CCoolloorr HHeeaadd OOffffsseettss..
95
96 The color ink offsets now have to be calibrated with respect to the
97 black ink. Because the relative position of the two ink cartridges
98 can move slightly, tthhiiss mmuusstt bbee ddoonnee wwhheenneevveerr aann iinnkk ccaarrttrriiddggee iiss
99 rreemmoovveedd aanndd rreeppllaacceedd.
100
101 To print an alignment calibration pattern on a4 paper, run
102
103
104 calibrate_ppa -s a4 --align | pnm2ppa --fd -i - -o - | lpr -l
105
106
107
108
109 On the printed page, there are four alignment patterns, corresponding
110 to configuration file parameters CCoollOOffffssXX, CCoollOOffffssYY, ccoolloorrsshheeaarr and
111 bbllaacckksshheeaarr. The central alignment patterns, labelled "0" should be
112 perfectly aligned. If they are not, first correct the shearing
113 patterns, (see below). Then identify the best-aligned CCoollOOffffssXX and
114 CCoollOOffffssYY patterns, and add or subtract the positive or negative
115 number below the pattern from the value in the configuration file.
116
117 Check the result by printing the alignment test pattern:
118
119
120 calibrate_ppa --test | pnm2ppa -fd -i - -o - | lpr -l
121
122
123
124
125 The lines in the cross and square should be perfectly straight now.
126
127 The calibration can also be done by printing the test page test.ps
128 (found in the tarball pnm2ppa-1.0.tar.gz; or installed with the
129 pnm2ppa documentation. (This is often in /usr/doc/pnm2ppa*/.)
130
131
132 On the printout you see several images:
133
134 +o top left, you see a square with both black and colored items.
135 These should align correctly, or you have to change your settings.
136
137 +o You see a large vertical bar, and also a horizontal bar. On the
138 sides of the vertical bar there are a blue and a green line.
139 These should align with the 0 mark.
140
141 +o You also see a small vertical, and horizontal, bar, with a red bar
142 on its side.
143
144 If these items do NOT line up, you should take the following steps:
145
146 +o (1) take for the large bar the number of the tickmark just smaller
147 than the place where the green and blue lines point to. The minor
148 tick marks are 25 points.
149
150 +o (2) To this number, add the number of the tick mark at which a red
151 tick mark exactly lines up. This might not work if the offsets are
152 way off; in that case, apply the correction of step 1, and print
153 again.
154
155 +o (3) Add the horizontal offset to the value of CCoollOOffffssXX, and the
156 vertical offset to the value of CCoollOOffffssYY in the configuration file.
157
158 Now you can print test.ps again to see whether this procedure worked.
159
160
161 SShheeaarriinngg aaddjjuussttmmeennttss
162
163 If bidirectional printing causes "shearing" of vertical lines
164 (horizontal offsets of those parts of the line printed by left-to-
165 right print-head sweeps relative to those printed on right-to-left
166 sweeps) you can make small adjustments (in 1/600 inch) units using the
167 bbllaacckksshheeaarr and ccoolloorrsshheeaarr parameters in the configuration file. You
168 can also suppress bidirectional printing with a uunniimmooddee 11
169 configuration file entry.
170
171 The third and fourth lines on the color head offset calibration page
172 (see above) correspond to color and black print head shearing
173 corrections. If the central alignment patterns (labeled "0") are not
174 aligned, add or subtract the positive or negative number below the
175 best-aligned pattern from the colorshear and blackshear values in the
176 configuration file.
177
178 CClleeaanniinngg tthhee PPrriinntt HHeeaaddss
179
180 You can use calibrate_ppa to clean the print heads by printing
181 patterns that exercise all the ink nozzles:
182
183
184 calibrate_ppa --clean | pnm2ppa -p -i - -o - | lpr -l
185 calibrate_ppa --clean | pnm2ppa --bw -i - -o - | lpr -l
186
187
188
189
190 The first of these commands prints a cleaning pattern with colored
191 ink, the second uses black ink.
192
193
194 OOtthheerr aaddjjuussttmmeennttss
195
196 The parameter bbllaacckknneessss adjusts the number of black ink drops printed
197 per pixel. It takes values 1, 2, 3, or 4 (2 is the default). Other
198 values, like 0, suppress black ink.
199
200 Inks can also be suppressed by configuration file entries black_ink 0,
201 color_ink 0, cyan_ink 0, magenta_ink 0, or yellow_ink 0. These are
202 mainly useful for debugging the printer driver.
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1 <HTML>
2 <HEAD>
3 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
4 <TITLE>Color correction for pnm2ppa</TITLE>
5
6
7 </HEAD>
8 <BODY>
9 Next
10 Previous
11 Contents
12 <HR>
13 <H1>Color correction for pnm2ppa</H1>
14
15 <H2>The pnm2ppa project team
16 <A HREF="mailto:ppa-rpms@sourceforge.net">ppa-rpms@users.sourceforge.net</A></H2> v0.6, October 28, 2000
17 <P><HR>
18 <EM>Information and instructions
19 for color correction of pnm2ppa
20 color printing.
21 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>
22 (Updated for pnm2ppa-1.0 and later.)</EM>
23 <HR>
24 <P><B> Overview of Color correction.</B>
25 <P>Color Pixmap input to <CODE>pnm2ppa</CODE> (ppm format, produced
26 by the ghostscript output devices <CODE>ppmraw</CODE> or <CODE>ppm</CODE>)
27 specifies the color of a pixel as three coordinates (Red, Green, Blue) in the
28 range 0-255. The program <CODE>pnm2ppa</CODE> converts these to relative amounts
29 of Cyan, Magenta and Yellow ink drops printed on the page.
30 <P><B>Color correction</B> allows the user to attempt to match the printed
31 colors to some reference colors, such as those displayed on the
32 terminal, or those printed on a different printer, or those printed
33 on the same printer with a different
34 driver (such as the Win9x drivers supplied by HP with their PPA printers).
35 <P>
36 <P>The color output from <CODE>pnm2ppa</CODE> can be controlled in two ways:
37 <UL>
38 <LI> by a color correction &quot;gamma&quot; file, if it is installed.
39 By default this file is
40 <CODE>/etc/pnm2ppa.gamma</CODE>,
41 but it may also be specified with the pnm2ppa option
42 <CODE> pnm2ppa ... -F gammafile ... </CODE>.</LI>
43 <LI> if there is no gamma file, by three values
44 specified by keywords ( either
45 <CODE>GammaR</CODE>,
46 <CODE>GammaG</CODE>,
47 <CODE>GammaB</CODE>
48 or
49 <CODE>RedGammaIdx</CODE>,
50 <CODE>BlueGammaIdx</CODE>,
51 <CODE>GreenGammaIdx</CODE>) in the
52 <CODE>pnm2ppa</CODE> configuration file.</LI>
53 </UL>
54 <P>
55 <P><CODE>pnm2ppa</CODE> will carry out <B>&quot;color correction&quot;</B>,
56 unless it is called with the <B>--noGamma</B> command line option.
57 However, unless you set up a color correction scheme, the default
58 color correction does not change any colors.
59 <P>
60 <P>Color correction is specified by three color intensity
61 functions (curves), one for each of
62 Red, Green, and Blue. In their simplest form, these curves
63 have a standard form controlled
64 by a single &quot;gamma&quot; parameter such as
65 <CODE>GammaR</CODE>. The more sophisticated correction, in the
66 file <CODE>pnm2ppa.gamma</CODE>, specifies these curves more generally
67 as a table of numbers that translate each possible
68 color intensity value to a new value.
69 <P>
70 <P>
71 <P>Note that, in principle, different color corrections are needed
72 for different print quality settings, and for different
73 brands and qualities of paper!
74 <P>At present the methods for constructing a color correction for
75 <CODE>pnm2ppa</CODE> are not very user-friendly. If you can improve
76 them, please help!.
77 <P><B>Color correction with &quot;gamma&quot; values in the configuration file.</B>
78 <P>The PixMap (ppa) format specifies colors by an intensity for
79 each primary color, Red, Green and Blue, in the range 0-255, so
80 (0,0,0) is black, and (255,255,255) is white.
81 The standard color intensity enhancement function replaces the ppm
82 intensity <CODE>i</CODE> of each primary color by
83 <CODE> Enh(i) </CODE> which is the closest integer
84 to ( i / 256) raised to the power
85 <CODE>Gamma</CODE>, times 256.
86 <P>
87 <P>You can specify the Gamma values in the configuration file
88 as decimal numbers <CODE>GammaR</CODE>, <CODE>GammaG</CODE>, <CODE>GammaB</CODE>,
89 but how do you find out what values to choose?. Perhaps by experimenting
90 with changing the Gamma values.
91 <P>A source of information on Gamma color correction is
92 <A HREF="http://www.cgsd.com/papers/gamma.html">www.cgsd.com/papers/gamma.html</A><P>
93 <P>One method for constructing a Gamma correction
94 has been built into <CODE>pnm2ppa</CODE>, but it
95 wastes quite a lot of ink, and many users
96 find it less effective than producing a customized
97 color correction curve as described in the next section.
98 <P>
99 <P>You must first use pnm2ppa to print a color test page, and then
100 generate a file <CODE>gamma.ppm</CODE> to compare to it.
101 To do this, type
102 <BLOCKQUOTE><CODE>
103 <PRE>
104 pnm2ppa -g -i - -o /dev/lp0
105 </PRE>
106 </CODE></BLOCKQUOTE>
107
108 (replace <CODE>/dev/lp0</CODE> by whatever printer device your PPA printer uses,
109 or use <CODE> ... -o - | lpr -l </CODE>, etc.). Note also that
110 as <CODE>pnm2ppa</CODE> is not receiving any ghostscript input to tell it
111 the paper size, this must be correctly specified by a configuration
112 file entry or, e.g., a <CODE> -s a4 </CODE> option, if the default US Letter
113 paper is not being used. This procedure will print a color calibration
114 page.
115 <P>The printed output is an array of sets of three colored bands,
116 red, blue and green, each of which increases in brightness from
117 left to right. The topmost set of bands should be referrred to as
118 bands &quot;0&quot;, the next ones as &quot;1&quot;, etc.
119 <P>Next, run the extra program <CODE>calibrate_ppa</CODE> which will produce
120 a (large, 10MB) PixMap (ppm) file:
121 <BLOCKQUOTE><CODE>
122 <PRE>
123 calibrate_ppa -g -o gamma.ppm
124 </PRE>
125 </CODE></BLOCKQUOTE>
126
127 This will produce the PixMap file as
128 <CODE>gamma.ppm</CODE> in the current directory.
129 <P>To color-correct the printer so that its colors match those on the
130 terminal screen,
131 you should now attempt to view the file <CODE>gamma.ppm</CODE>
132 using some application
133 (such as the GNU image manipulation program <CODE>gimp</CODE>, or <CODE>xv</CODE>)
134 that can view <CODE>.ppm</CODE> files. For each color, identify the
135 printed band (0, 1, 2, ... etc)
136 that most closely corresponds to the brightness profile
137 shown on the screen. The default values are now:
138 <BLOCKQUOTE><CODE>
139 <PRE>
140 RedGammaIdx 0
141 GreenGammaIdx 0
142 BlueGammaIdx 0
143 </PRE>
144 </CODE></BLOCKQUOTE>
145
146 (i.e., no color correction).
147 Enter your modified values for these in the <CODE>pnm2ppa</CODE>
148 configuration file (usually <CODE>/etc/pnm2ppa.conf</CODE>).
149 <P>The actual Gamma value is then <B>1.0 - 0.033*(Color)GammaIdx </B>;
150 <P>To color-correct with respect to another printer (or the Win9x drivers),
151 you must manage to print <CODE>gamma.ppm</CODE> on that other device, then
152 make the comparison. (Or print the output of <CODE>pnm2ppa -g </CODE>
153 on that device; the top line is the same uncorrected color data as
154 <CODE>gamma.ppm</CODE>.)
155 <P><B>Color correction using a &quot;gamma file&quot;.</B>
156 <P>A &quot;gamma correction file&quot; is a binary file containing
157 3 x 256 numbers,
158 which are lookup tables of corrected red green and blue
159 color intensities.
160 <P>The program <CODE>pnm2ppa</CODE> will use a default correction file
161 <CODE>/etc/pnm2ppa.gamma</CODE> if it exists, unless the
162 <CODE>--noGamma </CODE> option is used. The default correction file
163 location can be changed by using the <CODE>pnm2ppa</CODE>
164 option <CODE>-F gammafile </CODE>, where &quot;gammafile&quot; is the name
165 (including the full path) of the gamma correction file to be used.
166 <P>
167 <P>Currently, there are two available tools for constructing a gamma
168 correction file:
169 <UL>
170 <LI>A graphical utility <CODE>ppagammacorrect</CODE> is available in the
171 PPA Color Correction Utilities section of
172 the <CODE>pnm2ppa</CODE> web page
173 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>,
174 (but at the time of writing,
175 this appears to be frozen in early stages of development, with
176 little documentation, and may not be fully functional).</LI>
177 <LI>A working procedure is given in
178 <A HREF="http://download.sourceforge.net/pnm2ppa/color-calibrate-1.0.tar.gz">http://download.sourceforge.net/pnm2ppa/color-calibrate-1.0.tar.gz</A>,
179 which is made available by Klamer Schutte.
180 <B>This is the method recommended by many users.</B></LI>
181 </UL>
182 <P>
183 <HR>
184 Next
185 Previous
186 Contents
187 </BODY>
188 </HTML>
0 Color correction for pnm2ppa
1 The pnm2ppa project team ppa-rpms@users.sourceforge.net
2 v0.6, October 28, 2000
3
4 Information and instructions for color correction of pnm2ppa color
5 printing. http://sourceforge.net/projects/pnm2ppa (Updated for
6 pnm2ppa-1.0 and later.)
7
8 OOvveerrvviieeww ooff CCoolloorr ccoorrrreeccttiioonn..
9
10 Color Pixmap input to pnm2ppa (ppm format, produced by the ghostscript
11 output devices ppmraw or ppm) specifies the color of a pixel as three
12 coordinates (Red, Green, Blue) in the range 0-255. The program
13 pnm2ppa converts these to relative amounts of Cyan, Magenta and Yellow
14 ink drops printed on the page.
15
16 CCoolloorr ccoorrrreeccttiioonn allows the user to attempt to match the printed
17 colors to some reference colors, such as those displayed on the
18 terminal, or those printed on a different printer, or those printed
19 on the same printer with a different driver (such as the Win9x
20 drivers supplied by HP with their PPA printers).
21
22
23 The color output from pnm2ppa can be controlled in two ways:
24
25 +o by a color correction "gamma" file, if it is installed. By
26 default this file is /etc/pnm2ppa.gamma, but it may also be
27 specified with the pnm2ppa option
28 pnm2ppa ... -F gammafile ... .
29
30 +o if there is no gamma file, by three values specified by keywords
31 ( either GammaR, GammaG, GammaB or RedGammaIdx, BlueGammaIdx,
32 GreenGammaIdx) in the pnm2ppa configuration file.
33
34
35 pnm2ppa will carry out ""ccoolloorr ccoorrrreeccttiioonn"", unless it is called with
36 the ----nnooGGaammmmaa command line option. However, unless you set up a color
37 correction scheme, the default color correction does not change any
38 colors.
39
40
41 Color correction is specified by three color intensity functions
42 (curves), one for each of Red, Green, and Blue. In their simplest
43 form, these curves have a standard form controlled by a single "gamma"
44 parameter such as GammaR. The more sophisticated correction, in the
45 file pnm2ppa.gamma, specifies these curves more generally as a table
46 of numbers that translate each possible color intensity value to a new
47 value.
48
49
50
51 Note that, in principle, different color corrections are needed for
52 different print quality settings, and for different brands and
53 qualities of paper!
54
55 At present the methods for constructing a color correction for
56 pnm2ppa are not very user-friendly. If you can improve them, please
57 help!.
58
59 CCoolloorr ccoorrrreeccttiioonn wwiitthh ""ggaammmmaa"" vvaalluueess iinn tthhee ccoonnffiigguurraattiioonn ffiillee..
60
61 The PixMap (ppa) format specifies colors by an intensity for each
62 primary color, Red, Green and Blue, in the range 0-255, so (0,0,0) is
63 black, and (255,255,255) is white. The standard color intensity
64 enhancement function replaces the ppm intensity i of each primary
65 color by
66 Enh(i) which is the closest integer to ( i / 256) raised to the
67 power Gamma, times 256.
68
69
70 You can specify the Gamma values in the configuration file as decimal
71 numbers GammaR, GammaG, GammaB, but how do you find out what values to
72 choose?. Perhaps by experimenting with changing the Gamma values.
73
74 A source of information on Gamma color correction is
75 www.cgsd.com/papers/gamma.html
76
77
78 One method for constructing a Gamma correction has been built into
79 pnm2ppa, but it wastes quite a lot of ink, and many users find it less
80 effective than producing a customized color correction curve as
81 described in the next section.
82
83
84 You must first use pnm2ppa to print a color test page, and then
85 generate a file gamma.ppm to compare to it. To do this, type
86
87
88 pnm2ppa -g -i - -o /dev/lp0
89
90
91
92
93 (replace /dev/lp0 by whatever printer device your PPA printer uses, or
94 use ... -o - | lpr -l , etc.). Note also that as pnm2ppa is not
95 receiving any ghostscript input to tell it the paper size, this must
96 be correctly specified by a configuration file entry or, e.g., a -s
97 a4 option, if the default US Letter paper is not being used. This
98 procedure will print a color calibration page.
99
100 The printed output is an array of sets of three colored bands, red,
101 blue and green, each of which increases in brightness from left to
102 right. The topmost set of bands should be referrred to as bands "0",
103 the next ones as "1", etc.
104
105 Next, run the extra program calibrate_ppa which will produce a (large,
106 10MB) PixMap (ppm) file:
107
108
109 calibrate_ppa -g -o gamma.ppm
110
111
112
113
114 This will produce the PixMap file as gamma.ppm in the current direc-
115 tory.
116
117 To color-correct the printer so that its colors match those on the
118 terminal screen, you should now attempt to view the file gamma.ppm
119 using some application (such as the GNU image manipulation program
120 gimp, or xv) that can view .ppm files. For each color, identify the
121 printed band (0, 1, 2, ... etc) that most closely corresponds to the
122 brightness profile shown on the screen. The default values are now:
123
124
125 RedGammaIdx 0
126 GreenGammaIdx 0
127 BlueGammaIdx 0
128
129
130
131
132 (i.e., no color correction). Enter your modified values for these in
133 the pnm2ppa configuration file (usually /etc/pnm2ppa.conf).
134
135 The actual Gamma value is then 11..00 -- 00..003333**((CCoolloorr))GGaammmmaaIIddxx ;
136
137 To color-correct with respect to another printer (or the Win9x
138 drivers), you must manage to print gamma.ppm on that other device,
139 then make the comparison. (Or print the output of pnm2ppa -g on that
140 device; the top line is the same uncorrected color data as
141 gamma.ppm.)
142
143 CCoolloorr ccoorrrreeccttiioonn uussiinngg aa ""ggaammmmaa ffiillee""..
144
145 A "gamma correction file" is a binary file containing 3 x 256 numbers,
146 which are lookup tables of corrected red green and blue color
147 intensities.
148
149 The program pnm2ppa will use a default correction file
150 /etc/pnm2ppa.gamma if it exists, unless the --noGamma option is used.
151 The default correction file location can be changed by using the
152 pnm2ppa option -F gammafile , where "gammafile" is the name
153 (including the full path) of the gamma correction file to be used.
154
155
156 Currently, there are two available tools for constructing a gamma
157 correction file:
158
159 +o A graphical utility ppagammacorrect is available in the PPA Color
160 Correction Utilities section of the pnm2ppa web page
161 http://sourceforge.net/projects/pnm2ppa, (but at the time of
162 writing, this appears to be frozen in early stages of development,
163 with little documentation, and may not be fully functional).
164
165 +o A working procedure is given in
166 http://download.sourceforge.net/pnm2ppa/color-calibrate-1.0.tar.gz,
167 which is made available by Klamer Schutte. TThhiiss iiss tthhee mmeetthhoodd
168 rreeccoommmmeennddeedd bbyy mmaannyy uusseerrss..
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
0 CREDITS
1 -------
2
3 This project would not be where it is without the help of the following
4 people (in firstname alphabetical order):
5
6 Andrew van der Stock - rampant featuritis and general code enhancer since Sept 1999
7
8 Ben Boule - first contacted me about the 720 series and helped with testing
9
10 Duncan Haldane - Redhat doco, fixes, RH print filter, RPM maintainer;
11 extensive debugging of code, Jan-April 2000,
12
13 Giorgio Marzano - heaps of quality bug fixes and features since May 1999
14
15 Javier Sandano - hp-ppa-printing-howto
16
17 Jim Peterson - spent hours modifying the code for the 720 and adding lots of
18 features, including all the configurability options.
19
20 Kirk Reiten - helped with testing the 1000 series code
21
22 Klamer Schutte - Fixed calibrate.c to work with pnm2ppa
23
24 Michael Mancini - additonal BeOS support
25
26 Panayotis Vryonis - author of the first version of the README.REDHAT file.
27
28 Tim Norman - original author, web site maintainer
29
30 Tomasz Patora - Polish translation of documentation
0 Overview
1 --------
2 This file contains some quick notes on installation in general.
3
4 Compilation
5 -----------
6 To build pnm2ppa, simply cd to the source directory, and type:
7
8 make
9
10 If you have NetBSD or FreeBSD, you'll need to edit the Makefile to include
11 an additional library (libgnugetopt) which pnm2ppa requires.
12 Also edit the Makefile to select compilation for BeOS.
13
14 There is some internationalization (i18n) of the system log messages.
15 Edit the Makefile to choose a language other than English.
16
17 Installation
18 ------------
19
20 Two binaries are created: calibrate_ppa and pnm2ppa.
21
22 calibrate_ppa is used to calibrate your printer (center the printed page,
23 adjust the offset between black and color ink cartridges after changing them,
24 etc.) See the CALIBRATION.* file for details.
25
26 The other binary created, pnm2ppa, is a converter from a PNM
27 image to a stream of PPA data that can be sent directly to the printer.
28 The PNM image *must* have a resolution of 600 dpi. These files can be
29 generated with ghostscript. The binary-output pbmraw, pgmraw, ppmraw devices
30 are supported (the text-output pbm, pgm, ppm devices are also supported, but
31 the raw devices are MUCH faster!).
32
33 The pnmraw and pgnmraw devices are switches that will try to select among
34 the raw formats, as appropriate for the document, but do not always make
35 the correct choice.
36
37 You should now type
38
39 make install
40
41 to install the binaries (by default, in /usr/local/bin/) ,
42 the manpage (in /usr/local/man/man1), and the sample
43 configuration file (/etc/pnm2ppa.conf). You may change these locations
44 by editing the Makefile.
45
46 *** IMPORTANT ***
47
48 You **MUST** now edit /etc/pnm2ppa.conf to at least remove the line
49 "version ERROR", and choose the correct printer version (720, 820, 1000, etc)
50 before you can do anything with pnm2ppa.
51
52 Other things you can do are docunented in the sample configuration
53 file /etc/pnm2ppa.conf
54
55
56 Usage
57 -----
58 To print a postscript file with this program, You may use a simple
59 shell script:
60
61 #!/bin/sh
62 cat $1 | \
63 gs -sDEVICE=ppmraw -sPAPERSIZE=letter -q -dNOPAUSE -r600 -sOutputFile=- - | \
64 pnm2ppa $2 $3 $4 $5 $6 $7 -i - -o - | lpr -l
65
66 Any valid ghostscript papersize like "legal", "a4", etc.
67 can be substituted for "letter"
68 (in fact, "letter" is the default, so the "-sPAPERSIZE=letter" is
69 not really needed.)
70
71
72 If this script is placed in /usr/local/bin/ppaprint ,
73
74 ppaprint file.ps
75
76 will print the postscript file file.ps in high quality color. Other
77 options are:
78
79 ppapprint file.ps --eco // economy color ink mode
80 ppaprint file.ps --bw // black and white
81 ppaprint file.ps --bw --eco // black and white economy mode
82
83 etc. In the example, up to six pnm2ppa options can be added (see
84 "man pnm2ppa" to list options, or "pnm2ppa --h" ).
85
86 You may wish to replace the ghostscript output device "ppmraw" with
87 "pbmraw" for only black and white printing - it is somewhat faster -
88 or "pgmraw" for greyscale images.
89
90 an ascii file could be printed in black and white with the script
91
92 #!/bin/sh
93 enscript -2rj $1 | \
94 gs -sDEVICE=pbmraw -sPAPERSIZE=letter -q -dNOPAUSE -r600 -sOutputFile=- - | \
95 pnm2ppa --bw $2 $3 $4 $5 $6 $7 -i - -o - | lpr -l
96
97 Integration into Printing Systems
98 -----------------------------------
99
100 (A) lpr, LPRng systems
101
102 You can set up printer filters. See the documentation for
103 your print spooler for information on how to do that.
104 The subdirectory lpd of the pnm2ppa distribution contains a
105 printer description file "printcap" and so filters to go with it.
106 See the README.lpd file there.
107
108
109 On some Linux distributions, (RedHat, Mandrake, ... etc.), packages
110 that install pnm2ppa and appropriate printer filters will be available
111 to do all this for you. On others, you must do this manually, for
112 example using the files in our lpd subdirectory. See lpd/README.lpd
113 in the pnm2ppa source distribution.
114
115
116 Recent versions of printtool/rhs-printfilters support pnm2ppa.
117
118 ---------------
119
120 (B) PDQ ("Print, Don't Queue")
121
122 PDQ is an alternative, spooler-free printing system
123 available from http://pdq.sourceforge.net
124
125 The pdq subdirectory of the pnm2ppa source provides a pdq driver, gs-pnm2ppa
126
127 ----------------
128
129 (C) CUPS ("Common Unix Printing System")
130 An experimental system for generating a CUPS driver is online at
131 http://www.linuxprinting.org
132
133 See http;//sourceforge.net/projects/CUPS
134 We do need a CUPS driver for pnm2ppa. If you figure it out,
135 please contribute it!
136
137
138
139
140
141
142
143
144
145
0 Note on installation on BeOS.
1
2 (1)
3 You should edit the Makefile to adjust it for BeOS.
4
5 -- The locations of the binaries pnm2ppa and calibrate_ppa may need
6 to be changed. (One succesful BeOS user put them in
7 /boot/home/config/bin )
8
9 -- The location of the manpage pnm2ppa.1 may need to be changed.
10
11 (2)
12 scripts used for printing may need to be changed. Here is
13 what one happy BeOS user reported on the ppa.users@listbot.com list:
14 (available in the mailing lists section of http://pnm2ppa.sourceforge.net
15 see message #598, "No more BeOS woes", July 21, 2000)
16
17 ----------------------------------------------------------------
18 "Yeah, baby! :) That mother prints! Here's what I did:
19 made a script called pnm
20
21 #!/bin/sh
22 pnm2ppa -i - -o /dev/parallel/parallel1
23
24 and then I made my printps script as follows
25
26 #!/bin/sh
27 cat $1 | gs -sDEVICE=ppmraw -q -dNOPAUSE -r600 -sOutputFile=\|pnm -
28
29 The neatto trick here is the -sOutputFile=\|pnm voodoo. For whatever reason,
30 it likes that mo better. Thanks for everyone's help."
31 -----------------------------------------------------------------
32
33 This BeOS user apparently had difficulties with scripts using the standard
34 pipe syntax for sending ghostscript output to pnm2ppa:
35 cat $1 | gs -sDEVICE=ppmraw -q -dNOPAUSE -r600 -sOutputFile=- - | pnm
36
37 (3)
38 On BeOS, pnm2ppa does not send messages to the system log. They go to
39 the standard error stream unless "silent 1" is specified in /etc/pnm2ppa.conf.
40
41 -----------------------
42 If you can provide us with an improved INSTALL.BEOS and Makefile,
43 please contact the pnm2ppa project.
44
0 To be written
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1 <HTML>
2 <HEAD>
3 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
4 <TITLE>PPA Printer-Support RPM Packages for MANDRAKE Linux distributions.</TITLE>
5
6
7 </HEAD>
8 <BODY>
9 Next
10 Previous
11 Contents
12 <HR>
13 <H1>PPA Printer-Support RPM Packages for MANDRAKE Linux distributions.</H1>
14
15 <H2>The pnm2ppa project team
16 <A HREF="mailto:ppa-rpms@sourceforge.net">ppa-rpms@users.sourceforge.net</A></H2>v0.1 Nov 11, 2000
17 <P><HR>
18 <EM>Information about using pnm2ppa with Mandrake. (Updated for pnm2ppa-1.04 and later.)</EM>
19 <HR>
20 <P><B> Mandrake-specific issues.</B>
21 <P>See the document
22 <A HREF="file:INSTALL.REDHAT.html">INSTALL.REDHAT.html</A>
23 for installation and setup. That document is written
24 for Red Hat; note the Mandrake-specific differences
25 listed below,
26 <P>
27 <UL>
28 <LI> Mandrake 7.0 and earlier has incompatible and non-functional
29 <CODE>pnm2ppa</CODE> support which must be replaced.
30 Please use
31 <CODE>printtool</CODE> to delete any installed PPA printers BEFORE
32 upgrading <CODE>rhs-printfilters</CODE>. (If you forget to do this, and
33 printtool will not start after the update, delete or move your
34 <CODE>/etc/printcap</CODE> file.)
35 Install the <CODE>pnm2ppa</CODE> RPM package.
36 Then update <CODE>rhs-printfilters</CODE> with
37 <CODE>rhs-printfilters-1.58-4ppa5mdk.i386.rpm</CODE>
38 from
39 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>.
40 (Do <B>NOT</B> use <CODE>rhs-printfilters-1.57-4ppa4.i386.rpm</CODE>
41 which is for RedHat systems only.)</LI>
42 <LI>Mandrake-7.1 supplies a <CODE>pnm2ppa</CODE> RPM and has support for
43 it in <CODE>rhs-printfilters</CODE>. Mandrake 7.1 has a configuration
44 tool <CODE>DrakConf</CODE> for setting up printers, which may
45 be an interface to <CODE>printtool</CODE>.
46 Some users have reported difficulties with this. In that case, just use
47 <CODE>printtool</CODE> to configure the printer.</LI>
48 <LI>Mandrake-7.2 does not have a separate <CODE>pnm2ppa</CODE> RPM package, but has
49 added <CODE>pnm2ppa</CODE> to the <CODE>ghostscript</CODE> RPM package. This creates
50 difficulties for updating <CODE>pnm2ppa</CODE> with the RPM package from
51 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>.
52 You will get reported conflicts with <CODE>ghostscript</CODE>
53 if you try to install the
54 <CODE>pnm2ppa-1.04-1.i386.rpm</CODE> package,
55 but it seems that you can
56 safely use the rpm option <CODE>--force</CODE> to force its installation.
57 Mandrake-7.2 also has moved to using CUPS as its printing system,
58 and appears to now have its own printer configuration tool, but still
59 includes <CODE>pnm2ppa</CODE> support in <CODE>rhs-printfilters</CODE>.</LI>
60 </UL>
61 <HR>
62 Next
63 Previous
64 Contents
65 </BODY>
66 </HTML>
0 PPA Printer-Support RPM Packages for MANDRAKE Linux distri-
1 butions.
2 The pnm2ppa project team ppa-rpms@users.sourceforge.net
3 v0.1 Nov 11, 2000
4
5 Information about using pnm2ppa with Mandrake. (Updated for
6 pnm2ppa-1.04 and later.)
7
8 MMaannddrraakkee--ssppeecciiffiicc iissssuueess..
9
10 See the document INSTALL.REDHAT.html for installation and setup. That
11 document is written for Red Hat; note the Mandrake-specific
12 differences listed below,
13
14
15 +o Mandrake 7.0 and earlier has incompatible and non-functional
16 pnm2ppa support which must be replaced. Please use printtool to
17 delete any installed PPA printers BEFORE upgrading rhs-
18 printfilters. (If you forget to do this, and printtool will not
19 start after the update, delete or move your /etc/printcap file.)
20 Install the pnm2ppa RPM package. Then update rhs-printfilters with
21 rhs-printfilters-1.58-4ppa5mdk.i386.rpm from
22 http://sourceforge.net/projects/pnm2ppa. (Do NNOOTT use rhs-
23 printfilters-1.57-4ppa4.i386.rpm which is for RedHat systems only.)
24
25 +o Mandrake-7.1 supplies a pnm2ppa RPM and has support for it in rhs-
26 printfilters. Mandrake 7.1 has a configuration tool DrakConf for
27 setting up printers, which may be an interface to printtool. Some
28 users have reported difficulties with this. In that case, just use
29 printtool to configure the printer.
30
31 +o Mandrake-7.2 does not have a separate pnm2ppa RPM package, but has
32 added pnm2ppa to the ghostscript RPM package. This creates
33 difficulties for updating pnm2ppa with the RPM package from
34 http://sourceforge.net/projects/pnm2ppa. You will get reported
35 conflicts with ghostscript if you try to install the
36 pnm2ppa-1.04-1.i386.rpm package, but it seems that you can safely
37 use the rpm option --force to force its installation.
38 Mandrake-7.2 also has moved to using CUPS as its printing system,
39 and appears to now have its own printer configuration tool, but
40 still includes pnm2ppa support in rhs-printfilters.
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1 <HTML>
2 <HEAD>
3 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
4 <TITLE>PPA Printer-Support RPM Packages for Red Hat Linux and Compatible Distributions</TITLE>
5
6
7 </HEAD>
8 <BODY>
9 Next
10 Previous
11 Contents
12 <HR>
13 <H1>PPA Printer-Support RPM Packages for Red Hat Linux and Compatible Distributions</H1>
14
15 <H2>The pnm2ppa project team
16 <A HREF="mailto:ppa-rpms@sourceforge.net">ppa-rpms@users.sourceforge.net</A></H2>v0.27, Nov 11, 2000
17 <P><HR>
18 <EM>Information and installation instructions
19 to accompany pnm2ppa packages for Red Hat Linux available at
20 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>
21 (Updated for pnm2ppa-1.04 and later.)
22 See the &quot;Troubleshooting&quot; section at the end of
23 this document for
24 fixes to some reported problems</EM>
25 <HR>
26 <P><B> Overview of HP's PPA DeskJet Printers.</B>
27 <P>Most of Hewlett-Packard's DeskJet(tm) printers use the PCL3 command language,
28 and are currently supported by Ghostscript drivers. However, a few models,
29 namely
30 <UL>
31 <LI> <EM>DeskJet 710C Series</EM>: HP DeskJet 710C, 712C</LI>
32 <LI> <EM>DeskJet 720C Series</EM>: HP DeskJet 720C, 722C</LI>
33 <LI> <EM>DeskJet 820C Series</EM>: HP DeskJet 820Cxi, 820Cse
34 <EM>(discontinued)</EM></LI>
35 <LI> <EM>DeskJet 1000C Series</EM>: HP DeskJet 1000Cxi, 1000Cse
36 <EM>(discontinued)</EM></LI>
37 </UL>
38 <P>feature &quot;Host-based&quot; printing,
39 and use HP's proprietary
40 PPA (<EM>Printer Performance Architecture</EM>) protocol,
41 instead of PCL. The two models in each series are physically
42 identical;
43 they just come with different bundled Windows software.
44 The 820C and 1000C series are discontinued at this time (January 2000).
45 <P>PPA printers rely on software running on the
46 host CPU to carry out the low-level processing
47 of printer output that would be done by hardware in
48 a standard PCL printer. The relation of PPA printers to PCL printers
49 is analogous to the relation between &quot;Winmodems&quot; and true modems.
50 <P>Unfortunately, HP only supplies Windows software drivers for PPA printers,
51 and have indicated that it is unlikely that
52 they will ever make the proprietary PPA specs public.
53 This is apparently because of concerns that
54 publication of the specs might reveal crucial details
55 of HP's trade secrets about &quot;color science&quot; to competitors.
56 (A secondary issue
57 is that it is apparently possible to physically
58 damage the printer by sending it
59 bad sequences of PPA commands, which is not the case for PCL commands,
60 and it seems that HP do not wish to take any responsibility for such damage by
61 encouraging unofficial PPA programming.)
62 <P>In fact,
63 the decline in hardware component prices has meant that the anticipated
64 cost-savings through using host-based PPA instead of printer-based PCL
65 are less than expected, and two of the PPA printer series
66 (820C, 1000C) have been phased out, and replaced by similar PCL printers
67 in HP's product line. The 710C and 720C series are still being sold
68 at this time of writing. <B> All other currently-offered
69 DeskJet models appear to be standard PCL3
70 printers.</B>
71 <P>
72 <P>Many Linux users may have inadvertently purchased PPA DeskJet models,
73 mistaking them for PCL3 DeskJets, for which independently-produced
74 Linux drivers have long
75 been available. Fortunately, a reverse engineering effort,
76 started in 1998 by Tim Norman,
77 <A HREF="http://www.normsoft.com/ppa">http://www.normsoft.com/ppa</A>
78 and
79 <A HREF="http://pnm2ppa.sourceforge.net">http://pnm2ppa.sourceforge.net</A>,
80 and continued by the <EM>pnm2ppa</EM> project at
81 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>
82 has managed to produce drivers that provide basic printing
83 functionality for these PPA printers under Linux and other
84 Unices.
85 <P>
86 <P>
87 <P>
88 <P><B> The pnm2ppa driver for color printing with PPA printers.</B>
89 <P>Color printing with PPA printers is supported by the
90 <EM><CODE>pnm2ppa</CODE></EM> driver which is the successor to the older
91 black-and-white-only driver
92 <A HREF="http://pnm2ppa.sourceforge.net/files/pbm2ppa-0.8.6.tar.gz">pbm2ppa-0.8.6</A> developed by Tim Norman.
93 <P>
94 <P><CODE>pnm2ppa</CODE>
95 can translate <EM>portable anymap</EM> (<EM>pnm</EM>)
96 format images into a stream of PPA instructions which can be sent to the
97 printer. In the driver name,
98 &quot;<EM>pnm</EM>&quot; stands for the superset
99 of <EM>three</EM> image formats:
100 <EM>ppm</EM> (portable &quot;pixmap&quot; format for color images),
101 <EM>pgm</EM> (portable &quot;greymap&quot; format for greyscale images),
102 and <EM>pbm</EM> (portable &quot;bitmap&quot; format for black and white images).
103 <P>Ghostscript has a number of &quot;output devices&quot; that
104 produce pnm format output from postscript or pdf input.
105 These come in <EM>plain</EM> (text) and <EM>raw</EM>
106 (binary) variants. While <CODE>pnm2ppa</CODE> can now interpret
107 both plain and raw pnm formats, there is no point in using the
108 inefficient plain formats: <EM>always</EM> use the &quot;raw&quot;
109 output devices, which are:
110 <UL>
111 <LI><EM>ppmraw</EM> - raw pixmap format (color images);</LI>
112 <LI><EM>pgmraw</EM> - raw greymap format (greyscale images);</LI>
113 <LI><EM> pbmraw</EM> - raw bitmap format (black and white images);</LI>
114 <LI><EM>pnmraw</EM> - selects between ppm, pgm, and pbm raw formats;</LI>
115 <LI><EM>pgnmraw</EM> - selects between pgm and pbm raw formats.</LI>
116 </UL>
117
118 The last two output devices are switches that try to analyze the
119 image, and select an appropriate format; however, they are not
120 recommended for routine use, as they may inconsistently choose the format.
121 The <CODE>ghostscript-5.10</CODE>
122 package supplied with Red Hat 6.x distributions provides all these
123 devices; older versions may not. To see the list of available
124 ghostscript output devices, type the command line
125 <BLOCKQUOTE><CODE>
126 <PRE>
127 gs --help
128 </PRE>
129 </CODE></BLOCKQUOTE>
130
131 if the required <CODE>ppmraw</CODE> or
132 <CODE>pbmraw</CODE> devices are not shown, you will have to upgrade your
133 version of ghostscript.
134 <P>The data must be streamed directly from ghostscript to
135 <CODE>pnm2ppa</CODE> to the (local) printer without being
136 stored in any intermediate
137 file: one ppm-format (color) US Letter size page is represented
138 by 3x5100x6600 Bytes (100MB) in binary format and four times this amount in
139 text format.
140 <P>
141 <P>An example of
142 a command line for printing a postscript
143 file <CODE>file.ps</CODE> using <CODE>gs</CODE> (ghostscript) and <CODE>pnm2ppa</CODE> is
144 <BLOCKQUOTE><CODE>
145 <PRE>
146 cat file.ps | gs -q -sDEVICE=ppmraw -r600 -sPAPERSIZE=letter -dNOPAUSE \
147 -sOutputFile=- - | pnm2ppa --eco -v 720 -i - -o - | lpr -l
148 </PRE>
149 </CODE></BLOCKQUOTE>
150
151 (all on a single line). In this example the paper size is explicitly
152 given to <CODE>gs</CODE> as <EM>US Letter</EM>
153 (8.5&quot;x11&quot;) size
154 (<CODE>letter</CODE>); <CODE>pnm2ppa</CODE> no longer needs to be told what
155 the paper size is, and will read it from the <CODE>gs</CODE> output (and check
156 that it is a permitted size for the printer type).
157 The <CODE>pnm2ppa</CODE> option <CODE>--eco</CODE> specifies &quot;EconoFast&quot;
158 mode, for a lower quality output which uses less ink, and prints faster,
159 and <CODE>-v 720</CODE> specifies the PPA printer as belonging
160 to the DeskJet 720C series.
161 <P>
162 <P>Obviously, it would be impractical to type such a command each time
163 one wished to print something, so in addition to the <CODE>pnm2ppa</CODE>
164 driver itself, an enhanced version of Red Hat's <CODE>rhs-printfilters</CODE>
165 RPM package is provided; after this is installed, the PPA printer
166 can be managed like other standard printers with the Red Hat
167 <CODE>printtool</CODE> utility. The postscript file can then be printed with
168 the simple command
169 <BLOCKQUOTE><CODE>
170 <PRE>
171 lpr file.ps
172 </PRE>
173 </CODE></BLOCKQUOTE>
174 <P>
175 <UL>
176 <LI><EM>However, if you wish to print to paper sizes supported by ghostscript,
177 but not supported by the Red Hat <CODE>printtool</CODE> utility, you can
178 use scripts like the one above.
179 The HP 710C, 720C, and 820C series support paper sizes from
180 3&quot;x3&quot; to 8.5&quot;x14&quot;, while the 1000C
181 supports 4&quot;x6&quot; to 13&quot;x19&quot;.</EM></LI>
182 </UL>
183 <P>
184 <P><B> Available RPM packages.</B>
185 <P>A RPM package for <CODE>pnm2ppa</CODE> is part of the Red Hat Linux
186 distribution starting with Red Hat 6.2.
187 You will also find a RPM package for the latest release of
188 <CODE>pnm2ppa</CODE>
189 at
190 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>.
191 <P>The latest version at the time
192 of writing is
193 <CODE>pnm2ppa-1.04-1.i386.rpm</CODE>, and is built on
194 Red Hat 6.2. If you are running a different release
195 of Red Hat (or a different Linux distribution)
196 you may need to download and rebuild the source RPM
197 <CODE>pnm2ppa-1.04-1.src.rpm</CODE> instead:
198 <BLOCKQUOTE><CODE>
199 <PRE>
200 rpm --rebuild pnm2ppa-1.04-1.src.rpm
201 </PRE>
202 </CODE></BLOCKQUOTE>
203
204 (You must be <CODE>root</CODE> to do this, and have the necessary
205 compilers installed; on Red Hat, the rebuilt binary RPM will be created in
206 the directory <CODE>/usr/src/redhat/RPMS/i386/</CODE>.)
207 <P>Red Hat 6.2 and later also includes support for configuring your
208 printer to use <CODE>pnm2ppa</CODE> using <CODE>printtool</CODE>
209 and <CODE>rhs-printfilters</CODE>.
210 If you are using Red Hat 6.1 and earlier,you will need to
211 update the <CODE>rhs-printfilters</CODE> that came with the distribution
212 to the
213 <CODE>rhs-printfilters-1.57-4ppa4.i386.rpm</CODE> also available at
214 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>.
215 (This is designed to work only with <CODE>printtool-3.43</CODE> and earlier.)
216 <P>
217 <P>Note: If you are using Red Hat 6.2, you may wish to update the
218 print filter support that it comes with. The <CODE>pnm2ppa-1.04-1</CODE>
219 RPM package supplies the necessary files that you can use.
220 After installing this RPM, see
221 <CODE>/usr/lib/rhs/rhs-printfilters/README.ppa</CODE> for details.
222 <P>
223 <P><B> Installing the <CODE>pnm2ppa</CODE> RPM package and setting up the PPA printer.</B>
224 <P>To install the RPM package, you must log in as the system administrator,
225 <CODE>root</CODE>.
226 <P>Now begin the installation. First install the <CODE>pnm2ppa</CODE> RPM:
227 <BLOCKQUOTE><CODE>
228 <PRE>
229 rpm -Uvh pnm2ppa-1.04-1.i386.rpm
230 </PRE>
231 </CODE></BLOCKQUOTE>
232
233 The <CODE>pnm2ppa</CODE> executable gets installed in <CODE>/usr/bin/</CODE>.
234 <P>If you are using a 2.2.x kernel,
235 (e.g. Red Hat 6.x)
236 it will be able to autodetect
237 IEEE-1284 devices like PPA printers, provided they are attached
238 to the parallel port with a bidirectional IEEE-1284 cable. (If your
239 printer works under Windows, you have the correct cable.)
240 (Note that older (2.0.x) kernels do not have this autoprobe facility.)
241 A script <CODE>detect_ppa</CODE> is provided by the <CODE>pnm2ppa</CODE>
242 RPM: just type
243 <BLOCKQUOTE><CODE>
244 <PRE>
245 detect_ppa
246 </PRE>
247 </CODE></BLOCKQUOTE>
248
249 to confirm that your Printer is found.
250 <P>It is possible (especially on Red Hat 6.1) that you will have to add
251 a line
252 <BLOCKQUOTE><CODE>
253 <PRE>
254 alias parport_lowlevel parport_pc
255 </PRE>
256 </CODE></BLOCKQUOTE>
257
258 to the file <CODE>/etc/conf.modules</CODE> for the printer to be found (this is
259 a parallel port recognition issue, not specific to PPA printers.
260 and a known &quot;gotcha&quot; on Red Hat 6.1).
261 A typical message from the printer, which will
262 be displayed if autodetection is successful, is:
263 <BLOCKQUOTE><CODE>
264 <PRE>
265 CLASS:PRINTER;
266 MODEL:DESKJET 820C;
267 MANUFACTURER:HEWLETT-PACKARD;
268 DESCRIPTION:Hewlett-Packard DeskJet 820C;
269 COMMAND SET:SCP,VLINK;
270 </PRE>
271 </CODE></BLOCKQUOTE>
272
273 A list of PPA printers found, and the parallel ports to which they are
274 attached, will also be shown.
275 <P>
276 <P>At this point it is useful to test that your printer is working, by
277 printing a test page using the supplied script <CODE>test_ppa</CODE>
278 which the RPM has installed. You will need to know your
279 printer model (710, 712, 720, 722, 820, 1000), your paper size
280 (letter, legal, a4) and the printer port the printer is attached to.
281 If it is attached to the primary parallel port, this is
282 <EM><CODE>/dev/lp1</CODE></EM> under older 2.0.x kernels, and (usually)
283 <EM><CODE>/dev/lp0</CODE></EM> under newer 2.2.x kernels, as in Red Hat 6.x.
284 Type
285 <BLOCKQUOTE><CODE>
286 <PRE>
287 test_ppa
288 </PRE>
289 </CODE></BLOCKQUOTE>
290
291 and give the details about printer model. papersize, and port number
292 when prompted.
293 You will then be asked
294 whether to print a test page, an offset calibration
295 page, or an alignment calibration page, etc.
296 <UL>
297 <LI> <EM><EM>Tip:</EM>
298 The </EM><CODE>test_ppa</CODE><EM> script
299 does not use the print filters that
300 will be installed by the </EM><CODE>rhs-printfilters</CODE><EM> RPM, so it is
301 useful when troubleshooting, for testing if any printing problems are
302 associated with the basic printer installation, or with the
303 configuration of the print filters.</EM></LI>
304 </UL>
305 <P>
306 <P><B> Installing the PPA-enhanced <CODE>rhs-printfilters</CODE> RPM package (if needed).</B>
307 <P>
308 <UL>
309 <LI><EM>This step is NOT needed on Red Hat 6.2 or later.</EM></LI>
310 </UL>
311 <P>The <CODE>rhs-printfilters</CODE> rpm distributed with
312 Red Hat 6.1 does not support <CODE>pnm2ppa</CODE>,
313 If you use an older distribution, you will first have to replace their
314 <CODE>rhs-printfilters</CODE> RPM with the PPA-enhanced version from the
315 pnm2ppa project.
316 <P>Once you have confirmed you have a working printer, install the
317 RPM <CODE>rhs-printfilters-1.57-4ppa4.i386.rpm</CODE>
318 <BLOCKQUOTE><CODE>
319 <PRE>
320 rpm -Uvh rhs-printfilters-1.57-4ppa4.i386.rpm
321 </PRE>
322 </CODE></BLOCKQUOTE>
323 <P><B> Configuring the print filters with <CODE>printtool</CODE>.</B>
324 <P>Now start the &quot;<EM>Red Hat Linux Print System Manager</EM>&quot;
325 (as root) to
326 configure the printer, either
327 by clicking on the printer icon in Red Hat's &quot;control-panel&quot;, or just
328 typing
329 <BLOCKQUOTE><CODE>
330 <PRE>
331 printtool
332 </PRE>
333 </CODE></BLOCKQUOTE>
334
335 In the Print System Manager window, click on <EM>Add</EM>, then
336 in the &quot;Add a Printer Entry&quot;, select <EM>Local Printer</EM>, and
337 click <EM>Ok</EM>. Hopefully, the port on which the printer is attached
338 will be listed as &quot;Detected&quot; (<EM>if not,
339 fix the problem before continuing</EM>, perhaps by
340 adding the line &quot;<CODE>alias parport_lowlevel parport_pc</CODE>&quot;
341 to <CODE>/etc/conf.modules</CODE>), as mentioned above.
342 You will now have to &quot;<EM>edit
343 the local printer entry</EM>&quot; for the PPA printer. Click on
344 <EM>Select</EM> to chose the &quot;Input filter&quot;.
345 The <EM>Configure Filter</EM> screen will open.
346 Among the many printer entries in the list
347 &quot;<EM>Printer Type</EM>&quot;, you should find three entries
348 <UL>
349 <LI><B>HP DeskJet 1000 series (PPA)</B> (for 1000Cse, 1000Cxi models)</LI>
350 <LI><B>HP DeskJet 710/720 series (PPA)</B> (for 710C, 712C, 720C, 722C models)</LI>
351 <LI><B>HP DeskJet 820 series (PPA)</B> (for 820Cse, 820Cxi models)
352 <UL>
353 <LI> If these entries do not show up, it may be because the older
354 <CODE>rhs-printfilters</CODE> package that you updated did not allow
355 the printer database <CODE>/usr/lib/rhs/rhs-printfilters/printerdb</CODE>
356 to be replaced. Try deleting or renaming the <CODE>printerdb</CODE>
357 file, and then reinstall
358 the PPA-enhanced <CODE>rhs-printfilters</CODE> RPM using
359 &quot;<CODE>rpm --force -Uvh rhs-printfilters*</CODE>&quot; </LI>
360 </UL>
361 </LI>
362 </UL>
363 <P>
364 <P>Select the appropriate
365 entry for your printer model. You will then be presented with
366 various options:
367 <UL>
368 <LI>The <EM>Driver Description</EM> box contains information about the
369 driver (you may have to use the scrollbar at the right of the box
370 to read it all). </LI>
371 <LI>The <EM>resolution</EM> box shows a single
372 resolution (600x600). There are no other choices.</LI>
373 <LI>The <EM>Paper Size</EM> box allows
374 various choices (only <EM>letter</EM>, <EM>legal</EM>, and <EM>a4</EM>
375 seem correspond to native paper sizes printed by the Red Hat print filters;
376 the other choices, (a3, ledger, ...) appear to get resized by
377 the print filters to print on US Letter size paper (?) ).
378 (Other paper sizes cannot be selected this way, but you <EM>can</EM>
379 print to any papersize, <EM>if it supported by both ghostscript
380 and the printer</EM>, using a script, as described above, that bypasses
381 the RedHat printfilters.)</LI>
382 <LI>The <EM>Color Depth/ Uniprint Mode</EM> box allows various selections
383 of color and print quality (These are achieved by
384 using various combinations
385 of the <CODE>pnm2ppa</CODE> options
386 <EM>--eco</EM> (EconoFast mode), <EM>-p</EM> (disable black
387 ink cartridge) and <EM>--bw</EM> (black and white printing only),
388 without direct intervention by the user.) The choices (in the
389 most recent <CODE>printerdb</CODE> database) are:
390 <UL>
391 <LI> Black and White, econofast mode (<CODE>--bw --eco</CODE>)</LI>
392 <LI> Black and White, normal quality (<CODE>--bw</CODE>)</LI>
393 <LI> Color, econofast mode (<CODE>--eco --fd</CODE>)</LI>
394 <LI> Color, normal quality (<CODE>--eco</CODE>)</LI>
395 <LI> Color, high quality </LI>
396 <LI> Color, normal quality, black ink disabled (<CODE>-p --eco</CODE>)</LI>
397 <LI> Color, high quality, black ink disabled (<CODE>-p --uni</CODE>)</LI>
398 </UL>
399
400 (These are the choices that will be presented by &quot;official&quot;
401 <CODE>rhs-printfilters-1.72</CODE>; if you installed a <CODE>pnm2ppa</CODE>
402 RPM package from
403 <A HREF="http://sourceforge.net/projects/pnm2ppa">the SourceForge pnm2ppa site</A>, you may have a file
404 <CODE>/usr/lib/rhs/rhs-printfilters/README.ppa</CODE> explaining how to modify
405 earlier versions of <CODE>rhs-printfilters</CODE> to show these updated
406 choices.)
407
408 You may also see a choice to use the older &quot;Legacy&quot;
409 driver <CODE>pbm2ppa</CODE> (black and white only); this is
410 is stable but unmaintained; it may still be a useful
411 alternative to <CODE>pnm2ppa</CODE> on older, slower systems with
412 less available memory.
413 </LI>
414 <LI>The three <EM>Printing options</EM> are not relevant here, and
415 should <EM>not</EM> be selected. They are for direct printing
416 of text (ascii) to non-postscript printers, but since the only way of printing
417 text files with <CODE>pnm2ppa</CODE> is
418 by first converting them to postscript(tm), this is <EM>not</EM>
419 possible on the PPA printer.
420 <UL>
421 <LI><EM>It is important that the choice </EM>
422 &quot;Fast text printing (non-PS printers only)&quot;<EM> is NOT selected,
423 so that the print filters will
424 convert text files to postscript before printing.</EM> </LI>
425 </UL>
426 </LI>
427 <LI>The <EM>Margins</EM>
428 entries control the margins used when printing text files
429 (these are instructions to the text-to-postscript
430 conversion process).</LI>
431 <LI>The <EM>Extra GS options</EM> box is not only a place for adding
432 options for ghostscript, but also for the PPA drivers.
433 <EM>Leave this box empty unless you know what you are doing</EM>.
434 As explained in the text in the Driver Description box
435 (you did read it, didn't you ?), the entry should be in the format:
436 <BLOCKQUOTE><CODE>
437 <PRE>
438
439 gs_options PPA ppa_options
440 </PRE>
441 </CODE></BLOCKQUOTE>
442
443 Anything before the
444 &quot;<CODE>PPA</CODE>&quot; is interpreted as a <CODE>gs</CODE> option, anything after it
445 is interpreted as a <CODE>ppa</CODE> option. You can learn about
446 <CODE>pnm2ppa</CODE> options by typing either &quot;<CODE>man pnm2ppa</CODE>&quot;
447 or &quot;<CODE>pnm2ppa --help</CODE>&quot; at a command line (hopefully, these
448 two sources of information will be consistent with each other!);</LI>
449 </UL>
450
451 When you have made your choices, click on <EM>Ok</EM> to
452 save your selections and close the &quot;Configure Filter&quot; screen,
453 and then click on <EM>OK</EM> to close the &quot;Edit Local Printer Entry&quot;
454 screen.
455 <P>You are now back in the &quot;Red Hat Print System Manager&quot; screen;
456 highlight the printer you just configured, and, in the <EM>Tests</EM>
457 menu, choose <EM>Print Postscript test page</EM> to print a test page using
458 the Red Hat print filters. If this printed correctly, your
459 print system is set up to use the PPA printer, just like any of the other
460 printers that the Red Hat print filters support.
461 <P>
462 <P>
463 <P>
464 <P><B> Configuring pnm2ppa.conf and calibrating the printer. </B>
465 <P>A number of printer parameters are set to reasonable default values
466 for each of the printer models, but you may wish to &quot;fine tune&quot;
467 or calibrate your printer. The default values can be overridden
468 by entries in the configuration files, which by default are
469 <CODE>/etc/pnm2ppa.conf</CODE> and <CODE>/etc/pbm2ppa.conf</CODE>.
470 At 600dpi, one pixel is 1/600 inch.
471 <P>The user-adjustable parameters are:
472 <UL>
473 <LI> <B>verbose 1</B> and <B>silent 1</B>. These control
474 messages about progress and errors from <CODE>pnm2ppa</CODE>. By default,
475 messages are sent to the system log <CODE>/var/log/messages</CODE>.
476 The <CODE>verbose 1</CODE> keyword send copies to <CODE>stderr</CODE>, the
477 standard error stream to the terminal. The <CODE>silent 1</CODE>
478 keyword silences the stream of messages to the system log.
479 <UL>
480 <LI><B> The system log messages may be silenced in the default
481 configuration file; switch off &quot;silent&quot;
482 mode with &quot;silent 0&quot; for debugging printer
483 problems (or use verbose mode).</B></LI>
484 </UL>
485 </LI>
486 <LI> The <B>version</B> keyword can be used to specify
487 the printer model as 710, 712, 720, 722, 820, or 1000.
488 It is not needed if you use the RedHat printool to
489 configure the printer.
490 </LI>
491 <LI> <B>xoffset</B> and <B>yoffset</B>: the x-offset and y-offset
492 (in pixels) of the
493 printed image on the page, which should be chosen so the image
494 is correctly centered on the paper. (These can also be set with
495 the <CODE> -x &lt;xoff&gt; </CODE> and <CODE> -y &lt;yoff&gt; </CODE> options.)
496 See
497 <A HREF="./CALIBRATION.html">CALIBRATION.html</A> (or CALIBRATION.txt) for more information.
498
499 </LI>
500 <LI> <B>topmargin</B>, <B>bottommargin</B>, <B>leftmargin</B>,
501 <B>rightmargin</B>: the four
502 margins, which define the distances (in pixels)
503 from the edges of the paper to the
504 printed region; parts of the image that are outside these margins
505 will not be printed.
506 (These can also be set with the
507 <CODE> -t &lt;top margin&gt; </CODE>,
508 <CODE> -b &lt;bottom margin&gt; </CODE>,
509 <CODE> -l &lt;left margin&gt; </CODE>, and
510 <CODE> -r &lt;right margin&gt; </CODE>
511 options.)
512 </LI>
513 <LI> <B>ColOffsX</B> and <B>ColOffsY</B>: the x-offset and y-offset
514 (in pixels)
515 between the color image produced by the color ink printer head, and that
516 produced by the black ink printer head.
517 These should be recalibrated
518 <B> each time an ink cartridge is replaced</B>.
519 See
520 <A HREF="./CALIBRATION.html">CALIBRATION.html</A> (or CALIBRATION.txt) for more information.
521 </LI>
522 <LI> <B>blackshear</B> and <B>colorshear</B>: these are x offsets
523 between right-to-left and left-to-right sweeps of the print head, one for
524 the black printing and one for the color printing. These provide sideways
525 offsets (in pixels) of the right-to-left sweeps,
526 that can be used to correct &quot;shearing&quot; when printing
527 in modes that use bidirectional print head sweeps.
528 </LI>
529 <LI><B>unimode 1</B> will make unidirectional
530 print sweeps (left-to-right) the default, instead
531 of bidirectional sweeps. The <CODE>--uni</CODE>
532 and <CODE>--bi</CODE> options can control how a particular print
533 run is printed. Unidirectional printing is only useful
534 (it is slower) if there are issues of &quot;shearing&quot;
535 in high quality image printing.
536 </LI>
537 <LI> <B>blackness</B> : this takes values 0,1,2,3 or 4 drops of
538 black ink per pixel, and controls black ink density in black-and-white
539 and &quot;text-like&quot; black regions in color printing. At present,
540 this has no effect on printing with the black ink cartridge disabled,
541 or on black regions identified as &quot;image-like&quot;. (This can
542 also be set with the <CODE> -B &lt;n&gt;</CODE> option,
543 where <CODE>n</CODE> is the number of drops.)
544
545 </LI>
546 <LI><B>GammaR</B>, <B>GammaG</B>, and <B>GammaB</B>:
547 the are the three &quot;gamma&quot; parameters that define the
548 standard color correction
549 curves for red, green, and blue. Changing these will affect how
550 colors appear (decreasing any Gamma enhaces the corresponding color).
551 The Gamma values are specified as decimal numbers,
552 with Gamma = 1.0 corresponding to no color correction.</LI>
553 <LI>Gamma values can also be specified using integer numbers
554 <B>RedGammaIdx</B>, <B>GreenGammaIdx</B>, <B>BlueGammaIdx</B>;
555 These are determined by a procedure discussed in
556 <A HREF="./COLOR.html">COLOR.html</A> or COLOR.txt,
557 which involves printing a test page. The <B>papersize</B>
558 keyword specifies the paper size used for this testpage,
559 because it is produced by <CODE>pnm2ppa</CODE> without the input that
560 usually specifies the page size.</LI>
561 <LI>The keywords
562 <B>black_ink 0</B>,
563 <B>color_ink 0</B>,
564 <B>cyan_ink 0</B>,
565 <B>magenta_ink 0</B>,
566 and <B>yellow_ink 0</B>
567 can be used to switch of the various inks; this can be useful
568 in troubleshooting and debugging <CODE>pnm2ppa</CODE>.</LI>
569 </UL>
570 <P>Use <CODE>test_ppa</CODE> to print various test pages
571 or calibration patterns to adjust the offsets.
572 <P>If you wish to specify these
573 parameters using the command-line options
574 described above, some of them can be
575 entered in the &quot;extra GS options&quot; box using the Print System Manager
576 (<CODE>printtool</CODE>), as described above.
577 <P>
578 <P>
579 <P><B> Utility programs for the printer.</B>
580 <P>HP's Windows software provides a utility program
581 that sends PPA commands to tell the printer to perform
582 taks like cleaning the printheads, etc. The codes for some
583 of these functions have already been reverse engineered.
584 There are proposals to add support for PPA printers to the
585 PUP (Printer Utility Program) utility, which is
586 also a project at
587 <A HREF="http://www.sourceforge.net/project/?group_id=1118">http://www.sourceforge.net</A>.
588 However, as of the time of writing, no PUP support
589 for PPA printers is available (volunteers, anyone?).
590 <P>
591 <P><B>Troubleshooting</B>
592 <P>The first thing to do is to look at the messages from <CODE>pnm2ppa</CODE>
593 in the system log to see what is happening, whether <CODE>pnm2ppa</CODE>
594 <B>actually received any input</B>, and if it was valid.
595 <B> (You may need to enable system log messages in
596 <CODE>/etc/pnm2ppa.conf</CODE>, see above.)</B>
597 Maybe ghostscript failed to convert your postscript file into
598 PNM format: this is <B>not</B> a <CODE>pnm2ppa</CODE> problem!
599 Here are suggestions for dealing with problems that you may encounter.
600 <UL>
601 <LI><B> Printing fails in the middle of a print run</B>, perhaps
602 when a figure embedded in the document is printing (in the latest
603 <CODE>pnm2ppa</CODE> versions, printing finishes normally, but an incomplete
604 document is printed). The system log
605 reports that <CODE>read_line</CODE> could not read the image, and found EOF
606 (end-of-file). This probably
607 means that <CODE>ghostscript</CODE>'s &quot;ppmraw&quot; or
608 &quot;pgmraw&quot; output device failed for some reason,
609 usually leaving a core dump, without completing the
610 translation of the postscript to a pnm format.
611 (This has been seen to happen in ghostscript 5.10 ;
612 upgrading to ghostscript 5.50 solved the problem.) If you cannot
613 upgrade, try printing the document
614 in black-and-white using the ghostscript &quot;pbmraw&quot; output device.</LI>
615 <LI><B>The <CODE>test_ppa</CODE> script works,
616 but you can't get <CODE>printtool</CODE> to make the printfilters work.</B>
617
618 You installed <CODE>pnm2ppa-1.0</CODE> and the PPA-enhanced
619 <CODE>rhs-printfilters</CODE> (earlier than v. 1.61) from the pnm2ppa
620 SourceForge page. You are using <CODE> printtool</CODE> v. 3.43 or earlier
621 and are probably a Mandrake user.
622 Solution: (a) use <CODE>printtool </CODE> to uninstall the PPA printer;
623 (b) delete (or rename) the printer database
624 <CODE>/usr/lib/rhs/rhs-printfilters/printerdb</CODE>, and reinstall
625 the <CODE>rhs-printfilters</CODE> RPM using the
626 &quot;<CODE>rpm --force ... </CODE>&quot;
627 option; (c) use <CODE>printtool</CODE> to add the
628 PPA printer again.
629 (Your previously-installed <CODE>rhs-printfilters</CODE> may have
630 resisted replacement of its <CODE>printerdb</CODE>).</LI>
631 <LI><B>You upgraded your RedHat (or compatible) Linux distribution
632 and your printfilters no longer work</B>.
633 You used to use a PPA-enhanced <CODE>rhs-printfilters</CODE> from the
634 pnm2ppa SourceForge site. You
635 upgraded your distribution to one using <CODE>printtool</CODE> v 3.44 or later
636 (e.g. RedHat 6.2).
637 Solution: Make sure that
638 <CODE>rhs-printfilters</CODE> has been updated to a version
639 1.61 or greater that came with your
640 upgraded distribution.
641 Use <CODE>printtool</CODE> to delete, and then add the
642 PPA printer
643 This will create a new printer configuration compatible
644 with your upgraded distribution.</LI>
645 <LI><B>You printed an image file using a &quot;high quality&quot;
646 printer setting, but it has visible horizontal lines
647 on it </B>and printing under Windows(tm) 9x doesn't
648 show this effect (except in &quot;economode&quot;).
649 These are probably &quot;swath boundaries&quot;,
650 showing the junction between different sweeps of the print head.
651 Solution: using unidirectional printing (PPA option <CODE>--uni</CODE>,
652 or <CODE>unimode 1</CODE> in <CODE>/etc/pnm2ppa.conf</CODE>) helps a little, but
653 this problem requires an extensive
654 rewrite of part of pnm2ppa (<CODE>cutswath.c</CODE>)
655 for a satisfactory solution. (Volunteers welcome - see the TODO file in the
656 pnm2ppa docs (<CODE>/usr/doc/pnm2ppa*/TODO</CODE>)!) </LI>
657 <LI>&quot;<B>Flashing light syndrome</B> &quot;.
658 Your printer usually works, but you have found that some particular
659 documents cause the printer to fail, and the lights on its panel
660 start flashing rapidly in sequence. Solution, turn the printer off and back
661 on again. This is not supposed to happen any more; if it happens
662 reproducibly, contact the pnm2ppa developers, and offer to
663 make the offending
664 file available for testing and diagnosis of this problem.
665 (Don't sent it to the Mailing List unless requested).
666 Bug reports can be filed at
667 <A HREF="http://sourceforge.net/projects/pnm2ppa">the SourceForge pnm2ppa site</A>.</LI>
668 <LI><B>You wish to print on envelopes or other non-standard media
669 not supported by the print filters</B>?
670 Solution: if you can get Ghostscript (<CODE>gs</CODE>) to
671 produce the correct image, and the paper size is in the range allowed
672 by your printer, you should be able to do this with a
673 script that bypasses the print filters, as described earlier
674 in this document.</LI>
675 <LI><B>Colors look wrong, or do not match what the Windows(tm) 9x driver
676 produces</B>. Solution: check that
677 your color ink cartridge is
678 not running out of some ink color; if not,
679 (a) adjust the &quot;gamma&quot;
680 entries in <CODE>/etc/pnm2ppa,conf</CODE>, or (b)
681 install a customized color calibration file
682 <CODE>/etc/pnm2ppa.gamma</CODE>. See the file
683 <A HREF="./COLOR.html">COLOR.html</A> (or COLOR.txt) for more information.</LI>
684 </UL>
685
686 <P>
687 <P><B>Contacting the pnm2ppa project.</B>
688 <P>Send comments or corrections (about this document or the RPMS) to:
689 <A HREF="mailto:ppa-rpms@sourceforge.net">ppa-rpms@users.sourceforge.net</A><P>There are three mailing lists,
690 <EM>ppa.announce</EM> (announcements),
691 <EM>ppa.users</EM> (users helping users)
692 and <EM>ppa.devel</EM> (developers).
693 You can subscribe to them, or browse their
694 archives, at
695 <A HREF="http://pnm2ppa.sourceforge.net">http://pnm2ppa.sourceforge.net/maillist.htm</A>.
696 <P>To contact the developers, subscribe to <EM>ppa.devel</EM> and post a message.
697 <P>There are Public Forums for posting questions
698 and comments
699 at
700 <A HREF="http://sourceforge.net/projects/pnm2ppa">http://sourceforge.net/projects/pnm2ppa</A>
701 (but whether you get any help from these, depends on
702 whether anyone is reading them).
703 <P>
704 <HR>
705 Next
706 Previous
707 Contents
708 </BODY>
709 </HTML>
0 PPA Printer-Support RPM Packages for Red Hat Linux and Com-
1 patible Distributions
2 The pnm2ppa project team ppa-rpms@users.sourceforge.net
3 v0.27, Nov 11, 2000
4
5 Information and installation instructions to accompany pnm2ppa pack-
6 ages for Red Hat Linux available at http://sourceforge.net/pro-
7 jects/pnm2ppa (Updated for pnm2ppa-1.04 and later.) See the "Trou-
8 bleshooting" section at the end of this document for fixes to some
9 reported problems
10
11 OOvveerrvviieeww ooff HHPP''ss PPPPAA DDeesskkJJeett PPrriinntteerrss..
12
13 Most of Hewlett-Packard's DeskJet(tm) printers use the PCL3 command
14 language, and are currently supported by Ghostscript drivers.
15 However, a few models, namely
16
17 +o _D_e_s_k_J_e_t _7_1_0_C _S_e_r_i_e_s: HP DeskJet 710C, 712C
18
19 +o _D_e_s_k_J_e_t _7_2_0_C _S_e_r_i_e_s: HP DeskJet 720C, 722C
20
21 +o _D_e_s_k_J_e_t _8_2_0_C _S_e_r_i_e_s: HP DeskJet 820Cxi, 820Cse _(_d_i_s_c_o_n_t_i_n_u_e_d_)
22
23 +o _D_e_s_k_J_e_t _1_0_0_0_C _S_e_r_i_e_s: HP DeskJet 1000Cxi, 1000Cse _(_d_i_s_c_o_n_t_i_n_u_e_d_)
24
25 feature "Host-based" printing, and use HP's proprietary PPA (_P_r_i_n_t_e_r
26 _P_e_r_f_o_r_m_a_n_c_e _A_r_c_h_i_t_e_c_t_u_r_e) protocol, instead of PCL. The two models
27 in each series are physically identical; they just come with different
28 bundled Windows software. The 820C and 1000C series are discontinued
29 at this time (January 2000).
30
31 PPA printers rely on software running on the host CPU to carry out the
32 low-level processing of printer output that would be done by hardware
33 in a standard PCL printer. The relation of PPA printers to PCL
34 printers is analogous to the relation between "Winmodems" and true
35 modems.
36
37 Unfortunately, HP only supplies Windows software drivers for PPA
38 printers, and have indicated that it is unlikely that they will ever
39 make the proprietary PPA specs public. This is apparently because of
40 concerns that publication of the specs might reveal crucial details of
41 HP's trade secrets about "color science" to competitors. (A secondary
42 issue is that it is apparently possible to physically damage the
43 printer by sending it bad sequences of PPA commands, which is not the
44 case for PCL commands, and it seems that HP do not wish to take any
45 responsibility for such damage by encouraging unofficial PPA
46 programming.)
47
48 In fact, the decline in hardware component prices has meant that the
49 anticipated cost-savings through using host-based PPA instead of
50 printer-based PCL are less than expected, and two of the PPA printer
51 series (820C, 1000C) have been phased out, and replaced by similar PCL
52 printers in HP's product line. The 710C and 720C series are still
53 being sold at this time of writing. AAllll ootthheerr ccuurrrreennttllyy--ooffffeerreedd
54 DDeesskkJJeett mmooddeellss aappppeeaarr ttoo bbee ssttaannddaarrdd PPCCLL33 pprriinntteerrss..
55
56
57 Many Linux users may have inadvertently purchased PPA DeskJet models,
58 mistaking them for PCL3 DeskJets, for which independently-produced
59 Linux drivers have long been available. Fortunately, a reverse
60 engineering effort, started in 1998 by Tim Norman,
61 http://www.normsoft.com/ppa and http://pnm2ppa.sourceforge.net, and
62 continued by the _p_n_m_2_p_p_a project at
63 http://sourceforge.net/projects/pnm2ppa has managed to produce drivers
64 that provide basic printing functionality for these PPA printers under
65 Linux and other Unices.
66 TThhee ppnnmm22ppppaa ddrriivveerr ffoorr ccoolloorr pprriinnttiinngg wwiitthh PPPPAA pprriinntteerrss..
67
68 Color printing with PPA printers is supported by the pnm2ppa driver
69 which is the successor to the older black-and-white-only driver
70 pbm2ppa-0.8.6 developed by Tim Norman.
71
72
73 pnm2ppa can translate _p_o_r_t_a_b_l_e _a_n_y_m_a_p (_p_n_m) format images into a
74 stream of PPA instructions which can be sent to the printer. In the
75 driver name, "_p_n_m" stands for the superset of _t_h_r_e_e image formats: _p_p_m
76 (portable "pixmap" format for color images), _p_g_m (portable "greymap"
77 format for greyscale images), and _p_b_m (portable "bitmap" format for
78 black and white images).
79
80 Ghostscript has a number of "output devices" that produce pnm format
81 output from postscript or pdf input. These come in _p_l_a_i_n (text) and
82 _r_a_w (binary) variants. While pnm2ppa can now interpret both plain and
83 raw pnm formats, there is no point in using the inefficient plain
84 formats: _a_l_w_a_y_s use the "raw" output devices, which are:
85
86 +o _p_p_m_r_a_w - raw pixmap format (color images);
87
88 +o _p_g_m_r_a_w - raw greymap format (greyscale images);
89
90 +o _p_b_m_r_a_w - raw bitmap format (black and white images);
91
92 +o _p_n_m_r_a_w - selects between ppm, pgm, and pbm raw formats;
93
94 +o _p_g_n_m_r_a_w - selects between pgm and pbm raw formats.
95
96 The last two output devices are switches that try to analyze the
97 image, and select an appropriate format; however, they are not
98 recommended for routine use, as they may inconsistently choose the
99 format. The ghostscript-5.10 package supplied with Red Hat 6.x
100 distributions provides all these devices; older versions may not.
101 To see the list of available ghostscript output devices, type the
102 command line
103
104
105 gs --help
106
107
108
109
110 if the required ppmraw or pbmraw devices are not shown, you will have
111 to upgrade your version of ghostscript.
112
113 The data must be streamed directly from ghostscript to pnm2ppa to the
114 (local) printer without being stored in any intermediate file: one
115 ppm-format (color) US Letter size page is represented by 3x5100x6600
116 Bytes (100MB) in binary format and four times this amount in text
117 format.
118
119
120 An example of a command line for printing a postscript file file.ps
121 using gs (ghostscript) and pnm2ppa is
122
123
124 cat file.ps | gs -q -sDEVICE=ppmraw -r600 -sPAPERSIZE=letter -dNOPAUSE \
125 -sOutputFile=- - | pnm2ppa --eco -v 720 -i - -o - | lpr -l
126
127
128
129
130 (all on a single line). In this example the paper size is explicitly
131 given to gs as _U_S _L_e_t_t_e_r (8.5"x11") size (letter); pnm2ppa no longer
132 needs to be told what the paper size is, and will read it from the
133 gs output (and check that it is a permitted size for the printer
134 type). The pnm2ppa option --eco specifies "EconoFast" mode, for a
135 lower quality output which uses less ink, and prints faster, and -v
136 720 specifies the PPA printer as belonging to the DeskJet 720C series.
137
138
139 Obviously, it would be impractical to type such a command each time
140 one wished to print something, so in addition to the pnm2ppa driver
141 itself, an enhanced version of Red Hat's rhs-printfilters RPM package
142 is provided; after this is installed, the PPA printer can be managed
143 like other standard printers with the Red Hat printtool utility. The
144 postscript file can then be printed with the simple command
145
146
147 lpr file.ps
148
149
150
151
152
153 +o _H_o_w_e_v_e_r_, _i_f _y_o_u _w_i_s_h _t_o _p_r_i_n_t _t_o _p_a_p_e_r _s_i_z_e_s _s_u_p_p_o_r_t_e_d _b_y
154 _g_h_o_s_t_s_c_r_i_p_t_, _b_u_t _n_o_t _s_u_p_p_o_r_t_e_d _b_y _t_h_e _R_e_d _H_a_t printtool utility,
155 you can use scripts like the one above. The HP 710C, 720C, and
156 820C series support paper sizes from 3"x3" to 8.5"x14", while the
157 1000C supports 4"x6" to 13"x19".
158
159
160 AAvvaaiillaabbllee RRPPMM ppaacckkaaggeess..
161
162 A RPM package for pnm2ppa is part of the Red Hat Linux distribution
163 starting with Red Hat 6.2. You will also find a RPM package for the
164 latest release of pnm2ppa at http://sourceforge.net/projects/pnm2ppa.
165
166 The latest version at the time of writing is pnm2ppa-1.04-1.i386.rpm,
167 and is built on Red Hat 6.2. If you are running a different
168 release of Red Hat (or a different Linux distribution) you may need
169 to download and rebuild the source RPM pnm2ppa-1.04-1.src.rpm instead:
170
171
172 rpm --rebuild pnm2ppa-1.04-1.src.rpm
173
174
175
176
177 (You must be root to do this, and have the necessary compilers
178 installed; on Red Hat, the rebuilt binary RPM will be created in the
179 directory /usr/src/redhat/RPMS/i386/.)
180
181 Red Hat 6.2 and later also includes support for configuring your
182 printer to use pnm2ppa using printtool and rhs-printfilters. If you
183 are using Red Hat 6.1 and earlier,you will need to update the rhs-
184 printfilters that came with the distribution to the rhs-
185 printfilters-1.57-4ppa4.i386.rpm also available at
186 http://sourceforge.net/projects/pnm2ppa. (This is designed to work
187 only with printtool-3.43 and earlier.)
188
189
190 Note: If you are using Red Hat 6.2, you may wish to update the print
191 filter support that it comes with. The pnm2ppa-1.04-1 RPM package
192 supplies the necessary files that you can use. After installing this
193 RPM, see /usr/lib/rhs/rhs-printfilters/README.ppa for details.
194
195
196 IInnssttaalllliinngg tthhee pnm2ppa RPM package and setting up the PPA printer.
197
198 To install the RPM package, you must log in as the system
199 administrator, root.
200
201 Now begin the installation. First install the pnm2ppa RPM:
202
203
204 rpm -Uvh pnm2ppa-1.04-1.i386.rpm
205
206
207
208
209 The pnm2ppa executable gets installed in /usr/bin/.
210
211 If you are using a 2.2.x kernel, (e.g. Red Hat 6.x) it will be able
212 to autodetect IEEE-1284 devices like PPA printers, provided they are
213 attached to the parallel port with a bidirectional IEEE-1284 cable.
214 (If your printer works under Windows, you have the correct cable.)
215 (Note that older (2.0.x) kernels do not have this autoprobe facility.)
216 A script detect_ppa is provided by the pnm2ppa RPM: just type
217
218
219 detect_ppa
220
221
222
223
224 to confirm that your Printer is found.
225
226 It is possible (especially on Red Hat 6.1) that you will have to add a
227 line
228
229
230 alias parport_lowlevel parport_pc
231
232
233
234
235 to the file /etc/conf.modules for the printer to be found (this is a
236 parallel port recognition issue, not specific to PPA printers. and a
237 known "gotcha" on Red Hat 6.1). A typical message from the printer,
238 which will be displayed if autodetection is successful, is:
239
240
241 CLASS:PRINTER;
242 MODEL:DESKJET 820C;
243 MANUFACTURER:HEWLETT-PACKARD;
244 DESCRIPTION:Hewlett-Packard DeskJet 820C;
245 COMMAND SET:SCP,VLINK;
246
247
248
249
250 A list of PPA printers found, and the parallel ports to which they are
251 attached, will also be shown.
252
253
254 At this point it is useful to test that your printer is working, by
255 printing a test page using the supplied script test_ppa which the RPM
256 has installed. You will need to know your printer model (710, 712,
257 720, 722, 820, 1000), your paper size (letter, legal, a4) and the
258 printer port the printer is attached to. If it is attached to the
259 primary parallel port, this is /dev/lp1 under older 2.0.x kernels,
260 and (usually) /dev/lp0 under newer 2.2.x kernels, as in Red Hat 6.x.
261 Type
262
263
264 test_ppa
265
266
267
268
269 and give the details about printer model. papersize, and port number
270 when prompted. You will then be asked whether to print a test page,
271 an offset calibration page, or an alignment calibration page, etc.
272
273 +o _T_i_p_: _T_h_e test_ppa _s_c_r_i_p_t _d_o_e_s _n_o_t _u_s_e _t_h_e _p_r_i_n_t _f_i_l_t_e_r_s _t_h_a_t _w_i_l_l
274 _b_e _i_n_s_t_a_l_l_e_d _b_y _t_h_e rhs-printfilters _R_P_M_, _s_o _i_t _i_s _u_s_e_f_u_l _w_h_e_n
275 _t_r_o_u_b_l_e_s_h_o_o_t_i_n_g_, _f_o_r _t_e_s_t_i_n_g _i_f _a_n_y _p_r_i_n_t_i_n_g _p_r_o_b_l_e_m_s _a_r_e
276 _a_s_s_o_c_i_a_t_e_d _w_i_t_h _t_h_e _b_a_s_i_c _p_r_i_n_t_e_r _i_n_s_t_a_l_l_a_t_i_o_n_, _o_r _w_i_t_h _t_h_e
277 _c_o_n_f_i_g_u_r_a_t_i_o_n _o_f _t_h_e _p_r_i_n_t _f_i_l_t_e_r_s_.
278
279
280 IInnssttaalllliinngg tthhee PPPPAA--eennhhaanncceedd rhs-printfilters RPM package (if needed).
281
282
283 +o _T_h_i_s _s_t_e_p _i_s _N_O_T _n_e_e_d_e_d _o_n _R_e_d _H_a_t _6_._2 _o_r _l_a_t_e_r_.
284
285 The rhs-printfilters rpm distributed with Red Hat 6.1 does not support
286 pnm2ppa, If you use an older distribution, you will first have to
287 replace their rhs-printfilters RPM with the PPA-enhanced version from
288 the pnm2ppa project.
289
290 Once you have confirmed you have a working printer, install the RPM
291 rhs-printfilters-1.57-4ppa4.i386.rpm
292
293
294 rpm -Uvh rhs-printfilters-1.57-4ppa4.i386.rpm
295
296
297
298
299 CCoonnffiigguurriinngg tthhee pprriinntt ffiilltteerrss wwiitthh printtool.
300
301 Now start the "_R_e_d _H_a_t _L_i_n_u_x _P_r_i_n_t _S_y_s_t_e_m _M_a_n_a_g_e_r" (as root) to
302 configure the printer, either by clicking on the printer icon in Red
303 Hat's "control-panel", or just typing
304
305
306 printtool
307
308
309
310
311 In the Print System Manager window, click on _A_d_d, then in the "Add a
312 Printer Entry", select _L_o_c_a_l _P_r_i_n_t_e_r, and click _O_k. Hopefully, the
313 port on which the printer is attached will be listed as "Detected" (_i_f
314 _n_o_t_, _f_i_x _t_h_e _p_r_o_b_l_e_m _b_e_f_o_r_e _c_o_n_t_i_n_u_i_n_g, perhaps by adding the line
315 "alias parport_lowlevel parport_pc" to /etc/conf.modules), as men-
316 tioned above. You will now have to "_e_d_i_t _t_h_e _l_o_c_a_l _p_r_i_n_t_e_r _e_n_t_r_y" for
317 the PPA printer. Click on _S_e_l_e_c_t to chose the "Input filter". The
318 _C_o_n_f_i_g_u_r_e _F_i_l_t_e_r screen will open. Among the many printer entries in
319 the list "_P_r_i_n_t_e_r _T_y_p_e", you should find three entries
320
321 +o HHPP DDeesskkJJeett 11000000 sseerriieess ((PPPPAA)) (for 1000Cse, 1000Cxi models)
322
323 +o HHPP DDeesskkJJeett 771100//772200 sseerriieess ((PPPPAA)) (for 710C, 712C, 720C, 722C models)
324
325 +o HHPP DDeesskkJJeett 882200 sseerriieess ((PPPPAA)) (for 820Cse, 820Cxi models)
326
327 +o If these entries do not show up, it may be because the older rhs-
328 printfilters package that you updated did not allow the printer
329 database /usr/lib/rhs/rhs-printfilters/printerdb to be replaced.
330 Try deleting or renaming the printerdb file, and then reinstall
331 the PPA-enhanced rhs-printfilters RPM using "rpm --force -Uvh rhs-
332 printfilters*"
333
334
335 Select the appropriate entry for your printer model. You will then be
336 presented with various options:
337
338 +o The _D_r_i_v_e_r _D_e_s_c_r_i_p_t_i_o_n box contains information about the driver
339 (you may have to use the scrollbar at the right of the box to read
340 it all).
341
342 +o The _r_e_s_o_l_u_t_i_o_n box shows a single resolution (600x600). There are
343 no other choices.
344
345 +o The _P_a_p_e_r _S_i_z_e box allows various choices (only _l_e_t_t_e_r, _l_e_g_a_l, and
346 _a_4 seem correspond to native paper sizes printed by the Red Hat
347 print filters; the other choices, (a3, ledger, ...) appear to get
348 resized by the print filters to print on US Letter size paper (?)
349 ). (Other paper sizes cannot be selected this way, but you _c_a_n
350 print to any papersize, _i_f _i_t _s_u_p_p_o_r_t_e_d _b_y _b_o_t_h _g_h_o_s_t_s_c_r_i_p_t _a_n_d _t_h_e
351 _p_r_i_n_t_e_r, using a script, as described above, that bypasses the
352 RedHat printfilters.)
353
354 +o The _C_o_l_o_r _D_e_p_t_h_/ _U_n_i_p_r_i_n_t _M_o_d_e box allows various selections of
355 color and print quality (These are achieved by using various
356 combinations of the pnm2ppa options _-_-_e_c_o (EconoFast mode), _-_p
357 (disable black ink cartridge) and _-_-_b_w (black and white printing
358 only), without direct intervention by the user.) The choices (in
359 the most recent printerdb database) are:
360
361 +o Black and White, econofast mode (--bw --eco)
362
363 +o Black and White, normal quality (--bw)
364
365 +o Color, econofast mode (--eco --fd)
366
367 +o Color, normal quality (--eco)
368
369 +o Color, high quality
370
371 +o Color, normal quality, black ink disabled (-p --eco)
372
373 +o Color, high quality, black ink disabled (-p --uni)
374
375 (These are the choices that will be presented by "official" rhs-
376 printfilters-1.72; if you installed a pnm2ppa RPM package from the
377 SourceForge pnm2ppa site, you may have a file /usr/lib/rhs/rhs-
378 printfilters/README.ppa explaining how to modify earlier versions
379 of rhs-printfilters to show these updated choices.)
380
381 You may also see a choice to use the older "Legacy" driver pbm2ppa
382 (black and white only); this is is stable but unmaintained; it may
383 still be a useful alternative to pnm2ppa on older, slower systems
384 with less available memory.
385
386 +o The three _P_r_i_n_t_i_n_g _o_p_t_i_o_n_s are not relevant here, and should _n_o_t be
387 selected. They are for direct printing of text (ascii) to non-
388 postscript printers, but since the only way of printing text files
389 with pnm2ppa is by first converting them to postscript(tm), this is
390 _n_o_t possible on the PPA printer.
391
392 +o _I_t _i_s _i_m_p_o_r_t_a_n_t _t_h_a_t _t_h_e _c_h_o_i_c_e "Fast text printing (non-PS
393 printers only)" _i_s _N_O_T _s_e_l_e_c_t_e_d_, _s_o _t_h_a_t _t_h_e _p_r_i_n_t _f_i_l_t_e_r_s _w_i_l_l
394 _c_o_n_v_e_r_t _t_e_x_t _f_i_l_e_s _t_o _p_o_s_t_s_c_r_i_p_t _b_e_f_o_r_e _p_r_i_n_t_i_n_g_.
395
396 +o The _M_a_r_g_i_n_s entries control the margins used when printing text
397 files (these are instructions to the text-to-postscript conversion
398 process).
399
400 +o The _E_x_t_r_a _G_S _o_p_t_i_o_n_s box is not only a place for adding options for
401 ghostscript, but also for the PPA drivers. _L_e_a_v_e _t_h_i_s _b_o_x _e_m_p_t_y
402 _u_n_l_e_s_s _y_o_u _k_n_o_w _w_h_a_t _y_o_u _a_r_e _d_o_i_n_g. As explained in the text in
403 the Driver Description box (you did read it, didn't you ?), the
404 entry should be in the format:
405
406
407
408 gs_options PPA ppa_options
409
410
411
412
413 Anything before the "PPA" is interpreted as a gs option, anything
414 after it is interpreted as a ppa option. You can learn about pnm2ppa
415 options by typing either "man pnm2ppa" or "pnm2ppa --help" at a com-
416 mand line (hopefully, these two sources of information will be consis-
417 tent with each other!);
418
419 When you have made your choices, click on _O_k to save your selections
420 and close the "Configure Filter" screen, and then click on _O_K to
421 close the "Edit Local Printer Entry" screen.
422
423 You are now back in the "Red Hat Print System Manager" screen;
424 highlight the printer you just configured, and, in the _T_e_s_t_s menu,
425 choose _P_r_i_n_t _P_o_s_t_s_c_r_i_p_t _t_e_s_t _p_a_g_e to print a test page using the Red
426 Hat print filters. If this printed correctly, your print system is
427 set up to use the PPA printer, just like any of the other printers
428 that the Red Hat print filters support.
429
430
431
432
433 CCoonnffiigguurriinngg ppnnmm22ppppaa..ccoonnff aanndd ccaalliibbrraattiinngg tthhee pprriinntteerr..
434
435 A number of printer parameters are set to reasonable default values
436 for each of the printer models, but you may wish to "fine tune" or
437 calibrate your printer. The default values can be overridden by
438 entries in the configuration files, which by default are
439 /etc/pnm2ppa.conf and /etc/pbm2ppa.conf. At 600dpi, one pixel is
440 1/600 inch.
441
442 The user-adjustable parameters are:
443
444 +o vveerrbboossee 11 and ssiilleenntt 11. These control messages about progress and
445 errors from pnm2ppa. By default, messages are sent to the system
446 log /var/log/messages. The verbose 1 keyword send copies to
447 stderr, the standard error stream to the terminal. The silent 1
448 keyword silences the stream of messages to the system log.
449
450 +o TThhee ssyysstteemm lloogg mmeessssaaggeess mmaayy bbee ssiilleenncceedd iinn tthhee ddeeffaauulltt
451 ccoonnffiigguurraattiioonn ffiillee;; sswwiittcchh ooffff ""ssiilleenntt"" mmooddee wwiitthh ""ssiilleenntt 00"" ffoorr
452 ddeebbuuggggiinngg pprriinntteerr pprroobblleemmss ((oorr uussee vveerrbboossee mmooddee))..
453
454 +o The vveerrssiioonn keyword can be used to specify the printer model as
455 710, 712, 720, 722, 820, or 1000. It is not needed if you use the
456 RedHat printool to configure the printer.
457
458 +o xxooffffsseett and yyooffffsseett: the x-offset and y-offset (in pixels) of the
459 printed image on the page, which should be chosen so the image is
460 correctly centered on the paper. (These can also be set with the
461 -x <xoff> and -y <yoff> options.) See CALIBRATION.html (or
462 CALIBRATION.txt) for more information.
463
464
465 +o ttooppmmaarrggiinn, bboottttoommmmaarrggiinn, lleeffttmmaarrggiinn, rriigghhttmmaarrggiinn: the four margins,
466 which define the distances (in pixels) from the edges of the paper
467 to the printed region; parts of the image that are outside these
468 margins will not be printed. (These can also be set with the
469 -t <top margin> ,
470 -b <bottom margin> ,
471 -l <left margin> , and
472 -r <right margin> options.)
473
474 +o CCoollOOffffssXX and CCoollOOffffssYY: the x-offset and y-offset (in pixels)
475 between the color image produced by the color ink printer head,
476 and that produced by the black ink printer head. These should be
477 recalibrated
478 eeaacchh ttiimmee aann iinnkk ccaarrttrriiddggee iiss rreeppllaacceedd. See CALIBRATION.html (or
479 CALIBRATION.txt) for more information.
480
481 +o bbllaacckksshheeaarr and ccoolloorrsshheeaarr: these are x offsets between right-to-
482 left and left-to-right sweeps of the print head, one for the black
483 printing and one for the color printing. These provide sideways
484 offsets (in pixels) of the right-to-left sweeps, that can be used
485 to correct "shearing" when printing in modes that use bidirectional
486 print head sweeps.
487
488 +o uunniimmooddee 11 will make unidirectional print sweeps (left-to-right)
489 the default, instead of bidirectional sweeps. The --uni and --bi
490 options can control how a particular print run is printed.
491 Unidirectional printing is only useful (it is slower) if there are
492 issues of "shearing" in high quality image printing.
493
494 +o bbllaacckknneessss : this takes values 0,1,2,3 or 4 drops of black ink per
495 pixel, and controls black ink density in black-and-white and "text-
496 like" black regions in color printing. At present, this has no
497 effect on printing with the black ink cartridge disabled, or on
498 black regions identified as "image-like". (This can also be set
499 with the -B <n> option, where n is the number of drops.)
500
501
502 +o GGaammmmaaRR, GGaammmmaaGG, and GGaammmmaaBB: the are the three "gamma" parameters
503 that define the standard color correction curves for red, green,
504 and blue. Changing these will affect how colors appear
505 (decreasing any Gamma enhaces the corresponding color). The Gamma
506 values are specified as decimal numbers, with Gamma = 1.0
507 corresponding to no color correction.
508
509 +o Gamma values can also be specified using integer numbers
510 RReeddGGaammmmaaIIddxx, GGrreeeennGGaammmmaaIIddxx, BBlluueeGGaammmmaaIIddxx; These are determined by a
511 procedure discussed in COLOR.html or COLOR.txt, which involves
512 printing a test page. The ppaappeerrssiizzee keyword specifies the paper
513 size used for this testpage, because it is produced by pnm2ppa
514 without the input that usually specifies the page size.
515
516 +o The keywords bbllaacckk__iinnkk 00, ccoolloorr__iinnkk 00, ccyyaann__iinnkk 00, mmaaggeennttaa__iinnkk 00,
517 and yyeellllooww__iinnkk 00 can be used to switch of the various inks; this
518 can be useful in troubleshooting and debugging pnm2ppa.
519
520 Use test_ppa to print various test pages or calibration patterns to
521 adjust the offsets.
522
523 If you wish to specify these parameters using the command-line options
524 described above, some of them can be entered in the "extra GS options"
525 box using the Print System Manager (printtool), as described above.
526
527
528 UUttiilliittyy pprrooggrraammss ffoorr tthhee pprriinntteerr..
529
530 HP's Windows software provides a utility program that sends PPA
531 commands to tell the printer to perform taks like cleaning the
532 printheads, etc. The codes for some of these functions have already
533 been reverse engineered. There are proposals to add support for PPA
534 printers to the PUP (Printer Utility Program) utility, which is also a
535 project at http://www.sourceforge.net. However, as of the time of
536 writing, no PUP support for PPA printers is available (volunteers,
537 anyone?).
538
539
540 TTrroouubblleesshhoooottiinngg
541
542 The first thing to do is to look at the messages from pnm2ppa in the
543 system log to see what is happening, whether pnm2ppa aaccttuuaallllyy rreecceeiivveedd
544 aannyy iinnppuutt, and if it was valid.
545 ((YYoouu mmaayy nneeeedd ttoo eennaabbllee ssyysstteemm lloogg mmeessssaaggeess iinn /etc/pnm2ppa.conf,
546 see above.) Maybe ghostscript failed to convert your postscript file
547 into PNM format: this is nnoott a pnm2ppa problem! Here are suggestions
548 for dealing with problems that you may encounter.
549
550 +o PPrriinnttiinngg ffaaiillss iinn tthhee mmiiddddllee ooff aa pprriinntt rruunn, perhaps when a figure
551 embedded in the document is printing (in the latest pnm2ppa
552 versions, printing finishes normally, but an incomplete document is
553 printed). The system log reports that read_line could not read
554 the image, and found EOF (end-of-file). This probably means that
555 ghostscript's "ppmraw" or "pgmraw" output device failed for some
556 reason, usually leaving a core dump, without completing the
557 translation of the postscript to a pnm format. (This has been seen
558 to happen in ghostscript 5.10 ; upgrading to ghostscript 5.50
559 solved the problem.) If you cannot upgrade, try printing the
560 document in black-and-white using the ghostscript "pbmraw" output
561 device.
562
563 +o TThhee test_ppa script works, but you can't get printtool to make the
564 printfilters work.
565
566 You installed pnm2ppa-1.0 and the PPA-enhanced rhs-printfilters
567 (earlier than v. 1.61) from the pnm2ppa SourceForge page. You
568 are using printtool v. 3.43 or earlier and are probably a Mandrake
569 user. Solution: (a) use printtool to uninstall the PPA printer;
570 (b) delete (or rename) the printer database /usr/lib/rhs/rhs-
571 printfilters/printerdb, and reinstall the rhs-printfilters RPM
572 using the "rpm --force ... " option; (c) use printtool to add the
573 PPA printer again. (Your previously-installed rhs-printfilters may
574 have resisted replacement of its printerdb).
575
576 +o YYoouu uuppggrraaddeedd yyoouurr RReeddHHaatt ((oorr ccoommppaattiibbllee)) LLiinnuuxx ddiissttrriibbuuttiioonn aanndd
577 yyoouurr pprriinnttffiilltteerrss nnoo lloonnggeerr wwoorrkk. You used to use a PPA-enhanced
578 rhs-printfilters from the pnm2ppa SourceForge site. You upgraded
579 your distribution to one using printtool v 3.44 or later (e.g.
580 RedHat 6.2). Solution: Make sure that rhs-printfilters has been
581 updated to a version 1.61 or greater that came with your upgraded
582 distribution. Use printtool to delete, and then add the PPA
583 printer This will create a new printer configuration compatible
584 with your upgraded distribution.
585
586 +o YYoouu pprriinntteedd aann iimmaaggee ffiillee uussiinngg aa ""hhiigghh qquuaalliittyy"" pprriinntteerr sseettttiinngg,,
587 bbuutt iitt hhaass vviissiibbllee hhoorriizzoonnttaall lliinneess oonn iitt and printing under
588 Windows(tm) 9x doesn't show this effect (except in "economode").
589 These are probably "swath boundaries", showing the junction between
590 different sweeps of the print head. Solution: using unidirectional
591 printing (PPA option --uni, or unimode 1 in /etc/pnm2ppa.conf)
592 helps a little, but this problem requires an extensive rewrite of
593 part of pnm2ppa (cutswath.c) for a satisfactory solution.
594 (Volunteers welcome - see the TODO file in the pnm2ppa docs
595 (/usr/doc/pnm2ppa*/TODO)!)
596
597 +o "FFllaasshhiinngg lliigghhtt ssyynnddrroommee ". Your printer usually works, but you
598 have found that some particular documents cause the printer to
599 fail, and the lights on its panel start flashing rapidly in
600 sequence. Solution, turn the printer off and back on again.
601 This is not supposed to happen any more; if it happens
602 reproducibly, contact the pnm2ppa developers, and offer to make the
603 offending file available for testing and diagnosis of this problem.
604 (Don't sent it to the Mailing List unless requested). Bug reports
605 can be filed at the SourceForge pnm2ppa site.
606
607 +o YYoouu wwiisshh ttoo pprriinntt oonn eennvveellooppeess oorr ootthheerr nnoonn--ssttaannddaarrdd mmeeddiiaa nnoott
608 ssuuppppoorrtteedd bbyy tthhee pprriinntt ffiilltteerrss? Solution: if you can get
609 Ghostscript (gs) to produce the correct image, and the paper size
610 is in the range allowed by your printer, you should be able to do
611 this with a script that bypasses the print filters, as described
612 earlier in this document.
613
614 +o CCoolloorrss llooookk wwrroonngg,, oorr ddoo nnoott mmaattcchh wwhhaatt tthhee WWiinnddoowwss((ttmm)) 99xx ddrriivveerr
615 pprroodduucceess. Solution: check that your color ink cartridge is not
616 running out of some ink color; if not, (a) adjust the "gamma"
617 entries in /etc/pnm2ppa,conf, or (b) install a customized color
618 calibration file /etc/pnm2ppa.gamma. See the file COLOR.html (or
619 COLOR.txt) for more information.
620
621
622
623 CCoonnttaaccttiinngg tthhee ppnnmm22ppppaa pprroojjeecctt..
624
625 Send comments or corrections (about this document or the RPMS) to:
626 ppa-rpms@users.sourceforge.net
627
628 There are three mailing lists, _p_p_a_._a_n_n_o_u_n_c_e (announcements), _p_p_a_._u_s_e_r_s
629 (users helping users) and _p_p_a_._d_e_v_e_l (developers). You can subscribe
630 to them, or browse their archives, at
631 http://pnm2ppa.sourceforge.net/maillist.htm.
632
633 To contact the developers, subscribe to _p_p_a_._d_e_v_e_l and post a message.
634
635 There are Public Forums for posting questions and comments at
636 http://sourceforge.net/projects/pnm2ppa (but whether you get any help
637 from these, depends on whether anyone is reading them).
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
0 Installation of pnm2ppa with S.u.S.E. Linux
1 ------------------------------------------------------
2
3 1. Installation of program package pnm2ppa
4
5
6 Follow the standard installation instructions in INSTALL and CALIBRATION.
7 The driver pnm2ppa is installed to /usr/local/bin. The manual page
8 pnm2ppa.1 is installed in /usr/local/man/man1.
9
10 2. To integrate pnm2ppa into the BSD print spooler of the Linux system we
11 create printer spoolers in /etc/printcap, to print
12 postscript files in color or black and white, and to print plain ascii files.
13
14 See the file README.lpd in the subdirectory "lpd" of the pnm2ppa
15 distribution. This shows how to set up five printer descriptions:
16
17 coloreco (normal quality color,the default);
18 color (high quality color)
19 bweco (economy mode black)
20 bw (high quality black and white)
21 ascii (for printing text files using enscript)
22
23
24 (Maybe there is a better way, using SUSE's own printing configuration
25 system; if so please let us know).
26
27 3. Now you are ready to print files with
28
29 # lpr filename.ps
30
31 which is equivalent to:
32
33 #lpr -P coloreco filename.ps
34
35 or explicitly specify the color and quality mode:
36
37 #lpr -P bweco filename.ps
38 #lpr -P bw filename.ps
39 #lpr -P coloreco filename.ps
40 #lpr -P color filename.ps
41
42 and for ascii (text) files:
43
44 # lpr -P ascii filename
45
46
47
48
49
50
51
52
53
54
55
0
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 675 Mass Ave, Cambridge, MA 02139, USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12 freedom to share and change it. By contrast, the GNU General Public
13 License is intended to guarantee your freedom to share and change free
14 software--to make sure the software is free for all its users. This
15 General Public License applies to most of the Free Software
16 Foundation's software and to any other program whose authors commit to
17 using it. (Some other Free Software Foundation software is covered by
18 the GNU Library General Public License instead.) You can apply it to
19 your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22 price. Our General Public Licenses are designed to make sure that you
23 have the freedom to distribute copies of free software (and charge for
24 this service if you wish), that you receive source code or can get it
25 if you want it, that you can change the software or use pieces of it
26 in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29 anyone to deny you these rights or to ask you to surrender the rights.
30 These restrictions translate to certain responsibilities for you if you
31 distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34 gratis or for a fee, you must give the recipients all the rights that
35 you have. You must make sure that they, too, receive or can get the
36 source code. And you must show them these terms so they know their
37 rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40 (2) offer you this license which gives you legal permission to copy,
41 distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44 that everyone understands that there is no warranty for this free
45 software. If the software is modified by someone else and passed on, we
46 want its recipients to know that what they have is not the original, so
47 that any problems introduced by others will not reflect on the original
48 authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51 patents. We wish to avoid the danger that redistributors of a free
52 program will individually obtain patent licenses, in effect making the
53 program proprietary. To prevent this, we have made it clear that any
54 patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57 modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63 a notice placed by the copyright holder saying it may be distributed
64 under the terms of this General Public License. The "Program", below,
65 refers to any such program or work, and a "work based on the Program"
66 means either the Program or any derivative work under copyright law:
67 that is to say, a work containing the Program or a portion of it,
68 either verbatim or with modifications and/or translated into another
69 language. (Hereinafter, translation is included without limitation in
70 the term "modification".) Each licensee is addressed as "you".
71
72 Activities other than copying, distribution and modification are not
73 covered by this License; they are outside its scope. The act of
74 running the Program is not restricted, and the output from the Program
75 is covered only if its contents constitute a work based on the
76 Program (independent of having been made by running the Program).
77 Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80 source code as you receive it, in any medium, provided that you
81 conspicuously and appropriately publish on each copy an appropriate
82 copyright notice and disclaimer of warranty; keep intact all the
83 notices that refer to this License and to the absence of any warranty;
84 and give any other recipients of the Program a copy of this License
85 along with the Program.
86
87 You may charge a fee for the physical act of transferring a copy, and
88 you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91 of it, thus forming a work based on the Program, and copy and
92 distribute such modifications or work under the terms of Section 1
93 above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114 These requirements apply to the modified work as a whole. If
115 identifiable sections of that work are not derived from the Program,
116 and can be reasonably considered independent and separate works in
117 themselves, then this License, and its terms, do not apply to those
118 sections when you distribute them as separate works. But when you
119 distribute the same sections as part of a whole which is a work based
120 on the Program, the distribution of the whole must be on the terms of
121 this License, whose permissions for other licensees extend to the
122 entire whole, and thus to each and every part regardless of who wrote it.
123
124 Thus, it is not the intent of this section to claim rights or contest
125 your rights to work written entirely by you; rather, the intent is to
126 exercise the right to control the distribution of derivative or
127 collective works based on the Program.
128
129 In addition, mere aggregation of another work not based on the Program
130 with the Program (or with a work based on the Program) on a volume of
131 a storage or distribution medium does not bring the other work under
132 the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135 under Section 2) in object code or executable form under the terms of
136 Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155 The source code for a work means the preferred form of the work for
156 making modifications to it. For an executable work, complete source
157 code means all the source code for all modules it contains, plus any
158 associated interface definition files, plus the scripts used to
159 control compilation and installation of the executable. However, as a
160 special exception, the source code distributed need not include
161 anything that is normally distributed (in either source or binary
162 form) with the major components (compiler, kernel, and so on) of the
163 operating system on which the executable runs, unless that component
164 itself accompanies the executable.
165
166 If distribution of executable or object code is made by offering
167 access to copy from a designated place, then offering equivalent
168 access to copy the source code from the same place counts as
169 distribution of the source code, even though third parties are not
170 compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173 except as expressly provided under this License. Any attempt
174 otherwise to copy, modify, sublicense or distribute the Program is
175 void, and will automatically terminate your rights under this License.
176 However, parties who have received copies, or rights, from you under
177 this License will not have their licenses terminated so long as such
178 parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181 signed it. However, nothing else grants you permission to modify or
182 distribute the Program or its derivative works. These actions are
183 prohibited by law if you do not accept this License. Therefore, by
184 modifying or distributing the Program (or any work based on the
185 Program), you indicate your acceptance of this License to do so, and
186 all its terms and conditions for copying, distributing or modifying
187 the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190 Program), the recipient automatically receives a license from the
191 original licensor to copy, distribute or modify the Program subject to
192 these terms and conditions. You may not impose any further
193 restrictions on the recipients' exercise of the rights granted herein.
194 You are not responsible for enforcing compliance by third parties to
195 this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198 infringement or for any other reason (not limited to patent issues),
199 conditions are imposed on you (whether by court order, agreement or
200 otherwise) that contradict the conditions of this License, they do not
201 excuse you from the conditions of this License. If you cannot
202 distribute so as to satisfy simultaneously your obligations under this
203 License and any other pertinent obligations, then as a consequence you
204 may not distribute the Program at all. For example, if a patent
205 license would not permit royalty-free redistribution of the Program by
206 all those who receive copies directly or indirectly through you, then
207 the only way you could satisfy both it and this License would be to
208 refrain entirely from distribution of the Program.
209
210 If any portion of this section is held invalid or unenforceable under
211 any particular circumstance, the balance of the section is intended to
212 apply and the section as a whole is intended to apply in other
213 circumstances.
214
215 It is not the purpose of this section to induce you to infringe any
216 patents or other property right claims or to contest validity of any
217 such claims; this section has the sole purpose of protecting the
218 integrity of the free software distribution system, which is
219 implemented by public license practices. Many people have made
220 generous contributions to the wide range of software distributed
221 through that system in reliance on consistent application of that
222 system; it is up to the author/donor to decide if he or she is willing
223 to distribute software through any other system and a licensee cannot
224 impose that choice.
225
226 This section is intended to make thoroughly clear what is believed to
227 be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230 certain countries either by patents or by copyrighted interfaces, the
231 original copyright holder who places the Program under this License
232 may add an explicit geographical distribution limitation excluding
233 those countries, so that distribution is permitted only in or among
234 countries not thus excluded. In such case, this License incorporates
235 the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238 of the General Public License from time to time. Such new versions will
239 be similar in spirit to the present version, but may differ in detail to
240 address new problems or concerns.
241
242 Each version is given a distinguishing version number. If the Program
243 specifies a version number of this License which applies to it and "any
244 later version", you have the option of following the terms and conditions
245 either of that version or of any later version published by the Free
246 Software Foundation. If the Program does not specify a version number of
247 this License, you may choose any version ever published by the Free Software
248 Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251 programs whose distribution conditions are different, write to the author
252 to ask for permission. For software which is copyrighted by the Free
253 Software Foundation, write to the Free Software Foundation; we sometimes
254 make exceptions for this. Our decision will be guided by the two goals
255 of preserving the free status of all derivatives of our free software and
256 of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
281
282 Appendix: How to Apply These Terms to Your New Programs
283
284 If you develop a new program, and you want it to be of the greatest
285 possible use to the public, the best way to achieve this is to make it
286 free software which everyone can redistribute and change under these terms.
287
288 To do so, attach the following notices to the program. It is safest
289 to attach them to the start of each source file to most effectively
290 convey the exclusion of warranty; and each file should have at least
291 the "copyright" line and a pointer to where the full notice is found.
292
293 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) 19yy <name of author>
295
296 This program is free software; you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; either version 2 of the License, or
299 (at your option) any later version.
300
301 This program is distributed in the hope that it will be useful,
302 but WITHOUT ANY WARRANTY; without even the implied warranty of
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details.
305
306 You should have received a copy of the GNU General Public License
307 along with this program; if not, write to the Free Software
308 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
309
310 Also add information on how to contact you by electronic and paper mail.
311
312 If the program is interactive, make it output a short notice like this
313 when it starts in an interactive mode:
314
315 Gnomovision version 69, Copyright (C) 19yy name of author
316 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 This is free software, and you are welcome to redistribute it
318 under certain conditions; type `show c' for details.
319
320 The hypothetical commands `show w' and `show c' should show the appropriate
321 parts of the General Public License. Of course, the commands you use may
322 be called something other than `show w' and `show c'; they could even be
323 mouse-clicks or menu items--whatever suits your program.
324
325 You should also get your employer (if you work as a programmer) or your
326 school, if any, to sign a "copyright disclaimer" for the program, if
327 necessary. Here is a sample; alter the names:
328
329 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
332 <signature of Ty Coon>, 1 April 1989
333 Ty Coon, President of Vice
334
335 This General Public License does not permit incorporating your program into
336 proprietary programs. If your program is a subroutine library, you may
337 consider it more useful to permit linking proprietary applications with the
338 library. If this is what you want to do, use the GNU Library General
339 Public License instead of this License.
340
341
0 PPM to PPA converter
1 --------------------
2
3
4 Copyright (c) 1998-2000 Tim Norman, Giorgio Marzano, Andrew van der Stock,
5 and others.
6
7 All trademarks referenced are the property of their respective owners. You
8 use this software at your own risk. Although damage to your computer or
9 printer is unlikely, it is possible, and by using this software you agree
10 not to hold the authors responsible for any such damage.
11
12 License
13 -------
14 This software is being released under the GNU General Public
15 License. Please see the file LICENSE for details. We provide it free to
16 all who want it.
17
18 What is this?
19 -------------
20 This software creates output using the PPA (printer performance
21 architecture) protocol. This protocol is used by some HP "Windows-only"
22 printers, including the HP Deskjet 720C series, the HP DeskJet 820 series,
23 and the HP DeskJet 1000 series. It has been tested on all three series,
24 but your personal experience (positive or negative) is very much appreciated!
25
26 Installing
27 ----------
28 Read the INSTALL file to compile and install this software.
29
30 More Info
31 ---------
32 For full information on the PPA protocol and this software,
33 visit http://pnm2ppa.sourceforge.net, and the SourceForge site
34 http://sourceforge.net/projects/pnm2ppa
35
36 Contact Info
37 ------------
38
39 If you need help using this software, you can send a message to the
40 ppa.users mailing list, or post your concerns on one of the SourceForge
41 forums. Subscribe to the mailing lists at
42 http://pnm2ppa.sourceforge.net/maillist.htm
43 and visit the SourceForge page at
44 http://sourceforge.net/projects/pnm2ppa
45
46
47
48
49
50
51
52
0 Release notes for pnm2ppa-1.04 November 12 2000
1
2 - reduced memory footprint of calibrate_ppa from 36MB to 1.8MB
3 - fix bug in black shearing test pattern in calibrate_ppa
4 - fix bug in silent/vebose switches for error messages.
5 - repair the earlier 1.01 HP820 flashing light bug fix that got
6 broken by the 600 dot yoffset shift in 1.03...
7 --------------------------------------------
8 Release Notes for pnm2ppa-1.02. 1.03 October 28 2000
9
10 - improved calibrate_ppa output, made configuration easier
11 - change default offsets, etc. (add 600 to yoffset)
12 - added an automated lpd setup .
13
14 --------------------------------------------------
15 Release Notes for pnm2ppa-1.01 October 24, 2000
16 Fixed one more cause of "flashing light syndrome" on the
17 HP820C.
18
19 Other changes:
20
21 Improved and functional calibration program, now called calibrate_ppa,
22 incorporating Bruno Alix's calibration pages from calibrateco.c
23 Moved the creation of "gamma.ppm" for color calibration from
24 pnm2ppa to calibrate_ppa.
25
26 All user input and syslog output was audited for security.
27 No incorrect user input is now echoed to the syslog; syslog
28 messages can be silenced with a new keyword "silent 1"
29 in /etc/pnm2ppa.conf. File paths entered as user input are
30 now handled carefully.
31
32 Gamma color enhancement values can now be given as decimals in the
33 configuration file.
34
35 The various inks can be switched off in the configuration file
36 (as an aid in troubleshooting).
37
38 Release Notes for pnm2ppa-1.0 July 11, 2000
39 ---------------------------------------------
40
41 This release is the 1.0 release of pnm2ppa. It is fully functional
42 on all three PPA printer families, and has no known bugs. (Is "Flashing
43 LED syndrome a thing of the past?)
44
45 It can now handle all paper sizes compatible with the printer, and all pnm
46 formats.
47
48 The documentation is updated.
49
50 ----
51
52 Remaining issues such as somewhat-visible horizontal swath boundaries on
53 uniform dithered color backgrounds (such as in the ghostscript example
54 tiger.ps) cannot be resolved without major design changes, but this should
55 not affect most uses of pnm2ppa. (see the TODO file).
56 Such changes will require significant effort (by someone highly motivated)
57 to be achieved. pnm2ppa is probably as good as it can get by tweaking its
58 code with little bug fixes.
59
60 Improvements in color correction techniques could still be achieved,
61 though (see docs/en/COLOR.txt).
62
63 Calibration and printer utility procedures (head cleaning codes, etc)
64 could also be added. (perhaps using the PUP utility?)
65
66 Use of data compression of sweep data for color sweeps could also be
67 added without a major rewite, to perhaps speed up printing.
68
69
70
71 The pnm2ppa team.
72 http://sourceforge.net/projects/pnm2ppa
73
74
75
76
77
78
79
80
81
82
83
84
0 TODO
1
2 Code issues (comments by duncan):
3 * implement data compression for color as well as
4 black and white printing.
5 * bidirectional printing is not fully consistent (It is not clear
6 ahead of time whether the next sweep will be color or black, and thus
7 when the sweep changes from black to color or vice-versa, the sweep
8 direction may not reverse.)
9 * check out the new information about the buffer on the printer.
10 (mentioned on ppa.devel by andrew in early 2000)
11 * cleaning head codes needed. (or put them into PUP);
12 document the codes in the ppa docs here.
13 * should multiple color sweeps in a swath (gMaxpass=4)
14 alternate between right-to-left and left-to-right ?
15 * Printing of e.g. tiger.ps (an example included with ghostscript)
16 shows lines between swaths. The Windows driver does not. This is because
17 the four passes of the color head (gMaxPass=4) are all at the same
18 vertical position. This is not the way to e.g. paint a wall using a
19 paint roller - instead the successive passes should be vertically
20 staggered so their swath boundaries are not all at the same vertical
21 position. The Windows driver does this: the vertical position of pass 2
22 is 1/4 of a swath height below pass 1, etc. Unfortunately, the design
23 decisions in cutswath.c make this not a simple change. Initial changes
24 would be to somehow decouple the four sweeps, so they could have independent
25 left and right values, directions, vertical positions, etc.
26
27 * The Windows driver also has a "normal" mode with gMaxPass=2, and well
28 as "econofast" (gMaxPass=1) and high quality (gMaxPass=4). It
29 alternates color passes in one direction with black passes in the
30 other direction, at the same vertical position.
31 If this structure is adopted, maybe the way the 600dpi resolution of black
32 if reduced to 300dpi resolution in dither.c should be rethought.
33 (Why not keep 600dpi black resolution ?).
34
35 * A FS_black_dither routine is needed in black-only printing, for high-quality
36 black-only images.
37
38 * Internationalization ("i18n") should be done with GNU gettext and .po files,
39 not the current hack.
40
41 * add autodetection of device via IEEE 1284 and other methods
42 * redo debugging support (done ajv)
43 * add extra .conf parameters to avoid recompiles (done: ajv & giorgio)
44 * getopt() rather than current handling (done: ajv 19991003)
45
46 Distribution and Installation issues
47
48 * *BSD compatibility (partially there: ajv 19991021)
49 * update README and all doco
50 * update installation instructions for major distributions (caldera, RH, etc)
51 * Translate man page into other languages
52 * add autoconf support ? (NetBSD and alpha issues)
53 * update CREDITS
54 * Make install target (done: ajv)
55 * make syslog configurable; stdout or syslog (done: ajv 19991021)
56
57 CALIBRATION
58 * CALIBRATE doco, and supporting .ps file to generate page
59
60 Long Term wants
61
62 * write instructions on how to speed up parallel port (Linux 2.2.x and later)
63 * write hppaconf (KDE)?
64 * gs native filter rather than take pnm/pbm/ppm files
65 * scpd to monitor printer status, and provide support for console alerts
66 (These are dumb printers, so ...)
67
68
69
70
71
72
73
74
75
0 .TH pnm2ppa "28 Oct 2000"
1 .SH NAME
2 pnm2ppa - convert portable anymap (PNM) images to HP's PPA printer format.
3 .SH SYNOPSIS
4 pnm2ppa [options] [ -i \fIinfile\fR ] [ -o \fIoutfile\fR ]
5
6 .SH DESCRIPTION
7 Reads portable anymap (PNM) format as input. Binary PNM formats pnmraw =
8 {ppmraw (color pixmap), pgmraw (graymap), and pbmraw (black-and-white bitmap)}
9 are strongly preferred. Output stream can be locally processed by
10 Hewlett-Packard's
11 Printing Performance Architecture (PPA) printers (HP DeskJet 710C, 712C, 720C,
12 722C, 820C, and 1000C series).
13 .PP
14 (PNM format output can be produced from PostScript(tm) input by the
15 GhostScript output devices "pbmraw", "pgmraw" or "ppmraw", or by "pnmraw",
16 which will choose one of these formats as appropriate for the document.)
17 .PP
18
19 .SH OPTIONS
20 .\"{{{ -b bottommargin
21 .IP "\fB\-b \fIbottommargin\fR\fP"
22 Sets the bottom margin \fIbottommargin\fR in units of 1/600 inches (e.g., \fB -b 150\fP corresponds to 0.25").
23 .\"}}}
24
25 .\"{{{ -B blackness
26 .IP "\fB\-B \fIblackness\fR\fP"
27 Sets the black ink density \fIblackness\fR in drops per pixel (0,1,2,3,4).
28 .\"}}}
29
30 .\"{{{ --bi
31 .IP "\fB\--bi\fP"
32 Force bidirectional print sweeps.
33 .\"}}}
34
35 .\"{{{ --bw
36 .IP "\fB\--bw\fP"
37 Disables the color cartridge; will print in grey scale using only the black cartridge.
38 .\"}}}
39
40 .\"{{{ -d
41 .IP "\fB\-d\fP"
42 Displays the current configuration.
43 .\"}}}
44
45 .\"{{{ --eco
46 .IP "\fB\--eco\fP"
47 Econofast mode: lower print quality that is faster and saves ink.
48 .\"}}}
49
50 .\"{{{ -f configFile
51 .IP "\fB\-f \fIconfigFile\fR\fP"
52 Re-reads configuration from \fIconfigFile\fR (after
53 initially reading it from /etc/pnm2ppa.conf).
54 .\"}}}
55
56 .\"{{{ -F GammaFile
57 .IP "\fB\-F \fIGammaFile\fR\fP"
58 Overrides reading the color-correction table (Gamma curve) from the default
59 file /etc/pnm2ppa.gamma, and uses \fIGammaFile\fR instead.
60 .\"}}}
61
62 .\"{{{ --fd
63 .IP "\fB\--fd\fP"
64 Enable fast ordered dithering instead of using the slower, but beautiful, Floyd-Steinberg dithering. (Has no effect in --bw mode.)
65 .\"}}}
66
67 .\"{{{ -g
68 .IP "\fB\-g\fP"
69 Prints a page of color intensity samples (for comparison with gamma.ppm
70 data produced by calibrate_ppa).
71 This is part of a \fBcolor-correction\fP procedure; see COLOR.txt for more details.
72 .\"}}}
73
74 .\"{{{ -h, --help
75 .IP "\fB\-h, --help\fP"
76 Displays program usage.
77 .\"}}}
78
79 .\"{{{ -i infile
80 .IP "\fB\-i \fIinfile\fR\fP"
81 Input file \fIinfile\fR is either a path to a PPM file, or '-' to indicate stdin (defaults to stdin).
82 .\"}}}
83
84 .\"{{{ -l leftmargin
85 .IP "\fB\-l \fIleftmargin\fR\fP"
86 Sets the left margin \fIleftmargin\fR in units of 1/600 inches (e.g., \fB-l 150\fP corresponds to 0.25").
87 .\"}}}
88
89 .\"{{{ --noGamma
90 .IP "\fB\--noGamma\fP"
91 Switches off any color-correction.
92 .\"}}}
93
94 .\"{{{ -o outfile | -
95 .IP "\fB\-o \fIoutfile\fR | - \fP"
96 Output file \fIoutfile\fR is either a path to a file or device, or '-' to indicate stdout (defaults to stdout).
97 .\"}}}
98
99 .\"{{{ -p
100 .IP "\fB\-p\fP"
101 Disables the black ink cartridge; i.e., print using only the color ink cartridge, even for printing "black". This might be useful for printing high-quality
102 color images.
103 .\"}}}
104
105 .\"{{{ -r rightmargin
106 .IP "\fB\-r \fIrightmargin\fR\fP"
107 Sets the right margin \fIrightmargin\fR in units of 1/600 inches (e.g., \fB-r 150\fP corresponds to 0.25").
108 .\"}}}
109
110 .\"{{{ -s papersize
111 .IP "\fB\-s \fIpapersize\fR\fP"
112 Sets the default paper size (now used only for color-correction output
113 produced by the \fB-g\fP option).
114 In normal use, pnm2ppa now instead reads the paper dimensions from
115 pnm input file headers, and
116 checks that it is a valid papersize for the given printer model.
117 Possible values for \fIpapersize\fR are \fBa4\fP (A4),
118 \fBletter\fP or \fBus\fP (US Letter, 8.5"x11"), \fBlegal\fR (US Legal,
119 8.5"x14").
120 The default is US Letter.
121 .\"}}}
122
123 .\"{{{ -t topmargin
124 .IP "\fB\-t \fItopmargin\fR\fP"
125 Sets the top margin \fItopmargin\fR in units of 1/600 inches (ie \fB-t 150\fP corresponds to 0.25").
126 .\"}}}
127
128 .\"{{{ --uni
129 .IP "\fB\--uni\fP"
130 Force unidirectional (left to right) print sweeps. Useful if
131 "shearing" is a problem for high quality color images.
132 .\"}}}
133
134 .\"{{{ -v printertype
135 .IP "\fB\-v \fIprintertype\fP"
136 Selects the printer model. Possible values of \fIprintertype\fR are:
137 \fB710\fP, \fB712\fP, \fB720\fP, \fB722\fP, \fB820\fP and \fB1000\fP.
138 The default is the HP DeskJet 7X0 Series (710, 712, 720, 722).
139 .\"}}}
140
141 .\"{{{ --verbose
142 .IP "\fB\--verbose\fP"
143 Displays the program's System Log messages on the standard output, as well.
144 .\"}}}
145
146 .\"{{{ --version
147 .IP "\fB\--version\fP"
148 Displays the program's version information.
149 .\"}}}
150
151 .\"{{{ -x xoffset
152 .IP "\fB\-x \fIxoffset\fR\fP"
153 Sets the x-offset \fIxoffset\fR from the left of the page. Units are 1/600 inches.
154 .\"}}}
155
156 .\"{{{ -y yoffset
157 .IP "\fB\-y \fIyoffset\fR\fP"
158 Sets the y-offset \fIyoffset\fR from the top of the page. Units are 1/600 inches.
159 .\"}}}
160
161
162 .SH NOTES
163 The default configuration file \fI/etc/pnm2ppa.conf\fR is read in first. Command line arguments then modify the resulting definitions.
164 .PP
165 The \fB-v\fP option resets all definitions (margins, offsets, etc.) back to
166 the inbuilt defaults for that printer and should be used before subsequent
167 \fB-b\fP, \fB-l\fP, \fB-r\fP, \fB-t\fP, \fB-x\fP and \fB-y\fP arguments.
168 .SH "SEE ALSO"
169 pnm(5), ppm(5), pbm(5)
170
171 .SH FILES
172
173 .\"{{{ /etc/pnm2ppa.conf
174 .IP "\fB\fI/etc/pnm2ppa.conf\fR\fP"
175 Default configuration file.
176 .\"}}}
177
178 .\"{{{ /etc/pnm2ppa.gamma
179 .IP "\fB\fI/etc/pnm2ppa.gamma\fR\fP"
180 Default Gamma (color-correction) file.
181 .\"}}}
182
183 .SH AUTHOR
184 This code is licensed under the GNU Public License version 2. See
185 LICENSE for details.
186 .PP
187 (c) 1998-1999 Tim Norman
188 .PP
189 (c) 1999 Giorgio Marzano
190 .PP
191 (c) 1999 Andrew van der Stock
192 .PP
193 (c) 1998-2000 Various authors for many, many fixes
194 .SH HISTORY
195 This program was originally pbm2ppa, written by Tim Norman. It originally
196 supported black and white output on the 820 series.
197 Tim added nascent color support in early
198 1999. In May 1999, Giorgio Marzano started making real headway in getting
199 color support working properly. Andrew van der Stock has maintained
200 the code since September 1999, and made it available at
201 http://sourceforge.net/projects/pnm2ppa.
202 .SH BUGS
203 Faint horizontal lines marking boundaries between print sweeps may be visible.
204 For best results when printing images, use the options \fB -p --uni \fP.
205
0 <!doctype linuxdoc system>
1 <article>
2
3 <!-- Title information -->
4
5 <title>PPA Printer calibration for pnm2ppa
6 <author>The pnm2ppa project team
7 <htmlurl url="mailto:ppa-rpms@sourceforge.net"
8 name="ppa-rpms@users.sourceforge.net">
9 <date>v0.4, October 28, 2000
10 <abstract>
11 Information and instructions
12 for printer calibration using pnm2ppa.
13 <htmlurl
14 url="http://sourceforge.net/projects/pnm2ppa"
15 name="http://sourceforge.net/projects/pnm2ppa">
16 (Updated for pnm2ppa-1.02 and later.)
17 </abstract>
18
19 <!-- Begin the document -->
20
21
22 <p>
23 <bf> Overview of Printer Calibration.</bf>
24
25 There are three main tasks you may need to carry out to fine-tune
26 your PPA printer:
27 <itemize>
28 <item>Adjust the x-offset and y-offset to <bf>correctly center
29 the printed page on the paper</bf>
30 <item>Adjust the relative offsets between black and colored ink
31 printing - <bf>this should be done each time you replace an ink
32 cartridge</bf>.
33 <item> Match the colors of printed images to some other output device
34 - this is <bf>color correction</bf> and is
35 described in
36 <htmlurl
37 url="./COLOR.html"
38 name="COLOR.html"> (or COLOR.txt).
39 </itemize>
40
41 These instructions assume that you are already able to print postscript
42 files with your PPA printer. If your print filters
43 are properly configured, something like &quot;<tt>lpr test.ps</tt>&quot;
44 will successfully invoke ghostscript and pnm2ppa
45 to print the postscript file test.ps. Alternatively, you may be using
46 shell scripts like &quot;lprbw&quot;, &quot;lprcolor&quot;
47 and &quot;lpreco&quot; supplied with the
48 pnm2ppa source code, and modified by you for your defaults; you may also
49 have defined special printing devices in <tt>/etc/printcap</tt>, e.g.
50 a &quot;coloreco&quot; device so you print
51 with <tt>lpr -P coloreco test.ps</tt>. These details vary with
52 the operating system and distribution you use.
53
54 <p>
55 <bf> (1) Centering the printed page on the paper. </bf>
56
57 This is done by adjusting the x-offset and y-offset parameters
58 <bf>xoffset</bf> and <bf>yoffset</bf>
59 in the <tt>pnm2ppa</tt> configuration file (usually
60 <tt>/etc/pnm2ppa.conf</tt>). The parameters are given in units of
61 1/600 inch; increasing <tt>xoffset</tt> moves the image
62 to the right, and increasing <tt>yoffset</tt> moves it downwards.
63 These offsets now have default values defined for each printer model,
64 and you will probably not need to adjust them.
65 Uncomment and make small adjustments to the default
66 values for these in the configuration file, until the printout is satisfactory.
67 (You can also use the '-x' and '-y'
68 command-line parameters.)
69
70
71 There are two ways to check the offsets.
72 <itemize>
73 <item>either <bf>using the "<tt>calibrate_ppa</tt>" program.</bf>
74 <item>or <bf>printing a suitable test page</bf>.
75
76 </itemize>
77
78 <p>
79 The "<tt>calibrate_ppa</tt>" program is a
80 stand-alone program distributed with <tt>pnm2ppa</tt> which
81 creates various test patterns in the raw
82 pixmap format accepted by pnm2ppa. (The three paper sizes,
83 US Letter, US Legal, and A4, are supported).
84 If your paper size is A4, and your printer filter accepts
85 the "<tt>-l</tt>" (direct output) option to <tt>lpr</tt>,
86 the command to run is:
87 <tscreen><verb>
88 calibrate_ppa -s a4 --center | pnm2ppa --bw -i - -o - | lpr -l
89 </verb></tscreen>
90 (Substitute "letter" or "legal" for "a4" to change
91 the papersize; if no paper size is specified, it is assumed to
92 be <tt>letter</tt>.)
93
94
95
96 If "<tt>lpr -l</tt>" is not valid, you need to know which port your
97 printer is attached to. Assuming it is <tt>/dev/lp0</tt>, the above
98 command becomes
99 <tt> calibrate_ppa -s a4 --center | pnm2ppa --bw -i - -o /dev/lp0</tt>.
100
101
102 The pattern shows distances from the edge of the printed page
103 in units of 50 dots (1/12 inch), and diagonal lines that should
104 point to the corners. Change <tt>xoffset</tt> and <tt>yoffset</tt>
105 in the configuration file (usually <tt>/etc/pnm2ppa.conf</tt>
106 to center the pattern. The configuration file is
107 supplied with commented-out entries like
108 <tt>#xoffset 160</tt> showing the default value. Remove
109 the &quot;<tt>#</tt>&quot to activate the entry.
110
111 In Red Hat or Mandrake Linux distributions, a suitable test page is
112 <tt>/usr/lib/rhs/rhs-printfilters/testpage.ps</tt>
113 (US Letter paper) or
114 <tt>/usr/lib/rhs/rhs-printfilters/testpage-a4.ps</tt>
115 (A4 paper). (If these are not available, similar test pages
116 are supplied in the pnm2ppa source distribution.)
117 These pages have margins drawn at standard distances from the
118 edges of the paper, and can also be used to check the centering,
119 but are not as accurate
120
121
122
123
124 <bf> (2) Calibrating the X and Y Color Head Offsets. </bf>
125
126 The color ink offsets now have to be calibrated with respect to the black ink.
127 Because the relative position of the two ink cartridges
128 can move slightly,
129 <bf>this must be done whenever an ink cartridge is removed and replaced</bf>.
130
131 To print an alignment calibration pattern on a4 paper, run
132 <tscreen><verb>
133 calibrate_ppa -s a4 --align | pnm2ppa --fd -i - -o - | lpr -l
134 </verb></tscreen>
135
136 On the printed page, there are four alignment patterns,
137 corresponding to configuration file
138 parameters <bf>ColOffsX</bf>, <bf>ColOffsY</bf>, <bf>colorshear</bf>
139 and <bf>blackshear</bf>. The central alignment patterns,
140 labelled &quot;0&quot; should be perfectly aligned. If they are
141 not, first
142 correct the shearing patterns, (see below).
143 Then identify the best-aligned <bf>ColOffsX</bf>
144 and <bf>ColOffsY</bf> patterns, and add or subtract the
145 positive or negative number below the pattern from the value in
146 the configuration file.
147
148 Check the result by printing the alignment test pattern:
149 <tscreen><verb>
150 calibrate_ppa --test | pnm2ppa -fd -i - -o - | lpr -l
151 </verb></tscreen>
152 The lines in the cross and square should be perfectly straight now.
153
154 The calibration can also be done by printing the test page
155 <tt>test.ps</tt> (found in the tarball
156 <tt>pnm2ppa-1.0.tar.gz</tt>; or installed
157 with the <tt>pnm2ppa</tt> documentation. (This is often in
158 <tt>/usr/doc/pnm2ppa*/</tt>.)
159
160 On the printout you see several images:
161 <itemize>
162 <item>top left, you see a square with both black and colored items.
163 These should align correctly, or you have to change your settings.
164 <item>You see a large vertical bar, and also a horizontal bar.
165 On the sides of the vertical bar there are a blue and a green line.
166 These should align with the 0 mark.
167 <item> You also see a small vertical, and horizontal, bar, with a
168 red bar on its side.
169 </itemize>
170
171 If these items do NOT line up, you should take the following steps:
172 <itemize>
173 <item>
174 (1) take for the large bar the number of the tickmark just smaller
175 than the place where the green and blue lines point to. The minor
176 tick marks are 25 points.
177 <item>
178 (2) To this number, add the number of the tick mark at which a red tick
179 mark exactly lines up. This might not work if the offsets are way off;
180 in that case, apply the correction of step 1, and print again.
181 <item>
182 (3) Add the horizontal offset to the value
183 of <bf>ColOffsX</bf>, and the vertical offset to
184 the value of <bf>ColOffsY</bf> in the configuration file.
185 </itemize>
186
187 Now you can print test.ps again to see whether this procedure worked.
188
189
190 <bf>Shearing adjustments</bf>
191
192 If bidirectional printing causes &quot;shearing&quot; of vertical lines
193 (horizontal offsets of those parts of the line printed
194 by left-to-right print-head sweeps relative to those printed on
195 right-to-left sweeps) you can make small adjustments (in 1/600 inch)
196 units using the <bf>blackshear</bf> and <bf>colorshear</bf>
197 parameters in the configuration file. You can also suppress
198 bidirectional printing with a <bf>unimode 1</bf>
199 configuration file entry.
200
201 The third and fourth lines on the color head offset calibration page
202 (see above) correspond to color and black print head shearing corrections.
203 If the central alignment patterns (labeled &quot;0&quot;)
204 are not aligned, add or subtract the positive or negative number
205 below the best-aligned pattern from the <tt>colorshear</tt>
206 and <tt>blackshear</tt> values in the configuration file.
207
208 <bf>Cleaning the Print Heads</bf>
209
210 You can use <tt>calibrate_ppa</tt> to clean the print heads by
211 printing patterns that exercise all the ink nozzles:
212 <tscreen><verb>
213 calibrate_ppa --clean | pnm2ppa -p -i - -o - | lpr -l
214 calibrate_ppa --clean | pnm2ppa --bw -i - -o - | lpr -l
215 </verb></tscreen>
216 The first of these commands prints a cleaning pattern
217 with colored ink, the second uses black ink.
218
219
220 <bf>Other adjustments</bf>
221
222 The parameter <bf>blackness</bf> adjusts the number of black ink
223 drops printed per pixel. It takes values 1, 2, 3, or 4 (2 is the
224 default). Other values, like 0, suppress black ink.
225
226 Inks can also be suppressed by configuration file
227 entries
228 <tt>black_ink 0</tt>,
229 <tt>color_ink 0</tt>,
230 <tt>cyan_ink 0</tt>,
231 <tt>magenta_ink 0</tt>,
232 or <tt>yellow_ink 0</tt>.
233 These are mainly useful for debugging
234 the printer driver.
235
236 </article>
237
238
239
240
241
242
243
244
245
246
247
248
249
250
0 <!doctype linuxdoc system>
1 <article>
2
3 <!-- Title information -->
4
5 <title>Color correction for pnm2ppa
6 <author>The pnm2ppa project team
7 <htmlurl url="mailto:ppa-rpms@sourceforge.net"
8 name="ppa-rpms@users.sourceforge.net">
9 <date> v0.6, October 28, 2000
10 <abstract>
11 Information and instructions
12 for color correction of pnm2ppa
13 color printing.
14 <htmlurl
15 url="http://sourceforge.net/projects/pnm2ppa"
16 name="http://sourceforge.net/projects/pnm2ppa">
17 (Updated for pnm2ppa-1.0 and later.)
18 </abstract>
19
20 <!-- Begin the document -->
21
22
23 <p>
24 <bf> Overview of Color correction.</bf>
25
26 Color Pixmap input to <tt>pnm2ppa</tt> (ppm format, produced
27 by the ghostscript output devices <tt>ppmraw</tt> or <tt>ppm</tt>)
28 specifies the color of a pixel as three coordinates (Red, Green, Blue) in the
29 range 0-255. The program <tt>pnm2ppa</tt> converts these to relative amounts
30 of Cyan, Magenta and Yellow ink drops printed on the page.
31
32 <bf>Color correction</bf> allows the user to attempt to match the printed
33 colors to some reference colors, such as those displayed on the
34 terminal, or those printed on a different printer, or those printed
35 on the same printer with a different
36 driver (such as the Win9x drivers supplied by HP with their PPA printers).
37
38
39 The color output from <tt>pnm2ppa</tt> can be controlled in two ways:
40 <itemize>
41 <item> by a color correction &quot;gamma&quot; file, if it is installed.
42 By default this file is
43 <tt>/etc/pnm2ppa.gamma</tt>,
44 but it may also be specified with the pnm2ppa option
45 <tt> pnm2ppa ... -F gammafile ... </tt>.
46 <item> if there is no gamma file, by three values
47 specified by keywords ( either
48 <tt>GammaR</tt>,
49 <tt>GammaG</tt>,
50 <tt>GammaB</tt>
51 or
52 <tt>RedGammaIdx</tt>,
53 <tt>BlueGammaIdx</tt>,
54 <tt>GreenGammaIdx</tt>) in the
55 <tt>pnm2ppa</tt> configuration file.
56 </itemize>
57
58
59 <tt>pnm2ppa</tt> will carry out <bf>&quot;color correction&quot;</bf>,
60 unless it is called with the <bf>--noGamma</bf> command line option.
61 However, unless you set up a color correction scheme, the default
62 color correction does not change any colors.
63
64
65 Color correction is specified by three color intensity
66 functions (curves), one for each of
67 Red, Green, and Blue. In their simplest form, these curves
68 have a standard form controlled
69 by a single &quot;gamma&quot; parameter such as
70 <tt>GammaR</tt>. The more sophisticated correction, in the
71 file <tt>pnm2ppa.gamma</tt>, specifies these curves more generally
72 as a table of numbers that translate each possible
73 color intensity value to a new value.
74
75
76
77 Note that, in principle, different color corrections are needed
78 for different print quality settings, and for different
79 brands and qualities of paper!
80
81 At present the methods for constructing a color correction for
82 <tt>pnm2ppa</tt> are not very user-friendly. If you can improve
83 them, please help!.
84
85 <bf>
86 Color correction with &quot;gamma&quot; values in the configuration file.</bf>
87 <p>
88 The PixMap (ppa) format specifies colors by an intensity for
89 each primary color, Red, Green and Blue, in the range 0-255, so
90 (0,0,0) is black, and (255,255,255) is white.
91 The standard color intensity enhancement function replaces the ppm
92 intensity <tt>i</tt> of each primary color by
93 <tt> Enh(i) </tt> which is the closest integer
94 to ( i / 256) raised to the power
95 <tt>Gamma</tt>, times 256.
96
97
98 You can specify the Gamma values in the configuration file
99 as decimal numbers <tt>GammaR</tt>, <tt>GammaG</tt>, <tt>GammaB</tt>,
100 but how do you find out what values to choose?. Perhaps by experimenting
101 with changing the Gamma values.
102
103 A source of information on Gamma color correction is
104 <htmlurl url="http://www.cgsd.com/papers/gamma.html"
105 name="www.cgsd.com/papers/gamma.html">
106
107
108 One method for constructing a Gamma correction
109 has been built into <tt>pnm2ppa</tt>, but it
110 wastes quite a lot of ink, and many users
111 find it less effective than producing a customized
112 color correction curve as described in the next section.
113
114
115 You must first use pnm2ppa to print a color test page, and then
116 generate a file <tt>gamma.ppm</tt> to compare to it.
117 To do this, type
118 <tscreen><verb>
119 pnm2ppa -g -i - -o /dev/lp0
120 </verb></tscreen>
121 (replace <tt>/dev/lp0</tt> by whatever printer device your PPA printer uses,
122 or use <tt> ... -o - | lpr -l </tt>, etc.). Note also that
123 as <tt>pnm2ppa</tt> is not receiving any ghostscript input to tell it
124 the paper size, this must be correctly specified by a configuration
125 file entry or, e.g., a <tt> -s a4 </tt> option, if the default US Letter
126 paper is not being used. This procedure will print a color calibration
127 page.
128
129 The printed output is an array of sets of three colored bands,
130 red, blue and green, each of which increases in brightness from
131 left to right. The topmost set of bands should be referrred to as
132 bands &quot;0&quot;, the next ones as &quot;1&quot;, etc.
133
134 Next, run the extra program <tt>calibrate_ppa</tt> which will produce
135 a (large, 10MB) PixMap (ppm) file:
136 <tscreen><verb>
137 calibrate_ppa -g -o gamma.ppm
138 </verb></tscreen>
139 This will produce the PixMap file as
140 <tt>gamma.ppm</tt> in the current directory.
141
142 To color-correct the printer so that its colors match those on the
143 terminal screen,
144 you should now attempt to view the file <tt>gamma.ppm</tt>
145 using some application
146 (such as the GNU image manipulation program <tt>gimp</tt>, or <tt>xv</tt>)
147 that can view <tt>.ppm</tt> files. For each color, identify the
148 printed band (0, 1, 2, ... etc)
149 that most closely corresponds to the brightness profile
150 shown on the screen. The default values are now:
151 <tscreen><verb>
152 RedGammaIdx 0
153 GreenGammaIdx 0
154 BlueGammaIdx 0
155 </verb></tscreen>
156 (i.e., no color correction).
157 Enter your modified values for these in the <tt>pnm2ppa</tt>
158 configuration file (usually <tt>/etc/pnm2ppa.conf</tt>).
159
160 The actual Gamma value is then <bf>1.0 - 0.033*(Color)GammaIdx </bf>;
161
162 To color-correct with respect to another printer (or the Win9x drivers),
163 you must manage to print <tt>gamma.ppm</tt> on that other device, then
164 make the comparison. (Or print the output of <tt>pnm2ppa -g </tt>
165 on that device; the top line is the same uncorrected color data as
166 <tt>gamma.ppm</tt>.)
167
168 <bf>
169 Color correction using a &quot;gamma file&quot;.
170 </bf>
171
172 A &quot;gamma correction file&quot; is a binary file containing
173 3 x 256 numbers,
174 which are lookup tables of corrected red green and blue
175 color intensities.
176
177 The program <tt>pnm2ppa</tt> will use a default correction file
178 <tt>/etc/pnm2ppa.gamma</tt> if it exists, unless the
179 <tt>--noGamma </tt> option is used. The default correction file
180 location can be changed by using the <tt>pnm2ppa</tt>
181 option <tt>-F gammafile </tt>, where &quot;gammafile&quot; is the name
182 (including the full path) of the gamma correction file to be used.
183
184
185 Currently, there are two available tools for constructing a gamma
186 correction file:
187 <itemize>
188 <item>
189 A graphical utility <tt>ppagammacorrect</tt> is available in the
190 PPA Color Correction Utilities section of
191 the <tt>pnm2ppa</tt> web page
192 <htmlurl
193 url="http://sourceforge.net/projects/pnm2ppa"
194 name="http://sourceforge.net/projects/pnm2ppa">,
195 (but at the time of writing,
196 this appears to be frozen in early stages of development, with
197 little documentation, and may not be fully functional).
198 <item>
199 A working procedure is given in
200 <htmlurl
201 url="http://download.sourceforge.net/pnm2ppa/color-calibrate-1.0.tar.gz"
202 name="http://download.sourceforge.net/pnm2ppa/color-calibrate-1.0.tar.gz">,
203 which is made available by Klamer Schutte.
204 <bf>This is the method recommended by many users.</bf>
205 </itemize>
206
207 </article>
208
209
210
211
212
213
214
215
216
217
218
219
220
221
0 <!doctype linuxdoc system>
1 <article>
2
3 <!-- Title information -->
4
5 <title>PPA Printer-Support RPM Packages for MANDRAKE Linux distributions.
6 <author>The pnm2ppa project team
7 <htmlurl url="mailto:ppa-rpms@sourceforge.net"
8 name="ppa-rpms@users.sourceforge.net">
9 <date>v0.1 Nov 11, 2000
10 <abstract>
11 Information about using pnm2ppa
12 with Mandrake.
13 (Updated for pnm2ppa-1.04 and later.)
14 </abstract>
15
16 <!-- Begin the document -->
17
18
19 <p>
20 <bf> Mandrake-specific issues.</bf>
21
22 See the document
23 <htmlurl
24 url="file:INSTALL.REDHAT.html"
25 name="INSTALL.REDHAT.html">
26 for installation and setup. That document is written
27 for Red Hat; note the Mandrake-specific differences
28 listed below,
29
30 <itemize>
31 <item> Mandrake 7.0 and earlier has incompatible and non-functional
32 <tt>pnm2ppa</tt> support which must be replaced.
33 Please use
34 <tt>printtool</tt> to delete any installed PPA printers BEFORE
35 upgrading <tt>rhs-printfilters</tt>. (If you forget to do this, and
36 printtool will not start after the update, delete or move your
37 <tt>/etc/printcap</tt> file.)
38 Install the <tt>pnm2ppa</tt> RPM package.
39 Then update <tt>rhs-printfilters</tt> with
40 <tt>rhs-printfilters-1.58-4ppa5mdk.i386.rpm</tt>
41 from
42 <htmlurl
43 url="http://sourceforge.net/projects/pnm2ppa"
44 name="http://sourceforge.net/projects/pnm2ppa">.
45 (Do <bf>NOT</bf> use <tt>rhs-printfilters-1.57-4ppa4.i386.rpm</tt>
46 which is for RedHat systems only.)
47 <item>
48 Mandrake-7.1 supplies a <tt>pnm2ppa</tt> RPM and has support for
49 it in <tt>rhs-printfilters</tt>. Mandrake 7.1 has a configuration
50 tool <tt>DrakConf</tt> for setting up printers, which may
51 be an interface to <tt>printtool</tt>.
52 Some users have reported difficulties with this. In that case, just use
53 <tt>printtool</tt> to configure the printer.
54 <item>
55 Mandrake-7.2 does not have a separate <tt>pnm2ppa</tt> RPM package, but has
56 added <tt>pnm2ppa</tt> to the <tt>ghostscript</tt> RPM package. This creates
57 difficulties for updating <tt>pnm2ppa</tt> with the RPM package from
58 <htmlurl
59 url="http://sourceforge.net/projects/pnm2ppa"
60 name="http://sourceforge.net/projects/pnm2ppa">.
61 You will get reported conflicts with <tt>ghostscript</tt>
62 if you try to install the
63 <tt>pnm2ppa-1.04-1.i386.rpm</tt> package,
64 but it seems that you can
65 safely use the rpm option <tt>--force</tt> to force its installation.
66 Mandrake-7.2 also has moved to using CUPS as its printing system,
67 and appears to now have its own printer configuration tool, but still
68 includes <tt>pnm2ppa</tt> support in <tt>rhs-printfilters</tt>.
69 </itemize>
70 </article>
0 <!doctype linuxdoc system>
1 <article>
2
3 <!-- Title information -->
4
5 <title>PPA Printer-Support RPM Packages for Red Hat Linux and Compatible Distributions
6 <author>The pnm2ppa project team
7 <htmlurl url="mailto:ppa-rpms@sourceforge.net"
8 name="ppa-rpms@users.sourceforge.net">
9 <date>v0.27, Nov 11, 2000
10 <abstract>
11 Information and installation instructions
12 to accompany pnm2ppa packages
13 for Red Hat Linux available at
14 <htmlurl
15 url="http://sourceforge.net/projects/pnm2ppa"
16 name="http://sourceforge.net/projects/pnm2ppa">
17 (Updated for pnm2ppa-1.04 and later.)
18 See the &quot;Troubleshooting&quot; section at the end of
19 this document for
20 fixes to some reported problems
21 </abstract>
22
23 <!-- Begin the document -->
24
25
26 <p>
27 <bf> Overview of HP's PPA DeskJet Printers.</bf>
28
29 Most of Hewlett-Packard's DeskJet(tm) printers use the PCL3 command language,
30 and are currently supported by Ghostscript drivers. However, a few models,
31 namely
32 <itemize>
33 <item> <em>DeskJet 710C Series</em>: HP DeskJet 710C, 712C
34 <item> <em>DeskJet 720C Series</em>: HP DeskJet 720C, 722C
35 <item> <em>DeskJet 820C Series</em>: HP DeskJet 820Cxi, 820Cse
36 <em>(discontinued)</em>
37 <item> <em>DeskJet 1000C Series</em>: HP DeskJet 1000Cxi, 1000Cse
38 <em>(discontinued)</em>
39 </itemize>
40
41 feature &quot;Host-based&quot; printing,
42 and use HP's proprietary
43 PPA (<em>Printer Performance Architecture</em>) protocol,
44 instead of PCL. The two models in each series are physically
45 identical;
46 they just come with different bundled Windows software.
47 The 820C and 1000C series are discontinued at this time (January 2000).
48
49 PPA printers rely on software running on the
50 host CPU to carry out the low-level processing
51 of printer output that would be done by hardware in
52 a standard PCL printer. The relation of PPA printers to PCL printers
53 is analogous to the relation between &quot;Winmodems&quot; and true modems.
54
55 Unfortunately, HP only supplies Windows software drivers for PPA printers,
56 and have indicated that it is unlikely that
57 they will ever make the proprietary PPA specs public.
58 This is apparently because of concerns that
59 publication of the specs might reveal crucial details
60 of HP's trade secrets about &quot;color science&quot; to competitors.
61 (A secondary issue
62 is that it is apparently possible to physically
63 damage the printer by sending it
64 bad sequences of PPA commands, which is not the case for PCL commands,
65 and it seems that HP do not wish to take any responsibility for such damage by
66 encouraging unofficial PPA programming.)
67
68 In fact,
69 the decline in hardware component prices has meant that the anticipated
70 cost-savings through using host-based PPA instead of printer-based PCL
71 are less than expected, and two of the PPA printer series
72 (820C, 1000C) have been phased out, and replaced by similar PCL printers
73 in HP's product line. The 710C and 720C series are still being sold
74 at this time of writing. <bf> All other currently-offered
75 DeskJet models appear to be standard PCL3
76 printers.</bf>
77
78
79 Many Linux users may have inadvertently purchased PPA DeskJet models,
80 mistaking them for PCL3 DeskJets, for which independently-produced
81 Linux drivers have long
82 been available. Fortunately, a reverse engineering effort,
83 started in 1998 by Tim Norman,
84 <htmlurl
85 url="http://www.normsoft.com/ppa"
86 name="http://www.normsoft.com/ppa">
87 and
88 <htmlurl
89 url="http://pnm2ppa.sourceforge.net"
90 name="http://pnm2ppa.sourceforge.net">,
91 and continued by the <em>pnm2ppa</em> project at
92 <htmlurl
93 url="http://sourceforge.net/projects/pnm2ppa"
94 name="http://sourceforge.net/projects/pnm2ppa">
95 has managed to produce drivers that provide basic printing
96 functionality for these PPA printers under Linux and other
97 Unices.
98
99
100
101 <p>
102 <bf> The pnm2ppa driver for color printing with PPA printers.</bf>
103
104 Color printing with PPA printers is supported by the
105 <em><tt>pnm2ppa</tt></em> driver which is the successor to the older
106 black-and-white-only driver
107 <htmlurl url="http://pnm2ppa.sourceforge.net/files/pbm2ppa-0.8.6.tar.gz"
108 name="pbm2ppa-0.8.6"> developed by Tim Norman.
109
110
111 <tt>pnm2ppa</tt>
112 can translate <em>portable anymap</em> (<em>pnm</em>)
113 format images into a stream of PPA instructions which can be sent to the
114 printer. In the driver name,
115 &quot;<em>pnm</em>&quot; stands for the superset
116 of <em>three</em> image formats:
117 <em>ppm</em> (portable &quot;pixmap&quot; format for color images),
118 <em>pgm</em> (portable &quot;greymap&quot; format for greyscale images),
119 and <em>pbm</em> (portable &quot;bitmap&quot; format for black and white images).
120
121 Ghostscript has a number of &quot;output devices&quot; that
122 produce pnm format output from postscript or pdf input.
123 These come in <em>plain</em> (text) and <em>raw</em>
124 (binary) variants. While <tt>pnm2ppa</tt> can now interpret
125 both plain and raw pnm formats, there is no point in using the
126 inefficient plain formats: <em>always</em> use the &quot;raw&quot;
127 output devices, which are:
128 <itemize>
129 <item><em>ppmraw</em> - raw pixmap format (color images);
130 <item><em>pgmraw</em> - raw greymap format (greyscale images);
131 <item><em> pbmraw</em> - raw bitmap format (black and white images);
132 <item><em>pnmraw</em> - selects between ppm, pgm, and pbm raw formats;
133 <item><em>pgnmraw</em> - selects between pgm and pbm raw formats.
134 </itemize>
135 The last two output devices are switches that try to analyze the
136 image, and select an appropriate format; however, they are not
137 recommended for routine use, as they may inconsistently choose the format.
138 The <tt>ghostscript-5.10</tt>
139 package supplied with Red Hat 6.x distributions provides all these
140 devices; older versions may not. To see the list of available
141 ghostscript output devices, type the command line
142 <tscreen><verb>
143 gs --help
144 </verb></tscreen>
145 if the required <tt>ppmraw</tt> or
146 <tt>pbmraw</tt> devices are not shown, you will have to upgrade your
147 version of ghostscript.
148
149 The data must be streamed directly from ghostscript to
150 <tt>pnm2ppa</tt> to the (local) printer without being
151 stored in any intermediate
152 file: one ppm-format (color) US Letter size page is represented
153 by 3x5100x6600 Bytes (100MB) in binary format and four times this amount in
154 text format.
155
156
157 An example of
158 a command line for printing a postscript
159 file <tt>file.ps</tt> using <tt>gs</tt> (ghostscript) and <tt>pnm2ppa</tt> is
160 <tscreen><verb>
161 cat file.ps | gs -q -sDEVICE=ppmraw -r600 -sPAPERSIZE=letter -dNOPAUSE \
162 -sOutputFile=- - | pnm2ppa --eco -v 720 -i - -o - | lpr -l
163 </verb></tscreen>
164 (all on a single line). In this example the paper size is explicitly
165 given to <tt>gs</tt> as <em>US Letter</em>
166 (8.5&quot;x11&quot;) size
167 (<tt>letter</tt>); <tt>pnm2ppa</tt> no longer needs to be told what
168 the paper size is, and will read it from the <tt>gs</tt> output (and check
169 that it is a permitted size for the printer type).
170 The <tt>pnm2ppa</tt> option <tt>--eco</tt> specifies &quot;EconoFast&quot;
171 mode, for a lower quality output which uses less ink, and prints faster,
172 and <tt>-v 720</tt> specifies the PPA printer as belonging
173 to the DeskJet 720C series.
174
175
176 Obviously, it would be impractical to type such a command each time
177 one wished to print something, so in addition to the <tt>pnm2ppa</tt>
178 driver itself, an enhanced version of Red Hat's <tt>rhs-printfilters</tt>
179 RPM package is provided; after this is installed, the PPA printer
180 can be managed like other standard printers with the Red Hat
181 <tt>printtool</tt> utility. The postscript file can then be printed with
182 the simple command
183 <tscreen><verb>
184 lpr file.ps
185 </verb></tscreen>
186
187 <itemize>
188 <item>
189 <em>
190 However, if you wish to print to paper sizes supported by ghostscript,
191 but not supported by the Red Hat <tt>printtool</tt> utility, you can
192 use scripts like the one above.
193 The HP 710C, 720C, and 820C series support paper sizes from
194 3&quot;x3&quot; to 8.5&quot;x14&quot;, while the 1000C
195 supports 4&quot;x6&quot; to 13&quot;x19&quot;.
196 </em>
197 </itemize>
198
199 <p>
200 <bf> Available RPM packages.</bf>
201
202 A RPM package for <tt>pnm2ppa</tt> is part of the Red Hat Linux
203 distribution starting with Red Hat 6.2.
204 You will also find a RPM package for the latest release of
205 <tt>pnm2ppa</tt>
206 at
207 <htmlurl
208 url="http://sourceforge.net/projects/pnm2ppa"
209 name="http://sourceforge.net/projects/pnm2ppa">.
210
211 The latest version at the time
212 of writing is
213 <tt>pnm2ppa-1.04-1.i386.rpm</tt>, and is built on
214 Red Hat 6.2. If you are running a different release
215 of Red Hat (or a different Linux distribution)
216 you may need to download and rebuild the source RPM
217 <tt>pnm2ppa-1.04-1.src.rpm</tt> instead:
218 <tscreen><verb>
219 rpm --rebuild pnm2ppa-1.04-1.src.rpm
220 </verb></tscreen>
221 (You must be <tt>root</tt> to do this, and have the necessary
222 compilers installed; on Red Hat, the rebuilt binary RPM will be created in
223 the directory <tt>/usr/src/redhat/RPMS/i386/</tt>.)
224
225 Red Hat 6.2 and later also includes support for configuring your
226 printer to use <tt>pnm2ppa</tt> using <tt>printtool</tt>
227 and <tt>rhs-printfilters</tt>.
228 If you are using Red Hat 6.1 and earlier,you will need to
229 update the <tt>rhs-printfilters</tt> that came with the distribution
230 to the
231 <tt>rhs-printfilters-1.57-4ppa4.i386.rpm</tt> also available at
232 <htmlurl
233 url="http://sourceforge.net/projects/pnm2ppa"
234 name="http://sourceforge.net/projects/pnm2ppa">.
235 (This is designed to work only with <tt>printtool-3.43</tt> and earlier.)
236
237
238 Note: If you are using Red Hat 6.2, you may wish to update the
239 print filter support that it comes with. The <tt>pnm2ppa-1.04-1</tt>
240 RPM package supplies the necessary files that you can use.
241 After installing this RPM, see
242 <tt>/usr/lib/rhs/rhs-printfilters/README.ppa</tt> for details.
243
244 <p>
245 <bf> Installing the <tt>pnm2ppa</tt> RPM package and setting up the PPA printer.</bf>
246
247 To install the RPM package, you must log in as the system administrator,
248 <tt>root</tt>.
249
250 Now begin the installation. First install the <tt>pnm2ppa</tt> RPM:
251 <tscreen><verb>
252 rpm -Uvh pnm2ppa-1.04-1.i386.rpm
253 </verb></tscreen>
254 The <tt>pnm2ppa</tt> executable gets installed in <tt>/usr/bin/</tt>.
255
256 If you are using a 2.2.x kernel,
257 (e.g. Red Hat 6.x)
258 it will be able to autodetect
259 IEEE-1284 devices like PPA printers, provided they are attached
260 to the parallel port with a bidirectional IEEE-1284 cable. (If your
261 printer works under Windows, you have the correct cable.)
262 (Note that older (2.0.x) kernels do not have this autoprobe facility.)
263 A script <tt>detect_ppa</tt> is provided by the <tt>pnm2ppa</tt>
264 RPM: just type
265 <tscreen><verb>
266 detect_ppa
267 </verb></tscreen>
268 to confirm that your Printer is found.
269
270 It is possible (especially on Red Hat 6.1) that you will have to add
271 a line
272 <tscreen><verb>
273 alias parport_lowlevel parport_pc
274 </verb></tscreen>
275 to the file <tt>/etc/conf.modules</tt> for the printer to be found (this is
276 a parallel port recognition issue, not specific to PPA printers.
277 and a known &quot;gotcha&quot; on Red Hat 6.1).
278 A typical message from the printer, which will
279 be displayed if autodetection is successful, is:
280 <tscreen><verb>
281 CLASS:PRINTER;
282 MODEL:DESKJET 820C;
283 MANUFACTURER:HEWLETT-PACKARD;
284 DESCRIPTION:Hewlett-Packard DeskJet 820C;
285 COMMAND SET:SCP,VLINK;
286 </verb></tscreen>
287 A list of PPA printers found, and the parallel ports to which they are
288 attached, will also be shown.
289
290
291 At this point it is useful to test that your printer is working, by
292 printing a test page using the supplied script <tt>test_ppa</tt>
293 which the RPM has installed. You will need to know your
294 printer model (710, 712, 720, 722, 820, 1000), your paper size
295 (letter, legal, a4) and the printer port the printer is attached to.
296 If it is attached to the primary parallel port, this is
297 <em><tt>/dev/lp1</tt></em> under older 2.0.x kernels, and (usually)
298 <em><tt>/dev/lp0</tt></em> under newer 2.2.x kernels, as in Red Hat 6.x.
299 Type
300 <tscreen><verb>
301 test_ppa
302 </verb></tscreen>
303 and give the details about printer model. papersize, and port number
304 when prompted.
305 You will then be asked
306 whether to print a test page, an offset calibration
307 page, or an alignment calibration page, etc.
308 <itemize>
309 <item> <em><em>Tip:</em>
310 The </em><tt>test_ppa</tt><em> script
311 does not use the print filters that
312 will be installed by the </em><tt>rhs-printfilters</tt><em> RPM, so it is
313 useful when troubleshooting, for testing if any printing problems are
314 associated with the basic printer installation, or with the
315 configuration of the print filters.</em>
316 </itemize>
317
318 <p>
319 <bf> Installing the PPA-enhanced <tt>rhs-printfilters</tt> RPM package (if needed).</bf>
320
321 <itemize>
322 <em>
323 This step is NOT needed on Red Hat 6.2 or later.</em>
324 </itemize>
325
326 The <tt>rhs-printfilters</tt> rpm distributed with
327 Red Hat 6.1 does not support <tt>pnm2ppa</tt>,
328 If you use an older distribution, you will first have to replace their
329 <tt>rhs-printfilters</tt> RPM with the PPA-enhanced version from the
330 pnm2ppa project.
331
332 Once you have confirmed you have a working printer, install the
333 RPM <tt>rhs-printfilters-1.57-4ppa4.i386.rpm</tt>
334 <tscreen><verb>
335 rpm -Uvh rhs-printfilters-1.57-4ppa4.i386.rpm
336 </verb></tscreen>
337
338 <bf> Configuring the print filters with <tt>printtool</tt>.</bf>
339
340 Now start the &quot;<em>Red Hat Linux Print System Manager</em>&quot;
341 (as root) to
342 configure the printer, either
343 by clicking on the printer icon in Red Hat's &quot;control-panel&quot;, or just
344 typing
345 <tscreen><verb>
346 printtool
347 </verb></tscreen>
348 In the Print System Manager window, click on <em>Add</em>, then
349 in the &quot;Add a Printer Entry&quot;, select <em>Local Printer</em>, and
350 click <em>Ok</em>. Hopefully, the port on which the printer is attached
351 will be listed as &quot;Detected&quot; (<em>if not,
352 fix the problem before continuing</em>, perhaps by
353 adding the line &quot;<tt>alias parport_lowlevel parport_pc</tt>&quot;
354 to <tt>/etc/conf.modules</tt>), as mentioned above.
355 You will now have to &quot;<em>edit
356 the local printer entry</em>&quot; for the PPA printer. Click on
357 <em>Select</em> to chose the &quot;Input filter&quot;.
358 The <em>Configure Filter</em> screen will open.
359 Among the many printer entries in the list
360 &quot;<em>Printer Type</em>&quot;, you should find three entries
361 <itemize>
362 <item><bf>HP DeskJet 1000 series (PPA)</bf> (for 1000Cse, 1000Cxi models)
363 <item><bf>HP DeskJet 710/720 series (PPA)</bf> (for 710C, 712C, 720C, 722C models)
364 <item><bf>HP DeskJet 820 series (PPA)</bf> (for 820Cse, 820Cxi models)
365 <itemize>
366 <item> If these entries do not show up, it may be because the older
367 <tt>rhs-printfilters</tt> package that you updated did not allow
368 the printer database <tt>/usr/lib/rhs/rhs-printfilters/printerdb</tt>
369 to be replaced. Try deleting or renaming the <tt>printerdb</tt>
370 file, and then reinstall
371 the PPA-enhanced <tt>rhs-printfilters</tt> RPM using
372 &quot;<tt>rpm --force -Uvh rhs-printfilters*</tt>&quot;
373 </itemize>
374 </itemize>
375
376
377 Select the appropriate
378 entry for your printer model. You will then be presented with
379 various options:
380 <itemize>
381 <item>
382 The <em>Driver Description</em> box contains information about the
383 driver (you may have to use the scrollbar at the right of the box
384 to read it all).
385 <item>The <em>resolution</em> box shows a single
386 resolution (600x600). There are no other choices.
387 <item>
388 The <em>Paper Size</em> box allows
389 various choices (only <em>letter</em>, <em>legal</em>, and <em>a4</em>
390 seem correspond to native paper sizes printed by the Red Hat print filters;
391 the other choices, (a3, ledger, ...) appear to get resized by
392 the print filters to print on US Letter size paper (?) ).
393 (Other paper sizes cannot be selected this way, but you <em>can</em>
394 print to any papersize, <em>if it supported by both ghostscript
395 and the printer</em>, using a script, as described above, that bypasses
396 the RedHat printfilters.)
397 <item>
398 The <em>Color Depth/ Uniprint Mode</em> box allows various selections
399 of color and print quality (These are achieved by
400 using various combinations
401 of the <tt>pnm2ppa</tt> options
402 <em>--eco</em> (EconoFast mode), <em>-p</em> (disable black
403 ink cartridge) and <em>--bw</em> (black and white printing only),
404 without direct intervention by the user.) The choices (in the
405 most recent <tt>printerdb</tt> database) are:
406 <itemize>
407 <item> Black and White, econofast mode (<tt>--bw --eco</tt>)
408 <item> Black and White, normal quality (<tt>--bw</tt>)
409 <item> Color, econofast mode (<tt>--eco --fd</tt>)
410 <item> Color, normal quality (<tt>--eco</tt>)
411 <item> Color, high quality
412 <item> Color, normal quality, black ink disabled (<tt>-p --eco</tt>)
413 <item> Color, high quality, black ink disabled (<tt>-p --uni</tt>)
414 </itemize>
415 (These are the choices that will be presented by &quot;official&quot;
416 <tt>rhs-printfilters-1.72</tt>; if you installed a <tt>pnm2ppa</tt>
417 RPM package from
418 <htmlurl
419 url="http://sourceforge.net/projects/pnm2ppa"
420 name="the SourceForge pnm2ppa site">, you may have a file
421 <tt>/usr/lib/rhs/rhs-printfilters/README.ppa</tt> explaining how to modify
422 earlier versions of <tt>rhs-printfilters</tt> to show these updated
423 choices.)
424
425 You may also see a choice to use the older &quot;Legacy&quot;
426 driver <tt>pbm2ppa</tt> (black and white only); this is
427 is stable but unmaintained; it may still be a useful
428 alternative to <tt>pnm2ppa</tt> on older, slower systems with
429 less available memory.
430
431 <item>
432 The three <em>Printing options</em> are not relevant here, and
433 should <em>not</em> be selected. They are for direct printing
434 of text (ascii) to non-postscript printers, but since the only way of printing
435 text files with <tt>pnm2ppa</tt> is
436 by first converting them to postscript(tm), this is <em>not</em>
437 possible on the PPA printer.
438 <itemize>
439 <item>
440 <em>It is important that the choice </em>
441 &quot;Fast text printing (non-PS printers only)&quot;<em> is NOT selected,
442 so that the print filters will
443 convert text files to postscript before printing.</em>
444 </itemize>
445 <item>The <em>Margins</em>
446 entries control the margins used when printing text files
447 (these are instructions to the text-to-postscript
448 conversion process).
449 <item>
450 The <em>Extra GS options</em> box is not only a place for adding
451 options for ghostscript, but also for the PPA drivers.
452 <em>Leave this box empty unless you know what you are doing</em>.
453 As explained in the text in the Driver Description box
454 (you did read it, didn't you ?), the entry should be in the format:
455 <tscreen><verb>
456 gs_options PPA ppa_options
457 </verb></tscreen>
458 Anything before the
459 &quot;<tt>PPA</tt>&quot; is interpreted as a <tt>gs</tt> option, anything after it
460 is interpreted as a <tt>ppa</tt> option. You can learn about
461 <tt>pnm2ppa</tt> options by typing either &quot;<tt>man pnm2ppa</tt>&quot;
462 or &quot;<tt>pnm2ppa --help</tt>&quot; at a command line (hopefully, these
463 two sources of information will be consistent with each other!);
464 </itemize>
465 When you have made your choices, click on <em>Ok</em> to
466 save your selections and close the &quot;Configure Filter&quot; screen,
467 and then click on <em>OK</em> to close the &quot;Edit Local Printer Entry&quot;
468 screen.
469
470 You are now back in the &quot;Red Hat Print System Manager&quot; screen;
471 highlight the printer you just configured, and, in the <em>Tests</em>
472 menu, choose <em>Print Postscript test page</em> to print a test page using
473 the Red Hat print filters. If this printed correctly, your
474 print system is set up to use the PPA printer, just like any of the other
475 printers that the Red Hat print filters support.
476
477
478
479 <p>
480 <bf> Configuring pnm2ppa.conf and calibrating the printer. </bf>
481
482 A number of printer parameters are set to reasonable default values
483 for each of the printer models, but you may wish to &quot;fine tune&quot;
484 or calibrate your printer. The default values can be overridden
485 by entries in the configuration files, which by default are
486 <tt>/etc/pnm2ppa.conf</tt> and <tt>/etc/pbm2ppa.conf</tt>.
487 At 600dpi, one pixel is 1/600 inch.
488
489 The user-adjustable parameters are:
490 <itemize>
491 <item> <bf>verbose 1</bf> and <bf>silent 1</bf>. These control
492 messages about progress and errors from <tt>pnm2ppa</tt>. By default,
493 messages are sent to the system log <tt>/var/log/messages</tt>.
494 The <tt>verbose 1</tt> keyword send copies to <tt>stderr</tt>, the
495 standard error stream to the terminal. The <tt>silent 1</tt>
496 keyword silences the stream of messages to the system log.
497 <itemize>
498 <item>
499 <bf> The system log messages may be silenced in the default
500 configuration file; switch off &quot;silent&quot;
501 mode with &quot;silent 0&quot; for debugging printer
502 problems (or use verbose mode).</bf>
503 </itemize>
504 <item> The <bf>version</bf> keyword can be used to specify
505 the printer model as 710, 712, 720, 722, 820, or 1000.
506 It is not needed if you use the RedHat printool to
507 configure the printer.
508
509 <item> <bf>xoffset</bf> and <bf>yoffset</bf>: the x-offset and y-offset
510 (in pixels) of the
511 printed image on the page, which should be chosen so the image
512 is correctly centered on the paper. (These can also be set with
513 the <tt> -x &lt;xoff&gt; </tt> and <tt> -y &lt;yoff&gt; </tt> options.)
514 See <htmlurl
515 url="./CALIBRATION.html"
516 name="CALIBRATION.html"> (or CALIBRATION.txt) for more information.
517
518
519 <item> <bf>topmargin</bf>, <bf>bottommargin</bf>, <bf>leftmargin</bf>,
520 <bf>rightmargin</bf>: the four
521 margins, which define the distances (in pixels)
522 from the edges of the paper to the
523 printed region; parts of the image that are outside these margins
524 will not be printed.
525 (These can also be set with the
526 <tt> -t &lt;top margin&gt; </tt>,
527 <tt> -b &lt;bottom margin&gt; </tt>,
528 <tt> -l &lt;left margin&gt; </tt>, and
529 <tt> -r &lt;right margin&gt; </tt>
530 options.)
531
532 <item> <bf>ColOffsX</bf> and <bf>ColOffsY</bf>: the x-offset and y-offset
533 (in pixels)
534 between the color image produced by the color ink printer head, and that
535 produced by the black ink printer head.
536 These should be recalibrated
537 <bf> each time an ink cartridge is replaced</bf>.
538 See <htmlurl
539 url="./CALIBRATION.html"
540 name="CALIBRATION.html"> (or CALIBRATION.txt) for more information.
541
542 <item> <bf>blackshear</bf> and <bf>colorshear</bf>: these are x offsets
543 between right-to-left and left-to-right sweeps of the print head, one for
544 the black printing and one for the color printing. These provide sideways
545 offsets (in pixels) of the right-to-left sweeps,
546 that can be used to correct &quot;shearing&quot; when printing
547 in modes that use bidirectional print head sweeps.
548
549 <item><bf>unimode 1</bf> will make unidirectional
550 print sweeps (left-to-right) the default, instead
551 of bidirectional sweeps. The <tt>--uni</tt>
552 and <tt>--bi</tt> options can control how a particular print
553 run is printed. Unidirectional printing is only useful
554 (it is slower) if there are issues of &quot;shearing&quot;
555 in high quality image printing.
556
557 <item> <bf>blackness</bf> : this takes values 0,1,2,3 or 4 drops of
558 black ink per pixel, and controls black ink density in black-and-white
559 and &quot;text-like&quot; black regions in color printing. At present,
560 this has no effect on printing with the black ink cartridge disabled,
561 or on black regions identified as &quot;image-like&quot;. (This can
562 also be set with the <tt> -B &lt;n&gt;</tt> option,
563 where <tt>n</tt> is the number of drops.)
564
565
566 <item><bf>GammaR</bf>, <bf>GammaG</bf>, and <bf>GammaB</bf>:
567 the are the three &quot;gamma&quot; parameters that define the
568 standard color correction
569 curves for red, green, and blue. Changing these will affect how
570 colors appear (decreasing any Gamma enhaces the corresponding color).
571 The Gamma values are specified as decimal numbers,
572 with Gamma = 1.0 corresponding to no color correction.
573 <item>
574 Gamma values can also be specified using integer numbers
575 <bf>RedGammaIdx</bf>, <bf>GreenGammaIdx</bf>, <bf>BlueGammaIdx</bf>;
576 These are determined by a procedure discussed in
577 <htmlurl
578 url="./COLOR.html"
579 name="COLOR.html"> or COLOR.txt,
580 which involves printing a test page. The <bf>papersize</bf>
581 keyword specifies the paper size used for this testpage,
582 because it is produced by <tt>pnm2ppa</tt> without the input that
583 usually specifies the page size.
584 <item>
585 The keywords
586 <bf>black_ink 0</bf>,
587 <bf>color_ink 0</bf>,
588 <bf>cyan_ink 0</bf>,
589 <bf>magenta_ink 0</bf>,
590 and <bf>yellow_ink 0</bf>
591 can be used to switch of the various inks; this can be useful
592 in troubleshooting and debugging <tt>pnm2ppa</tt>.
593 </itemize>
594
595 Use <tt>test_ppa</tt> to print various test pages
596 or calibration patterns to adjust the offsets.
597
598 If you wish to specify these
599 parameters using the command-line options
600 described above, some of them can be
601 entered in the &quot;extra GS options&quot; box using the Print System Manager
602 (<tt>printtool</tt>), as described above.
603
604
605 <p>
606 <bf> Utility programs for the printer.</bf>
607
608 HP's Windows software provides a utility program
609 that sends PPA commands to tell the printer to perform
610 taks like cleaning the printheads, etc. The codes for some
611 of these functions have already been reverse engineered.
612 There are proposals to add support for PPA printers to the
613 PUP (Printer Utility Program) utility, which is
614 also a project at
615 <htmlurl
616 url="http://www.sourceforge.net/project/?group_id=1118"
617 name="http://www.sourceforge.net">.
618 However, as of the time of writing, no PUP support
619 for PPA printers is available (volunteers, anyone?).
620
621 <p>
622 <bf>Troubleshooting</bf>
623
624 The first thing to do is to look at the messages from <tt>pnm2ppa</tt>
625 in the system log to see what is happening, whether <tt>pnm2ppa</tt>
626 <bf>actually received any input</bf>, and if it was valid.
627 <bf> (You may need to enable system log messages in
628 <tt>/etc/pnm2ppa.conf</tt>, see above.)</bf>
629 Maybe ghostscript failed to convert your postscript file into
630 PNM format: this is <bf>not</bf> a <tt>pnm2ppa</tt> problem!
631 Here are suggestions for dealing with problems that you may encounter.
632 <itemize>
633 <item><bf> Printing fails in the middle of a print run</bf>, perhaps
634 when a figure embedded in the document is printing (in the latest
635 <tt>pnm2ppa</tt> versions, printing finishes normally, but an incomplete
636 document is printed). The system log
637 reports that <tt>read_line</tt> could not read the image, and found EOF
638 (end-of-file). This probably
639 means that <tt>ghostscript</tt>'s &quot;ppmraw&quot; or
640 &quot;pgmraw&quot; output device failed for some reason,
641 usually leaving a core dump, without completing the
642 translation of the postscript to a pnm format.
643 (This has been seen to happen in ghostscript 5.10 ;
644 upgrading to ghostscript 5.50 solved the problem.) If you cannot
645 upgrade, try printing the document
646 in black-and-white using the ghostscript &quot;pbmraw&quot; output device.
647 <item>
648 <bf>The <tt>test_ppa</tt> script works,
649 but you can't get <tt>printtool</tt> to make the printfilters work.</bf>
650
651 You installed <tt>pnm2ppa-1.0</tt> and the PPA-enhanced
652 <tt>rhs-printfilters</tt> (earlier than v. 1.61) from the pnm2ppa
653 SourceForge page. You are using <tt> printtool</tt> v. 3.43 or earlier
654 and are probably a Mandrake user.
655 Solution: (a) use <tt>printtool </tt> to uninstall the PPA printer;
656 (b) delete (or rename) the printer database
657 <tt>/usr/lib/rhs/rhs-printfilters/printerdb</tt>, and reinstall
658 the <tt>rhs-printfilters</tt> RPM using the
659 &quot;<tt>rpm --force ... </tt>&quot;
660 option; (c) use <tt>printtool</tt> to add the
661 PPA printer again.
662 (Your previously-installed <tt>rhs-printfilters</tt> may have
663 resisted replacement of its <tt>printerdb</tt>).
664 <item>
665 <bf>You upgraded your RedHat (or compatible) Linux distribution
666 and your printfilters no longer work</bf>.
667 You used to use a PPA-enhanced <tt>rhs-printfilters</tt> from the
668 pnm2ppa SourceForge site. You
669 upgraded your distribution to one using <tt>printtool</tt> v 3.44 or later
670 (e.g. RedHat 6.2).
671 Solution: Make sure that
672 <tt>rhs-printfilters</tt> has been updated to a version
673 1.61 or greater that came with your
674 upgraded distribution.
675 Use <tt>printtool</tt> to delete, and then add the
676 PPA printer
677 This will create a new printer configuration compatible
678 with your upgraded distribution.
679 <item>
680 <bf>You printed an image file using a &quot;high quality&quot;
681 printer setting, but it has visible horizontal lines
682 on it </bf>and printing under Windows(tm) 9x doesn't
683 show this effect (except in &quot;economode&quot;).
684 These are probably &quot;swath boundaries&quot;,
685 showing the junction between different sweeps of the print head.
686 Solution: using unidirectional printing (PPA option <tt>--uni</tt>,
687 or <tt>unimode 1</tt> in <tt>/etc/pnm2ppa.conf</tt>) helps a little, but
688 this problem requires an extensive
689 rewrite of part of pnm2ppa (<tt>cutswath.c</tt>)
690 for a satisfactory solution. (Volunteers welcome - see the TODO file in the
691 pnm2ppa docs (<tt>/usr/doc/pnm2ppa*/TODO</tt>)!)
692 <item>
693 &quot;<bf>Flashing light syndrome</bf> &quot;.
694 Your printer usually works, but you have found that some particular
695 documents cause the printer to fail, and the lights on its panel
696 start flashing rapidly in sequence. Solution, turn the printer off and back
697 on again. This is not supposed to happen any more; if it happens
698 reproducibly, contact the pnm2ppa developers, and offer to
699 make the offending
700 file available for testing and diagnosis of this problem.
701 (Don't sent it to the Mailing List unless requested).
702 Bug reports can be filed at
703 <htmlurl
704 url="http://sourceforge.net/projects/pnm2ppa"
705 name="the SourceForge pnm2ppa site">.
706 <item>
707 <bf>You wish to print on envelopes or other non-standard media
708 not supported by the print filters</bf>?
709 Solution: if you can get Ghostscript (<tt>gs</tt>) to
710 produce the correct image, and the paper size is in the range allowed
711 by your printer, you should be able to do this with a
712 script that bypasses the print filters, as described earlier
713 in this document.
714 <item>
715 <bf>Colors look wrong, or do not match what the Windows(tm) 9x driver
716 produces</bf>. Solution: check that
717 your color ink cartridge is
718 not running out of some ink color; if not,
719 (a) adjust the &quot;gamma&quot;
720 entries in <tt>/etc/pnm2ppa,conf</tt>, or (b)
721 install a customized color calibration file
722 <tt>/etc/pnm2ppa.gamma</tt>. See the file
723 <htmlurl
724 url="./COLOR.html"
725 name="COLOR.html"> (or COLOR.txt) for more information.
726 </itemize>
727
728 <p>
729 <bf>Contacting the pnm2ppa project.</bf>
730
731 Send comments or corrections (about this document or the RPMS) to:
732 <htmlurl url="mailto:ppa-rpms@sourceforge.net"
733 name="ppa-rpms@users.sourceforge.net">
734
735 There are three mailing lists,
736 <em>ppa.announce</em> (announcements),
737 <em>ppa.users</em> (users helping users)
738 and <em>ppa.devel</em> (developers).
739 You can subscribe to them, or browse their
740 archives, at
741 <htmlurl
742 url="http://pnm2ppa.sourceforge.net"
743 name="http://pnm2ppa.sourceforge.net/maillist.htm">.
744
745 To contact the developers, subscribe to <em>ppa.devel</em> and post a message.
746
747 There are Public Forums for posting questions
748 and comments
749 at <htmlurl
750 url="http://sourceforge.net/projects/pnm2ppa"
751 name="http://sourceforge.net/projects/pnm2ppa">
752 (but whether you get any help from these, depends on
753 whether anyone is reading them).
754
755 </article>
756
757
758
759
760
761
762
763
764
765
766
0
1 Ten projekt nie móg³ by powstaæ bez udzia³u tych osób:
2
3 Andrew van der Stock - wizjoner i g³owna osoba odpowiedzialna za rozbudowê kodu.
4
5 Ben Boule - pierwsza osoba, która pomog³a mi uzyskaæ informacjê o drukarce z serii
6 720 oraz testowa³a program na tym sprzêcie.
7
8 Giorgio Marzano - go¶æ od poprawiania b³êdów od maja 1999.
9
10 Jim Peterson - spêdzi³ mnóstwo godzin modyfikuj±c kod dla 720-tek i twórca
11 wielu usprawnieñ w³±czaj±c w to konfiguracjê.
12
13 Kirk Reiten - testowanie programu na drukarkach z serii 1000.
0 PPM -> PPA konwerter
1 --------------------
2
3 XXX Prosimy o pomoc w pracy nad tym programem ni¿ o raporty o b³êdach w nim...
4 XXX
5
6 Copyright (c) 1998-1999 Tim Norman, Giorgio Marzano, Andrew van der Stock
7 and others
8
9 Licenja
10 -------
11
12 Ten program podlega prawom wg. licencji GNU General Public License. Przeczytaj
13 plik LICENSE aby dowiedzieæ siê wiêcej szczegó³ów.
14
15
16 CO TO TAKIEGO?
17 --------------
18
19 Ten program obs³uguje protokó³ zwany PPA (Printer performance architecture).
20 Protokó³ ten jest wykorzystywany w Win-drukarkach HP DeskJet (720,820,1000,710)
21 By³ testowany na wszystkich powy¿szych jednak ka¿da uwaga co do pracy na nowym
22 modelu jest mile widziana.
23
24 INSTALACJA
25 ----------
26
27 Wszystkie informacje zawarte s± w pliku INSTALACJA
28
29 INFORMACJE DODATKOWE
30 --------------------
31
32 Szczegó³owe informacje nt. protoko³u PPA oraz tego programu uzyskasz na naszej
33 stronie:
34 http://www.httptech.com/ppa/
35
36 KONTAKT
37 -------
38
39 Je¶li ten program jest dla Ciebie u¿yteczny, PROSIMY o kontakt!!!
40 Chcemy wiedzieæ jak wiele osób korzysta z naszej pracy.
41 Kontakt email: tim@normsoft.com
42
43 (T³umaczenie Tomasz Patora <tpatora@zly.kis.p.lodz.pl>
44
45
46
47
48
49
0 CO TO JEST
1 ----------
2
3 W tym pliku znajduje siê krótka nota dotycz±ca instalacji. Je¶li informacje zawarte
4 w tym tek¶cie oka¿± siê niewystarczaj±ce wiêcej informacji uzyskasz z pliku
5 INSTALACJA-DOKLADNA.
6
7 Kompilacja
8 ----------
9
10 Aby stworzyæ program wystarczy napisaæ:
11
12 make
13
14 Je¶li u¿ywasz NetBSD lub FreeBSD musisz dokonaæ zmian w pliku Makefile (aby do³±cz±³
15 dodatkow± bibliotekê "libgnugetopt", która jest wymagana przez program pnm2ppa).
16
17 INSTALACJA
18 ----------
19
20 Tworzy dwa pliki wykonywalne: calibrate i pnm2ppa. Calibrate - tego programu u¿ywaj do
21 ustawienia marginesów. Wiêcej szczegó³ów znajduje siê w pliku KALIBRACJA
22
23 Drugim programem jest pnm2ppa. Jest to konwerter formatu PBM na PPA. PBM jest to surowa
24 postaæ pliku w którym zawarte s± informacje gdzie i w jakim kolorze wydrukowaæ punkt.
25 (podstawowym programem u¿ywanym do generowania tego rodzaju plików jest GhostScript)
26 PPA jest to natomiast protokó³ transmisji miêdzy komputerem a Win-drukark±. Standartowym
27 rozmiarem drukowania jest 600dpi oraz rozmiar papieru US Letter. Dodatkowo program
28 pnm2ppa rozumie formaty pbm, pbmraw, pnm, pnmraw. Ten ostatni jest najszybszy, wiêc je¶li
29 masz mo¿liwo¶æ u¿ywaj go.
30
31 U¿ywanie
32 --------
33
34 Aby wydrukowaæ stronê postscript przy u¿yciu tego programu zosta³y stworzone
35 skrypty.
36
37 Wydruk o najlepszej jako¶ci w kolorze w rozmiarze US Letter
38
39 cat $1 | gs -sDEVICE=ppmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
40 pnm2ppa -i - -o - | lpr
41
42 w rozmiarze US Legal
43
44 cat $1 | gs -sDEVICE=ppmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
45 pnm2ppa -i - -o - | lpr
46
47 w rozmiarze A4
48
49 cat $1 | gs -sPAPERSIZE=a4 -sDEVICE=ppmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
50 pnm2ppa -i - -o - | lpr
51
52 itd...
53
54 W szczególno¶ci powinno takie rzeczy ustawiæ siê w filtrze programu drukarki (np.:lpd).
55 Wiêcej informacji, jak to zrobiæ dowiesz siê z dokumentacji u¿ywanego filtru lub
56 przeczytaj plik INSTALACJA.SUSE z którego dowiesz siê jak ustawiæ filtr lpd dla
57 tekstu i plików postscript.
58
59
60
61
62
63
64
65
0 0. Informacje
1
2 Ten tekst opisuje, jak zainstalowaæ program pbm2ppa napisany przez Tima Normana
3 w systemie S.u.S.E Linux System. Ten program wykorzystuje GDI (dla Windofsow)
4 daj±c mo¿liwo¶æ korzystania z drukarki w systemie Linux. Aktualnie program jest
5 konwerterem pomiêdzy formatem PBM (np. tworzonego przez GhostScript) a formatem
6 PPA zjadliwym dla win-drukarek z serii 710/720, 820 i 1000.
7 Do druku najwygodniej jest u¿ywaæ GhostScripta, któremu zlecamy zrobienie
8 pliku pbmraw (mo¿e te¿ byæ pbm, ale za to wolniej bêdzie siê to drukowaæ).
9
10 Z drukowaniem samego tekstu jest roboty. Z racji tego, ¿e drukarka go
11 nie zrozumie musimy zamieniæ tekst na format postscript i zrobiæ jak napisa³em
12 akapit wy¿ej. Zamiany tekstu ascii na postscript wykonuje program enscript.
13
14 Nie jest to proste ale nie panikuj. Autor dla wygody stworzy³ dwie drukarki
15 w spoolers (nie bêdê siê mêczy³ aby to przet³umaczyæ...), jedn± dla plików
16 ps, drug± dla plików ascii. Instalacja tego ustrojstwa to tylko 7 kroków.
17
18 1. Instalacja pakietu ppa-0.8.5
19
20 Pobierz pakiet ze strony http://www.rpi.edu/~normat/technical/ppa/ i sk±piluj
21 wpisuj±c:
22
23 # make XXX
24
25 (gdzie XXX to numer twojej win-drukarki, czyli 720,820 lub 1000. Je¶li masz drukarkê
26 z serii 710 to u¿yj opcji dla 720-stki. U mnie dzia³a...)
27
28
29 2. Ustaw papier na A4 u¿ywaj±c opcji -s A4 w programie pbm2ppa lub w pliku
30 pbm2ppa.conf wpisz "papersize a4" (patrz te¿ pkt.5)
31
32
33 3. Kalibracja.
34
35 Dla rozmiaru US wpisz
36 # pbmtpg | pbm2ppa > /dev/lp1 ( jako root )
37 Dla rozmiaru A4 wpisz
38 # pbmtpg -a4 | pbm2ppa -s a4 > /dev/lp1 ( jako root )
39
40
41 4. Teraz mo¿esz drukowaæ pliki postscript u¿ywaj±c nastêpuj±cego pliku shella:
42
43 cat $1 | gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
44 pbm2ppa - - >/dev/lp0
45
46 Je¶li zapiszesz to w pliku "print" (po oczywistej zmianie - chmod 755 print) mo¿esz
47 ju¿ drukowaæ pliki ps wpisuj±c
48
49 # print nazwapliku.ps
50
51 Je¶li zale¿y Ci na drukowaniu plików ascii to przepisz ten skrypt:
52
53 enscript -2rj -p- $1 | \
54 gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
55 pbm2ppa - - >/dev/lp1
56
57 Je¶li zapiszesz to w pliku "printascii" (po oczywistej zmianie - chmod 755 print)
58 mo¿esz ju¿ drukowaæ tekst wpisuj±c:
59
60 # printascii nazwapliku.ascii
61
62 (Uwaga: Parametry w tym skrypcie dla enscript s± ustawione na drukowanie tekstu w
63 dwóch kolumnach. Wiêcej informacji dotycz±cych konwersji ascii->ps przeczytasz w
64 instrukcji programu enscript.)
65
66 5. Mo¿liwe, ¿e powiniene¶ przekalibrowaæ swoj± drukarkê (patrz pkt.3)
67
68 Oto instrukcje w jaki sposób ustawiæ drukarkê aby poprawnie drukowa³± pliki ascii
69 przy u¿yciu skryptu printascii (patrz pkt.4)
70 Program pbm2ppa pobiera argumenty w podanej kolejno¶ci:
71
72 a) z lini poleceñ
73 b) z pliku konfiguracyjnego /etc/pbm2ppa.conf
74 c) z ustawieñ w pliku nag³ówkowym "default.h"
75
76 Najwygodniejszym rozwi±zaniem jest odpowiednia zmiana pliku konfiguracyjnego.
77 Oto przyk³ad jak to zrobiæ (/etc/pbm2ppa.conf):
78
79 # Przyk³adowa konfiguracyjna dla HP720 i papieru A4
80 #
81
82 version 720
83
84 papersize a4
85
86 xoff 0 # \ Ustaw to dla swojej drukarki.
87 yoff -600 # / (patrz plik KALIBRACJA)
88
89 # 1/4 cala marginesu z ka¿dej strony (dla 600 DPI)
90 # mo¿esz wpisaæ swoje warto¶ci...
91 top 50
92 bottom 50
93 left 50
94 right 50
95
96 6. Aby zescaliæ konwerter z systemem Linux tworzymy dwie drukarki w pliku
97 /etc/printcap. Jedna z nich obs³uguje postscript, druga pliki ascii.
98
99 Oto co wpisaæ do pliku /etc/printcap:
100
101
102 lp:\
103 :lp=/dev/lp1:\
104 :sd=/var/spool/lpd/lp:\
105 :lf=/var/spool/lpd/lp/log:\
106 :af=/var/spool/lpd/lp/acct:\
107 :if=/usr/local/bin/ps.if:\
108 :la:mx#0:\
109 :sh:sf:
110
111 ascii:\
112 :lp=/dev/lp1:\
113 :sd=/var/spool/lpd/ascii:\
114 :lf=/var/spool/lpd/ascii/log:\
115 :af=/var/spool/lpd/ascii/acct:\
116 :if=/usr/local/bin/ascii.if:\
117 :la:mx#0:\
118 :sh:sf:
119
120 Teraz trochê wyja¶nieñ. U¿ywamy standartowo portu /dev/lp1. Wykorzystujemy równie¿
121 katalogi /var/spool/lpd/ascii oraz /var/spool/lpd/lp (najlepiej stwórz je teraz).
122 Aby po³±czyæ konwerter pbm2ppa z systemem stworzyli¶my dwa filtry. Aby zaczê³o to
123 dzia³aæ nale¿y jeszcze stworzyæ dwa pliki:
124
125 Plik /usr/local/bin/ascii.if:
126
127 #! /bin/sh
128 enscript -2rj -p- | \
129 gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
130 /usr/local/bin/pbm2ppa - -
131
132
133 Plik /usr/local/bin/ps.if:
134
135 #! /bin/sh
136 gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
137 /usr/local/bin/pbm2ppa - -
138
139
140 7. Przekopiowaæ program pbm2ppa do /usr/local/bin. Teraz aby wydrukowaæ plik wpisz:
141
142 # lpr nazwapliku.ps
143
144 lub
145
146 # lpr -P ascii nazwapliku.ascii
147
148 I to na tyle.
149
150
151 19. May 1998
152
153 Michael Buehlmann
154 Badenerstrasse 285
155 8003 Zuerich
156 Switzerland
157
158 mbuehlma@stud.ee.ethz.ch
159
160 T³umaczenie Tomasz Patora
161 <tpatora@zly.kis.p.lodz.pl>
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
0 XXX
1 XXX Uwaga, Uwaga: Tak naprawdê, to mo¿e nie dzia³aæ...
2 XXX Spróbuj sam, mo¿e Tobie siê uda...
3 XXX
4
5 Kalibracja (ustawianie) pnm2ppa dla Twojej drukarki
6
7 Zanim zaczniesz drukowanie powiniene¶ skalibrowaæ drukarkê. Mo¿na to zrobiæ
8 u¿ywaj±c programu 'calibrate'. Proces ustawiania polega na wydrukowaniu strony
9 testowej o maksymalnym rozmiarze. Ca³a zabawa polega na takich ustawieniach
10 marginesu w pliku konfiguracyjnym, aby ca³a strona by³a wydrukowana w ca³o¶ci.
11
12 Program 'calibrate' jest prosty jak drut. Wyrzuca na wyj¶cie wzór testowy w formacie
13 pbmraw. Gdy skierujemy to co wypluje 'calibrate' do programu pnm2ppa przy u¿yciu komendy:
14
15 calibrate | pnm2ppa > /dev/lp1
16 ( jako <root> )
17
18 - lub -
19
20 calibrate | pnm2ppa | lpr -l
21 ( je¶li Twoj filtr drukarki rozpoznaje parametr '-l')
22
23 Wydrukowana strona powinna zawieraæ siatkê oraz liczby okre¶laj±ce wspó³rzêdne
24 pikseli. Na nieszczê¶cie pierwsze wydruki obcinaj± wydrukowan± stronê przy brzegach
25 strony. Je¶li tak siê dzieje powiniene¶ ustaliæ marginesy w pliku konfiguracyjnym
26 /etc/pnm2ppa.conf. Podane tam warto¶ci podane s± w jednostkach punktów na cal. Czyli
27 je¶li podamy tam warto¶æ np. 100, bêdzie to 100/600 cala (rozdzielczo¶æ druku 600dpi)
28 czyli 1/6cala. Je¶li szczê¶liwie uda Ci siê znale¼æ odpowiednie warto¶ci to mo¿esz je
29 wpisaæ na trzy sposoby: [1]do pliku konfiguracyjnego, [2] do pliku "global.h" i
30 przekompilowaæ ca³y program, [3] u¿ywaj±c parametrów '-x', '-y' przy uruchamianiu
31 programu. (osobi¶cie polecam rozwi±zanie [2]). Je¶li wszystko jest odpowiednio ustawione
32 to wydruk testowy powinien byæ na ¶rodku kartki. Marginesy prawdopodobnie powinny byæ nie
33 wiêksze ni¿ 1/4 cala bez efektu 'ucinania strony'.
34
0 /***************************************************************************
1 text-pl.h - polskie komunikaty
2 -------------------
3 begin : Thu Jan 21 2000
4 copyright : (C) 2000 by Tomasz Patora
5 email : ajv@greebo.net
6 ***************************************************************************/
7
8
9
10 /***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19 // messages from cutswath.c
20
21 /* 00 */ "cutswath(): nie mogê zaalokowaæ danych\n",
22
23 /* 01 */ "cutswath(): nie mogê przeczytaæ danych o górnym marginesie\n",
24
25 /* 02 */ "cutswath(): nie mogê przeczytaæ danych o bocznym marginesie\n",
26
27 /* 03 */ "cutswath(): nie mogê przeczytaæ nastêpnej lini\n",
28
29 /* 04 */ "cutswath(): nie mogê zaalokowaæ danych ppa\n",
30
31 /* 05 */ "ppa_print_page(): b³±d w wywo³aniu procedury cut_im_black_swath()\n",
32
33 /* 06 */ "ppa_print_page(): nieznany kod powrotu w switch\n",
34
35 /* 07 */ "ppa_print_page(): b³±d w wywo³aniu cut_im_color_swath()\n",
36
37 /* 08 */ "make_im_stat: nie mogê otczytaæ pliku gamma. Sprawdz uprawnienia dla pliku\n",
38 "FATALNIE: Nieznany b³±d\n"
0 /***************************************************************************
1 enh-curve.h - initial gamma correction table
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 unsigned char enh_curve[256] =
18 { 0, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 23, 24,
19 26, 27, 29, 30, 31, 33, 34, 35, 37, 38, 39, 40, 42,
20 43, 44, 45, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57,
21 58, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72,
22 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86,
23 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
24 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
25 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
26 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
27 130, 131, 132, 132, 133, 134, 135, 136, 137, 138,
28 139, 140, 141, 142, 143, 144, 145, 146, 146, 147,
29 148, 149, 150, 151, 152, 153, 154, 155, 156, 156,
30 157, 158, 159, 160, 161, 162, 163, 164, 165, 165,
31 166, 167, 168, 169, 170, 171, 172, 173, 173, 174,
32 175, 176, 177, 178, 179, 180, 180, 181, 182, 183,
33 184, 185, 186, 187, 187, 188, 189, 190, 191, 192,
34 193, 193, 194, 195, 196, 197, 198, 199, 199, 200,
35 201, 202, 203, 204, 205, 205, 206, 207, 208, 209,
36 210, 211, 211, 212, 213, 214, 215, 216, 216, 217,
37 218, 219, 220, 221, 221, 222, 223, 224, 225, 226,
38 226, 227, 228, 229, 230, 230, 231, 232, 233, 234,
39 235, 235, 236, 237, 238, 239, 239, 240, 241, 242,
40 243, 244, 244, 245, 246, 247, 248, 248, 249, 250,
41 251, 252, 252, 253, 254, 255
42 };
0 /***************************************************************************
1 fscoeff.h - floyd-steinberg coefficients, mapping colors to ink depths
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef __COEFF_H
18 #define __COEFF_H
19
20 short fs_err_coeff_e[] = {
21 -111, -111, -110, -110, -109, -109, -108, -108, -108,
22 -107, -107, -106, -106, -105, -105, -105,
23 -104, -104, -103, -103, -102, -102, -101, -101, -101,
24 -100, -100, -99, -99, -98, -98, -98,
25 -97, -97, -96, -96, -95, -95, -94, -94, -94, -93, -93,
26 -92, -92, -91, -91, -91,
27 -90, -90, -89, -89, -88, -88, -87, -87, -87, -86, -86,
28 -85, -85, -84, -84, -84,
29 -83, -83, -82, -82, -81, -81, -80, -80, -80, -79, -79,
30 -78, -78, -77, -77, -77,
31 -76, -76, -75, -75, -74, -74, -73, -73, -73, -72, -72,
32 -71, -71, -70, -70, -70,
33 -69, -69, -68, -68, -67, -67, -66, -66, -66, -65, -65,
34 -64, -64, -63, -63, -63,
35 -62, -62, -61, -61, -60, -60, -59, -59, -59, -58, -58,
36 -57, -57, -56, -56, -56,
37 -55, -55, -54, -54, -53, -53, -52, -52, -52, -51, -51,
38 -50, -50, -49, -49, -49,
39 -48, -48, -47, -47, -46, -46, -45, -45, -45, -44, -44,
40 -43, -43, -42, -42, -42,
41 -41, -41, -40, -40, -39, -39, -38, -38, -38, -37, -37,
42 -36, -36, -35, -35, -35,
43 -34, -34, -33, -33, -32, -32, -31, -31, -31, -30, -30,
44 -29, -29, -28, -28, -28,
45 -27, -27, -26, -26, -25, -25, -24, -24, -24, -23, -23,
46 -22, -22, -21, -21, -21,
47 -20, -20, -19, -19, -18, -18, -17, -17, -17, -16, -16,
48 -15, -15, -14, -14, -14,
49 -13, -13, -12, -12, -11, -11, -10, -10, -10, -9, -9, -8,
50 -8, -7, -7, -7,
51 -6, -6, -5, -5, -4, -4, -3, -3, -3, -2, -2, -1, -1, 0,
52 0, 0,
53 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7,
54 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13,
55 14,
56 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 20,
57 20, 21,
58 21, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 27,
59 27, 28,
60 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 34,
61 34, 35,
62 35, 35, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 41,
63 41, 42,
64 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 46, 47, 47, 48,
65 48, 49,
66 49, 49, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 55,
67 55, 56,
68 56, 56, 57, 57, 58, 58, 59, 59, 59, 60, 60, 61, 61, 62,
69 62, 63,
70 63, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69,
71 69, 70,
72 70, 70, 71, 71, 72, 72, 73, 73, 73, 74, 74, 75, 75, 76,
73 76, 77,
74 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83,
75 83, 84,
76 84, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 90,
77 90, 91,
78 91, 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97,
79 97, 98,
80 98, 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103,
81 103, 104, 104, 105,
82 105, 105, 106, 106, 107, 107, 108, 108, 108, 109, 109,
83 110, 110, 111, 111
84 };
85
86 short fs_err_coeff_se[] = {
87 -47, -47, -47, -47, -47, -46, -46, -46, -46, -46, -45,
88 -45, -45, -45, -45, -45,
89 -44, -44, -44, -44, -44, -43, -43, -43, -43, -43, -42,
90 -42, -42, -42, -42, -42,
91 -41, -41, -41, -41, -41, -40, -40, -40, -40, -40, -39,
92 -39, -39, -39, -39, -39,
93 -38, -38, -38, -38, -38, -37, -37, -37, -37, -37, -36,
94 -36, -36, -36, -36, -36,
95 -35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33,
96 -33, -33, -33, -33, -33,
97 -32, -32, -32, -32, -32, -31, -31, -31, -31, -31, -30,
98 -30, -30, -30, -30, -30,
99 -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -27,
100 -27, -27, -27, -27, -27,
101 -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, -24,
102 -24, -24, -24, -24, -24,
103 -23, -23, -23, -23, -23, -22, -22, -22, -22, -22, -21,
104 -21, -21, -21, -21, -21,
105 -20, -20, -20, -20, -20, -19, -19, -19, -19, -19, -18,
106 -18, -18, -18, -18, -18,
107 -17, -17, -17, -17, -17, -16, -16, -16, -16, -16, -15,
108 -15, -15, -15, -15, -15,
109 -14, -14, -14, -14, -14, -13, -13, -13, -13, -13, -12,
110 -12, -12, -12, -12, -12,
111 -11, -11, -11, -11, -11, -10, -10, -10, -10, -10, -9,
112 -9, -9, -9, -9, -9,
113 -8, -8, -8, -8, -8, -7, -7, -7, -7, -7, -6, -6, -6, -6,
114 -6, -6,
115 -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -3, -3, -3, -3,
116 -3, -3,
117 -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0,
118 0,
119 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3,
120 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6,
121 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9,
122 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
123 12,
124 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14,
125 14, 15,
126 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17,
127 17, 18,
128 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20,
129 20, 21,
130 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23,
131 23, 24,
132 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26,
133 26, 27,
134 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29,
135 29, 30,
136 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32,
137 32, 33,
138 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35,
139 35, 36,
140 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38,
141 38, 39,
142 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41,
143 41, 42,
144 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44,
145 44, 45,
146 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47,
147 47
148 };
149
150 short fs_err_coeff_s[] = {
151 -79, -79, -79, -78, -78, -78, -77, -77, -77, -76, -76,
152 -76, -75, -75, -75, -75,
153 -74, -74, -74, -73, -73, -73, -72, -72, -72, -71, -71,
154 -71, -70, -70, -70, -70,
155 -69, -69, -69, -68, -68, -68, -67, -67, -67, -66, -66,
156 -66, -65, -65, -65, -65,
157 -64, -64, -64, -63, -63, -63, -62, -62, -62, -61, -61,
158 -61, -60, -60, -60, -60,
159 -59, -59, -59, -58, -58, -58, -57, -57, -57, -56, -56,
160 -56, -55, -55, -55, -55,
161 -54, -54, -54, -53, -53, -53, -52, -52, -52, -51, -51,
162 -51, -50, -50, -50, -50,
163 -49, -49, -49, -48, -48, -48, -47, -47, -47, -46, -46,
164 -46, -45, -45, -45, -45,
165 -44, -44, -44, -43, -43, -43, -42, -42, -42, -41, -41,
166 -41, -40, -40, -40, -40,
167 -39, -39, -39, -38, -38, -38, -37, -37, -37, -36, -36,
168 -36, -35, -35, -35, -35,
169 -34, -34, -34, -33, -33, -33, -32, -32, -32, -31, -31,
170 -31, -30, -30, -30, -30,
171 -29, -29, -29, -28, -28, -28, -27, -27, -27, -26, -26,
172 -26, -25, -25, -25, -25,
173 -24, -24, -24, -23, -23, -23, -22, -22, -22, -21, -21,
174 -21, -20, -20, -20, -20,
175 -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16,
176 -16, -15, -15, -15, -15,
177 -14, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11,
178 -11, -10, -10, -10, -10,
179 -9, -9, -9, -8, -8, -8, -7, -7, -7, -6, -6, -6, -5, -5,
180 -5, -5,
181 -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, 0, 0,
182 0,
183 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5,
184 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
185 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14,
186 14, 15,
187 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19,
188 19, 20,
189 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24,
190 24, 25,
191 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29,
192 29, 30,
193 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34,
194 34, 35,
195 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39,
196 39, 40,
197 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44,
198 44, 45,
199 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49,
200 49, 50,
201 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54,
202 54, 55,
203 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59,
204 59, 60,
205 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64,
206 64, 65,
207 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69,
208 69, 70,
209 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74,
210 74, 75,
211 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79,
212 79
213 };
214
215 short fs_err_coeff_sw[] = {
216 -18, -17, -17, -17, -17, -17, -18, -17, -16, -17, -17,
217 -17, -17, -17, -16, -15,
218 -17, -16, -16, -16, -16, -16, -17, -16, -15, -16, -16,
219 -16, -16, -16, -15, -14,
220 -16, -15, -15, -15, -15, -15, -16, -15, -14, -15, -15,
221 -15, -15, -15, -14, -13,
222 -15, -14, -14, -14, -14, -14, -15, -14, -13, -14, -14,
223 -14, -14, -14, -13, -12,
224 -14, -13, -13, -13, -13, -13, -14, -13, -12, -13, -13,
225 -13, -13, -13, -12, -11,
226 -13, -12, -12, -12, -12, -12, -13, -12, -11, -12, -12,
227 -12, -12, -12, -11, -10,
228 -12, -11, -11, -11, -11, -11, -12, -11, -10, -11, -11,
229 -11, -11, -11, -10, -9,
230 -11, -10, -10, -10, -10, -10, -11, -10, -9, -10, -10,
231 -10, -10, -10, -9, -8,
232 -10, -9, -9, -9, -9, -9, -10, -9, -8, -9, -9, -9, -9,
233 -9, -8, -7,
234 -9, -8, -8, -8, -8, -8, -9, -8, -7, -8, -8, -8, -8, -8,
235 -7, -6,
236 -8, -7, -7, -7, -7, -7, -8, -7, -6, -7, -7, -7, -7, -7,
237 -6, -5,
238 -7, -6, -6, -6, -6, -6, -7, -6, -5, -6, -6, -6, -6, -6,
239 -5, -4,
240 -6, -5, -5, -5, -5, -5, -6, -5, -4, -5, -5, -5, -5, -5,
241 -4, -3,
242 -5, -4, -4, -4, -4, -4, -5, -4, -3, -4, -4, -4, -4, -4,
243 -3, -2,
244 -4, -3, -3, -3, -3, -3, -4, -3, -2, -3, -3, -3, -3, -3,
245 -2, -1,
246 -3, -2, -2, -2, -2, -2, -3, -2, -1, -2, -2, -2, -2, -2,
247 -1, 0,
248 1, 2, 2, 2, 2, 2, 1, 2, 3, 2, 2, 2, 2, 2, 3, 1,
249 2, 3, 3, 3, 3, 3, 2, 3, 4, 3, 3, 3, 3, 3, 4, 2,
250 3, 4, 4, 4, 4, 4, 3, 4, 5, 4, 4, 4, 4, 4, 5, 3,
251 4, 5, 5, 5, 5, 5, 4, 5, 6, 5, 5, 5, 5, 5, 6, 4,
252 5, 6, 6, 6, 6, 6, 5, 6, 7, 6, 6, 6, 6, 6, 7, 5,
253 6, 7, 7, 7, 7, 7, 6, 7, 8, 7, 7, 7, 7, 7, 8, 6,
254 7, 8, 8, 8, 8, 8, 7, 8, 9, 8, 8, 8, 8, 8, 9, 7,
255 8, 9, 9, 9, 9, 9, 8, 9, 10, 9, 9, 9, 9, 9, 10, 8,
256 9, 10, 10, 10, 10, 10, 9, 10, 11, 10, 10, 10, 10, 10,
257 11, 9,
258 10, 11, 11, 11, 11, 11, 10, 11, 12, 11, 11, 11, 11, 11,
259 12, 10,
260 11, 12, 12, 12, 12, 12, 11, 12, 13, 12, 12, 12, 12, 12,
261 13, 11,
262 12, 13, 13, 13, 13, 13, 12, 13, 14, 13, 13, 13, 13, 13,
263 14, 12,
264 13, 14, 14, 14, 14, 14, 13, 14, 15, 14, 14, 14, 14, 14,
265 15, 13,
266 14, 15, 15, 15, 15, 15, 14, 15, 16, 15, 15, 15, 15, 15,
267 16, 14,
268 15, 16, 16, 16, 16, 16, 15, 16, 17, 16, 16, 16, 16, 16,
269 17, 15,
270 16, 17, 17, 17, 17, 17, 16, 17, 18, 17, 17, 17, 17, 17,
271 18
272 };
273
274 #endif /* ; */
0 /***************************************************************************
1 gamma.c - code for producing color calibration output
2 -------------------
3 begin : Wed Oct 11 2000
4 copyright : (C) 2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18 #include <stdlib.h>
19 #include <string.h>
20 #include <math.h>
21
22 #include "global.h"
23 #include "defaults.h"
24
25 #include "image.h"
26 #include "gamma.h"
27
28
29 int
30 Make_GammaCurve ( double Gamma_R, double Gamma_G, double Gamma_B)
31 {
32 /*color correction curve derived from Gamma_R, Gamma_G, Gamma_B .
33 Gamma_R = Gamma_G = Gamma_B = 1 gives no correction*/
34 int i;
35 for (i = 0; i < 256; i++)
36 {
37 gEnh_curve_r[i] = (int) (pow ((double) i / 256, Gamma_R) * 256);
38 gEnh_curve_g[i] = (int) (pow ((double) i / 256, Gamma_G) * 256);
39 gEnh_curve_b[i] = (int) (pow ((double) i / 256, Gamma_B) * 256);
40 }
41 return 0;
42 }
43
44
45 double
46 GammaValue( int i )
47 {
48 double Gamma;
49 Gamma = (double) (1.0 - 0.033 * i);
50 return Gamma;
51 }
52
53
54
55 int
56 ProduceGamma (image_t *image, unsigned char *line )
57 {
58 int i, j, q;
59 double Gamma_R, Gamma_B, Gamma_G;
60
61 /* produces a single line of the gamma calibration output */
62
63
64 /* increase j to the value for this line */
65 for (j = 0; j * (image->height / 20) < image->bufferCurLine - 150; j++);
66 Gamma_R = Gamma_B = Gamma_G = GammaValue (j);
67 Make_GammaCurve ( Gamma_R, Gamma_G, Gamma_B);
68
69 memset (line, 0xff, image->width * 3);
70
71 if (((image->bufferCurLine - 150) % (image->height / 20) > 64))
72 {
73 for (i = 150; i < image->width / 4; i++)
74 {
75 q = (unsigned char) (255.0 * (i - 150) / (image->width / 4 - 150));
76 // R
77 line[3 * i] = q;
78 line[3 * i + 1] = 0;
79 line[3 * i + 2] = 0;
80
81 // G
82 line[3 * (i + image->width / 4)] = 0;
83 line[3 * (i + image->width / 4) + 1] = q;
84 line[3 * (i + image->width / 4) + 2] = 0;
85
86 // B
87 line[3 * (i + 2 * image->width / 4)] = 0;
88 line[3 * (i + 2 * image->width / 4) + 1] = 0;
89 line[3 * (i + 2 * image->width / 4) + 2] = q;
90 }
91 }
92 else
93 for (i = 150; i < image->width / 4; i += (image->width / 40 - 15))
94 {
95 line[3 * i] =
96 line[3 * i + 1] =
97 line[3 * i + 2] = 0;
98
99 line[3 * (i + image->width / 4) + 1] =
100 line[3 * (i + image->width / 4)] =
101 line[3 * (i + image->width / 4) + 2] = 0;
102
103 line[3 * (i + 2 * image->width / 4) + 2] =
104 line[3 * (i + 2 * image->width / 4)] =
105 line[3 * (i + 2 * image->width / 4) + 1] = 0;
106
107 line[3 * (i + 1)] =
108 line[3 * (i + 1) + 1] =
109 line[3 * (i + 1) + 2] = 0;
110
111 line[3 * (i + 1 + image->width / 4) + 1] =
112 line[3 * (i + 1 + image->width / 4)] =
113 line[3 * (i + 1 + image->width / 4) + 2] = 0;
114
115 line[3 * (i + 1 + 2 * image->width / 4) + 2] =
116 line[3 * (i + 1 + 2 * image->width / 4)] =
117 line[3 * (i + 1 + 2 * image->width / 4) + 1] = 0;
118
119 }
120
121
122 if ((j == 1) || (j == 2 && (image->height / 20) > 64))
123 {
124 /* this line should be written to the ppm output file */
125 return 1;
126 }
127 return 0;
128 }
129
130
131
132
133
134
135
0 /***************************************************************************
1 gamma.h - prototypes and stuff for gamma.c
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _GAMMA_H
18 #define _GAMMA_H
19
20 #include "image.h"
21
22 /* empirical color correction curve */
23 int Make_GammaCurve ( double , double , double );
24
25 /* array of trial gamma values */
26 double GammaValue ( int );
27
28 /* produces color calibration page */
29 int ProduceGamma (image_t *, unsigned char *line );
30
31 #endif
32
33
34
35
0 /***************************************************************************
1 global.h - contains all the global variables for the entire program
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 /*
18 * Global Variables
19 */
20
21 #define VERSION "1.04 (November 05, 2000)"
22
23 /*
24 * Global types
25 */
26
27 typedef enum
28 { false = 0, true = 1 }
29 BOOLEAN;
30
31 /* Paper sizes in 600ths of an inch. */
32
33 /* Default paper sizes: Letter, Legal, and A4. */
34
35 /* US Letter is 8.5 in by 11 in */
36
37 #define LETTERWIDTH (5100)
38 #define LETTERHEIGHT (6600)
39
40 /* US Legal is 8.5 in by 14 in */
41
42 #define LEGALWIDTH (5100)
43 #define LEGALHEIGHT (8400)
44
45 /* A4 is 210 mm by 297 mm == 8.27 in by 11.69 in */
46
47 #define A4WIDTH (4960)
48 #define A4HEIGHT (7016)
49
50 #define MAXBUFFLINES 300
51
52 #ifdef __PNM2PPA_C__
53 int gEnh_curve_r[256], gEnh_curve_g[256], gEnh_curve_b[256];
54
55 int gMaxPass;
56 BOOLEAN gFastMode;
57
58 int gWidth; /* width and height in 600ths of an inch */
59 int gHeight;
60 int gminWidth; /* max and min values allowed by printer */
61 int gmaxWidth;
62 int gminHeight;
63 int gmaxHeight;
64
65 char gFormat[12]; /* string describing the image format */
66
67
68 BOOLEAN gPixmapMode; /* Defines if printing text or photo
69 * (enable/disable black cartridge) */
70
71 BOOLEAN gColorMode; /* enable/disable color cartridge */
72
73 BOOLEAN gUnimode; /* force unidirectional print sweeps */
74 BOOLEAN gTerminate; /* force clean termination of print run*/
75
76 int *gErrVec;
77 int *gErrVec_bw;
78
79 BOOLEAN gGammaMode;
80 BOOLEAN gEcoMode;
81
82 int gBlackness; /* 1,2,3, or 4: black ink density adjustment */
83 BOOLEAN gBlack, gCyan, gMagenta, gYellow; /* switch off inks */
84
85 BOOLEAN gSilent, gVerbose ; /* switch off syslog, messages to stderr */
86
87 #else
88 #ifndef __CALIBRATE_C__
89 extern int gMaxPass;
90 extern int gWidth;
91 extern int gHeight;
92 extern int gminWidth;
93 extern int gmaxWidth;
94 extern int gminHeight;
95 extern int gmaxHeight;
96 extern char gFormat[12];
97 extern int gBlackness ;
98 extern BOOLEAN gUnimode ;
99 extern BOOLEAN gTerminate ;
100 extern BOOLEAN gColorMode;
101 extern BOOLEAN gEcoMode;
102 extern int gEnh_curve_r[256], gEnh_curve_g[256], gEnh_curve_b[256];
103 extern BOOLEAN gFastMode;
104 extern int *gErrVec;
105 extern int *gErrVec_bw;
106 extern BOOLEAN gGammaMode;
107 extern BOOLEAN gPixmapMode;
108 extern BOOLEAN gBlack, gCyan, gMagenta, gYellow;
109 extern BOOLEAN gSilent, gVerbose;
110 #endif
111 #endif
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
0 /*****************************************************************
1 hash_ink.h - contains hashed version of palette.h data
2 -----------------
3 begin : Tue Jan 24 2000
4 copyright : (C) 2000 by the pmn2ppa project
5 author : Klamer Schutte
6 email : Schutte@fel.tno.nl
7 ******************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #ifndef HASH_INK_H
19 #define HASH_INK_H "$Id: hash_ink.h,v 1.1 2000/01/26 22:37:28 klamer Exp $"
20
21 /*
22 * $Log: hash_ink.h,v $
23 * Revision 1.1 2000/01/26 22:37:28 klamer
24 * Added hashing support in FS_Color_Dither. Gives (for file processed)
25 * 6 fold speedup for normal mode, and is 1.5 times quicker with --eco
26 * mode. (CPU time needed -- printer is slower on my computer.)
27 * Note that a trade-off between memory and CPU usage is made; large
28 * arrays are generated in hash_ink.c. A pending optimization is to reduce the
29 * entries in size; the integer size object can be packed to unsigned chars,
30 * and the values of x y z even into a single char -- reducing the size of that
31 * structure from 7 32 bit words (on i386) to 2 words...
32 * Printout results should not change for the code inserted now;
33 * however, marginal differences may exist as the distance (defined by
34 * color metric) is the same, but multiple solutions might give the
35 * same distance... Note that the error diffusion dithering should correct
36 * this in nearby pixels.
37 *
38 */
39
40 struct hash_ink
41 {
42 int data[3];
43 int x, y, z;
44 struct hash_ink *next;
45 };
46
47 extern struct hash_ink *arr_max4[], *arr_max1[];
48 extern int shift4, shift1;
49
50 #endif
51
52
53
54
55
56
57
58
0 /***************************************************************************
1 image.c - code for reading and parsing a pbm, pgm or ppm format file
2 also, rgb -> cymk conversion and black separation
3 -------------------
4 begin : Thu Jan 13 2000
5 copyright : (C) 2000 by pnm2ppa project
6 email :
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18
19 #include <stdlib.h>
20 #include <string.h>
21 #include <math.h>
22 #define __IMAGE_C__
23
24 #include "syslog.h"
25 #include "global.h"
26 #include "defaults.h"
27
28 #include "debug.h"
29 #include "image.h"
30 #include "gamma.h"
31 #include "dither.h"
32 #include "lang.h"
33
34
35
36
37
38 int
39 initImage (image_t *image, FILE *fptr)
40 {
41 char line[1024];
42 int colors = 0;
43 int k, k1;
44
45 image->fptr = fptr;
46 image->version = none;
47 image->blackCurLine = 0;
48 image->colorCurLine = 0;
49 image->bufferCurLine = 0;
50 image->unread = 0;
51 image->colors = 0;
52
53 if (gGammaMode)
54 {
55 /* produce color calibration page, uses the default papersize */
56 image->version = P6_PPMRAW;
57 image->width = gWidth;
58 image->height = gHeight;
59 }
60 else
61 {
62
63 if (fgets (line, 1024, fptr) == NULL)
64 return 0;
65 line[strlen (line) - 1] = 0;
66
67
68 /* we have to handle the six pnm formats .
69 */
70
71 if (!strcmp (line, "P1"))
72 {
73 image->version = P1_PBM;
74 if (!gPixmapMode)
75 gColorMode = false ;
76 strcpy(gFormat,"BitMap");
77 }
78 if (!strcmp (line, "P2"))
79 {
80 image->version = P2_PGM;
81 if (!gPixmapMode)
82 gColorMode = false ;
83 strcpy(gFormat,"GreyMap");
84 }
85 if (!strcmp (line, "P3"))
86 {
87 image->version = P3_PPM;
88 strcpy(gFormat,"PixMap");
89 }
90 if (!strcmp (line, "P4"))
91 {
92 image->version = P4_PBMRAW;
93 if (!gPixmapMode)
94 gColorMode = false ;
95 strcpy(gFormat,"BitMap");
96 }
97 if (!strcmp (line, "P5"))
98 {
99 image->version = P5_PGMRAW;
100 if (!gPixmapMode)
101 gColorMode = false ;
102 strcpy(gFormat,"GreyMap");
103 }
104 if (!strcmp (line, "P6"))
105 {
106 image->version = P6_PPMRAW;
107 strcpy(gFormat,"PixMap");
108 }
109 if (image->version == none)
110 {
111 snprintf(syslog_message,message_size,"initImage(): %s",
112 gMessages[E_IM_BADFORMAT] );
113 wrap_syslog (LOG_CRIT,"%s",syslog_message);
114 return 0;
115 }
116
117 /* initialize switch that is used to terminate further printing
118 * if EOF is detected while reading the input image
119 */
120
121 gTerminate = false ;
122
123 do
124 if (fgets (line, 1024, fptr) == NULL)
125 return 0;
126 while (line[0] == '#');
127 if (2 != sscanf (line, "%d %d", &image->width, &image->height))
128 return 0;
129
130 /* use the image dimensions read from the pnm innput file to
131 * set gWidth and gHeight, and test that these are accepatable
132 * for the printer model
133 * this will mean that any user input or default papersizes
134 * will only be uses for calibration or gamma correction output
135 * which is not generated by pnm imput
136 */
137
138 gWidth = image->width ;
139 gHeight = image->height ;
140 /* test that papersize is acceptable */
141 if ( (gWidth > gmaxWidth )
142 || (gWidth < gminWidth )
143 || (gHeight > gmaxHeight )
144 || (gHeight < gminHeight )
145 )
146 {
147 snprintf(syslog_message,message_size,"initImage(): %s %dx%d @600dpi\n",
148 gMessages[E_IM_BADPAPERSIZE], gWidth, gHeight);
149 wrap_syslog (LOG_CRIT,"%s",syslog_message);
150 return 0;
151 }
152
153 switch(image->version)
154 {
155 case P2_PGM:
156 case P3_PPM:
157 case P5_PGMRAW:
158 case P6_PPMRAW:
159 if (fgets (line, 1024, fptr) == NULL)
160 return 0;
161 if (1 != sscanf (line, "%d", &colors))
162 return 0;
163 /* colors should be 255, as the code is currently implemented */
164 if (colors != 255)
165 {
166 snprintf(syslog_message,message_size,"initImage(): %s %d\n",
167 gMessages[E_IM_BADMAXVALUE], colors);
168 wrap_syslog (LOG_CRIT,"%s",syslog_message);
169 return 0;
170 }
171 break;
172 case P1_PBM:
173 case P4_PBMRAW:
174 colors = 1;
175 break;
176 case none:
177 default:
178 snprintf(syslog_message,message_size,"initImage(): %s",
179 gMessages[E_IM_BADFORMAT]);
180 wrap_syslog (LOG_CRIT,"%s",syslog_message);
181 return 0;
182 break;
183 }
184
185 image->colors = colors ;
186
187 DPRINTF( "initImage: width=%d, height=%d, colors = %d\n",
188 image->width, image->height, image->colors);
189
190 }
191 /* initialize buffer */
192 image->bufsize = 8192;
193 image->bufpos = 0;
194 image->buflines = 0;
195 image->buftype = empty;
196 for (k = 0; k < gMaxPass; k++)
197 {
198 image->buffer[k] = malloc (image->bufsize);
199 if (!image->buffer[k])
200 {
201 for (k1 = 0; k1 < k; k1++)
202 free (image->buffer[k1]);
203 return 0;
204 }
205 }
206 return 1;
207
208 }
209
210 int
211 remallocBuffer (image_t *image, size_t bytes)
212 {
213 int linesize;
214 unsigned char *newbuf;
215 // size_t newsize;
216 int newsize ;
217 int k;
218
219 if (image->buftype == bitmap)
220 linesize = (image->width + 7) / 8;
221 else if (image->buftype == color)
222 linesize = (image->width / 2 + 7) / 8 * 3;
223 else
224 linesize = 0;
225
226 /* if space is adequate, do nothing */
227 if (image->bufpos + image->buflines * linesize + bytes < image->bufsize)
228 return 0;
229
230 /* if there's an offset, move the image at buffer[k][bufpos] to the
231 * the beginning of the buffer, and reset the offset to 0.
232 */
233
234 if (image->bufpos != 0)
235 {
236 DPRINTF("Moving image[k][bufpos] to image[k][0]\n");
237 for (k = 0; k < gMaxPass; k++)
238 memmove (image->buffer[k],
239 &image->buffer[k][image->bufpos], image->buflines * linesize);
240 image->bufpos = 0;
241 if (image->bufpos + image->buflines * linesize + bytes < image->bufsize)
242 return 0;
243 }
244
245 // calculate the number of bits and add one to double the needed memory
246 // size.
247 newsize = pow(2, (int)((log(image->buflines * linesize + bytes)/log(2))+1));
248
249 DPRINTF("resizing memory from %d bytes to %d bytes\n",
250 image->bufsize, newsize);
251
252 for (k=0; k < gMaxPass; k++)
253 {
254 newbuf = malloc(newsize);
255 if ( ! newbuf )
256 {
257 snprintf(syslog_message,message_size, "remallocBuffer(): %s",
258 gMessages[E_BADMALLOC]);
259 wrap_syslog (LOG_CRIT,"%s",syslog_message);
260 exit (1);
261 }
262 memcpy(newbuf, image->buffer[k], image->buflines * linesize);
263 free(image->buffer[k]);
264 image->buffer[k] = newbuf;
265 }
266 image->bufsize = newsize;
267
268 return 0;
269 }
270
271
272
273 void
274 convert_black_data (image_t *image, unsigned char *line, unsigned char *black)
275 {
276 /* Lets document this - please correct anything incorrect here!
277 (duncan, Feb 12 2000, updated July 2000)
278
279 - The entries in line[] are written by one of the
280 functions FS_Color_Dither(), HT_Color_Dither(), HT_Black_Dither()
281 in dither.c
282
283 - The entries in line[] represent the ( image->width ) pixels on a line.
284 Each pixel is represented by three consecutive entries
285 (line[i] , line [i + 1] ,line [i + 2] ) ,
286 where i = 0, 3, 6 , ... , < (image->width * 3)
287 The three entries correspond to Cyan, Magenta, and Yellow ink.
288
289 - entries in line[] take values 1, 2,...,(gMaxPass + 1) , 0 or 255,
290 where gMaxPass is the maximum number of passes of the color print head.
291 * gMaxPass is only used in Color mode (gColorMode=true)
292 * In normal color mode (gEcomode=false, gFastmode=false) gMaxPass = 4
293 * In Economy mode (gEcoMode = true) gMaxPass = 1
294 * In Fast Color mode (gFastMode = true) gMaxPass = 1
295
296 - values line [] = 1, 2, ..., gMaxPass correspond to
297 gMaxPass, gMaxPass-1, ..., 1 drops of ink of a given color (C, M,or Y).
298 - the value line [] = 0 also means gMaxPass drops of ink
299 - the value line [] > gMaxPass (usually = gMaxPass+1 or 255)
300 means 0 drops of color ink.
301
302 - an entry (0, 0, 0) corresponds to a black drop, which can
303 either be a drop of black ink, or gMaxPass drops each of C,M and Y ink,
304 If this is implemented with a drop of black ink, convert_black_data()
305 changes (0,0,0) to (255,255,255), so it won't get repeated using
306 colored ink by the following call to convert_color_data().
307
308 - whitespace is coded by (255,255,255).
309
310 Color data is only printed on even lines.
311
312 Black data is printed on even and odd lines,
313 except in Black-and-White Economy mode (gColorMode=false,
314 gEcoMode=true), when only even lines of black are printed.
315 If the odd line is not printed, its black data is added to
316 the next even line.
317 */
318
319
320 int i, j, k;
321 unsigned char mask = 0x80;
322 unsigned char *pos = black;
323 int blackness ;
324
325 unsigned char curr_stuff= 0 ; // 0 = white, 1 = not white (current pixel)
326 unsigned char remove_black = 1, have_color = 0;
327 unsigned char first_black=0 , second_black=0 ; //controls black ink density
328
329 blackness = gBlackness ;
330 j = image->bufferCurLine ;
331
332 /* black ink quantity control (duncan) */
333 /* this should be extended to control color ink printing
334 of "black" pixels */
335 if ( blackness == 1 )
336 {
337 /* one black ink drop, on even lines only */
338 if ( (j % 2) )
339 {
340 first_black = 0 ; /* odd lines */
341 second_black = 0;
342 }
343 else
344 {
345 first_black = 0 ; /* even lines */
346 second_black = 1 ;
347 }
348 }
349 else if ( blackness == 2 )
350 /* two black ink drops */
351 {
352 if ( (j % 2) )
353 {
354 first_black = 1 ; /* odd lines */
355 second_black = 0;
356 }
357 else
358 {
359 // first_black = 0 ; /* even lines */
360 // second_black = 1 ;
361 /* treat odd and even lines the same, to avoid artifacts?*/
362 first_black = 1 ; /* even lines */
363 second_black = 0 ;
364 }
365 }
366 else if ( blackness == 3 )
367 /* two drops on even lines, one on odd lines */
368 {
369 first_black = 1;
370 if ( j % 2 )
371 second_black = 0; /* odd lines */
372 else
373 second_black = 1 ; /* even lines */
374 }
375 else if (blackness == 4 )
376 /* two black ink drops, all lines */
377 {
378 first_black = 1 ;
379 second_black = 1 ;
380 }
381 else
382 /* no black ink */
383 {
384 first_black = 0 ;
385 second_black = 0 ;
386 }
387
388 /* In Pixmap mode black ink cartridge is disabled (this should
389 be renamed to (say) NoBlack mode ) */
390
391 if (gPixmapMode)
392 memset (pos, 0x00, (image->width + 7) / 8);
393 else
394 {
395 if (gColorMode)
396 {
397 /* This is the most delicate situation, we (may) have both color
398 * and black on the same line;
399 * we want to:
400 * - Print half of the black ink to avoid "wet" effect
401 * - get a good "covering" black in pixmaps (neither too dense,
402 * neither too sparse...)
403 */
404
405 curr_stuff=0;
406
407 for (i = 0; i < image->width * 3; i += 6)
408 {
409 if (mask == 0x80)
410 *pos = 0;
411
412 if (curr_stuff==0)
413 {
414 /* this is a test to see if the current non-whitespace
415 * pixel is part of a region of black delineated by
416 * whitespace (have_color=0)
417 * or is in a region containing some
418 * colored pixels (in this case have_color=1)
419 */
420 if (! (line[i]>gMaxPass && //if line is not white
421 line[i+1]> gMaxPass &&
422 line[i+2]>gMaxPass) )
423 {
424 have_color=0;
425 k=i;
426 while ( (!(have_color)) &&
427 (k<image->width * 3) &&
428 (! (line[k]>gMaxPass &&
429 line[k+1]> gMaxPass &&
430 line[k+2]>gMaxPass) ))
431 {
432 if ((line[k] && line[k]<=gMaxPass) ||
433 (line[k+1] && line[k+1]<=gMaxPass) ||
434 (line[k+2] && line[k+2]<=gMaxPass))
435 have_color=1;
436
437 k+=6;
438 }
439 if (have_color)
440 remove_black=0;
441 else
442 remove_black=1;
443 curr_stuff=1;
444 }
445 }
446
447 if ( !(line[i] || line[i + 1] || line[i + 2]))
448 {
449 /* pixel is black; there are two possible
450 * behaviors, depending on whether remove_black
451 * is set by Drugo's new code above.
452 * these behaviors may need some further
453 * adjustments.
454 */
455 if (remove_black)
456 {
457 /* in this case the black region is
458 * identified as delineated by whitespace
459 * (probably = text?).
460 * So print with black ink,
461 * and no colored ink. To avoid using
462 * too much black ink (wets paper)
463 * first_black and second_black
464 * are used as controls on amount
465 * of black ink.
466 */
467 if (first_black && gBlack )
468 *pos |= mask; /* one drop of black ink */
469 mask >>= 1;
470 if (mask == 0)
471 {
472 pos++;
473 mask = 0x80;
474 }
475 if (second_black && gBlack )
476 *pos |= mask; /* one drop of black ink */
477 /* suppress use of colored ink on this pixel */
478 line[i] = line[i + 1] = line[i + 2] = 255;
479 line[i + 3] = line[i + 4] = line[i + 5] = 255;
480 }
481 else
482 {
483 /* this black region is bounded by a colored
484 * region, and is probably part of an image.
485 * so: print half strength black ink, and use
486 * some colored ink.
487 *
488 * note: in EcoMode, only even lines are processed.
489 * in normal mode, skip even lines.
490 * j is the line number.
491 */
492 if ( (j % 2 || gEcoMode ) && gBlack )
493 *pos |= mask;/* a drop of black, every second line */
494 mask >>= 1;
495 if (mask == 0)
496 {
497 pos++;
498 mask = 0x80;
499 }
500 /* reduce amount of colored ink to avoid wetting:
501 * try resetting line[] to gMaxPass-1
502 * gives 2 passes of the color head in high quality,
503 * (gMaxPass=4, line[] = 3),
504 * 1 pass in ecoMode (gMaxPass = 1, line[] = 0)
505 */
506 line[i] = line[i + 1] = line[i + 2] = gMaxPass-1;
507 line[i + 3] = line[i + 4] = line[i + 5] = gMaxPass-1;
508 }
509 }
510 else
511 {
512 /* pixel is not black */
513 mask >>= 1;
514 if (mask == 0)
515 {
516 pos++;
517 mask = 0x80;
518 }
519 if (line[i] > gMaxPass &&
520 line[i + 1] > gMaxPass &&
521 line[i + 2] > gMaxPass)
522 {
523 /* pixel is whitespace */
524 curr_stuff=0;
525 }
526 }
527
528 mask >>= 1;
529 if (mask == 0)
530 {
531 pos++;
532 mask = 0x80;
533 }
534 }
535 }
536 else
537 {
538 /* this next part is for printing in black and white only.
539 * if !gColorMode, the line contains only black or white, so
540 * we can print safely 1 drop out of 2 without any problem
541 */
542
543 *pos = 0;
544
545 for (i = 0 ; i < image->width * 3; i += 6)
546 {
547 if (mask == 0x80)
548 *pos = 0;
549
550 if ((!line[i] && !line[i + 1] && !line[i + 2]))
551 {
552 if (first_black && gBlack)
553 *pos |= mask; /* one drop of black ink */
554 mask >>= 1;
555 if (mask == 0)
556 {
557 pos++;
558 mask = 0x80;
559 }
560 if (second_black && gBlack)
561 *pos |= mask; /* one drop of black ink */
562 }
563 else
564 {
565 /* pixel is not black */
566 mask >>= 1;
567 if (mask == 0)
568 {
569 pos++;
570 mask = 0x80;
571 }
572 }
573 mask >>= 1;
574 if (mask == 0)
575 {
576 pos++;
577 mask = 0x80;
578 }
579 }
580 memset (line, 0xff, image->width * 3);
581 }
582
583 }
584 }
585
586
587 void
588 convert_color_data (image_t *image, unsigned char *line,
589 unsigned char *color[], int c_off)
590 {
591 int i, k, j;
592 unsigned char mask;
593 unsigned char *pos;
594
595 j = 1;
596 for (k = 0; k < gMaxPass; k++)
597 {
598 mask = 0x80;
599 pos = &color[gMaxPass - j][c_off];
600 j++;
601
602 memset (pos, 0x00, (image->width / 2 + 7) / 8 * 3);
603
604 for (i = 0; i < image->width * 3; i += 6)
605 {
606
607 if ((line[i] < gMaxPass - (k) + 1) && gCyan)
608 pos[0] |= mask;
609 if ((line[i + 1] < gMaxPass - (k) + 1) && gMagenta)
610 pos[1] |= mask;
611 if ((line[i + 2] < gMaxPass - (k) + 1) && gYellow)
612 pos[2] |= mask;
613
614 mask >>= 1;
615 if (mask == 0)
616 {
617 pos += 3;
618 mask = 0x80;
619 }
620 }
621 }
622 }
623
624 /* Drugo */
625
626 /* read a line of data from the file and convert to the necessary format */
627 void
628 read_line (image_t * image, unsigned char *black[], int b_off,
629 unsigned char *color[], int c_off)
630 {
631 static unsigned char *line, *oldline; /* take care to free these! */
632 int i, j, k ;
633 int fread_eof = 0;
634 static int have_oldline = 0;
635
636 line = malloc (image->width * 3);
637
638 if (!line)
639 {
640 /* make this nicer... propagate upwards */
641 snprintf(syslog_message,message_size, "read_line(): %s",
642 gMessages[E_BADMALLOC]);
643 wrap_syslog (LOG_CRIT,"%s",syslog_message);
644 if (have_oldline)
645 free (oldline);
646 exit (1);
647 }
648
649
650 /* All the six pnm input formats
651 * (pbm, pbmraw, pgm, pgmraw, pbm, pbmraw )
652 * can be read from the input, and converted to
653 * ppmraw format for further processing.
654 */
655
656
657 if (!gGammaMode && !gTerminate)
658 {
659 switch (image->version)
660 {
661 /* for completeness, the non-raw pnm formats are supported */
662 case P1_PBM:
663 for ( i = 0 ; i < image->width * 3 ; )
664 switch( getc( image->fptr ) )
665 {
666 case EOF:
667 snprintf(syslog_message,message_size, "read_line(): %s PBM\n",
668 gMessages[E_IM_EOFREADLINE]);
669 wrap_syslog (LOG_CRIT,"%s",syslog_message);
670
671 /* input data is truncated; set gTerminate mode
672 * and replace lost part of image with whitespace
673 * until print run ends.
674 */
675 gTerminate = true ;
676 break;
677 case '1':
678 line[i] = line[i + 1]= line[i + 2] = 0;
679 i += 3 ;
680 break;
681 case '0':
682 line[i] = line[i + 1]= line[i + 2] = 255;
683 i += 3 ;
684 break;
685 default :
686 break;
687 }
688 break;
689 case P2_PGM:
690 {
691 /* This is included for completeness,
692 * but this implementation s PAINFULLY slow !
693 * is there a better way?
694 * (YES, USE THE PGMRAW FORMAT ONLY !)
695 */
696 unsigned int value ;
697 for ( i = 0 ; i < image->width * 3 ; i += 3 )
698 {
699 switch (fscanf(image->fptr, "%u ", &value ) )
700 {
701 case '1':
702 break ;
703 case EOF:
704 snprintf(syslog_message,message_size,"read_line(): %s PGM\n",
705 gMessages[E_IM_EOFREADLINE]);
706 wrap_syslog (LOG_CRIT,"%s",syslog_message);
707
708 /* input data is truncated; set gTerminate mode
709 * and replace lost part of image with whitespace
710 * until print run ends.
711 */
712 gTerminate = true ;
713 break;
714 default:
715 snprintf(syslog_message,message_size,"read_line(): %s",
716 gMessages[E_IM_BADREADLINE]);
717 wrap_syslog (LOG_CRIT,"%s",syslog_message);
718 free (line);
719 if (have_oldline)
720 free (oldline);
721 exit (1);
722 break;
723 }
724 if(value <= 255)
725 line[i] = line[i + 1] = line[i + 2] = value ;
726 else
727 {
728 snprintf(syslog_message,message_size,"read_line(): %s",
729 gMessages[E_IM_BADIMAGE]);
730 wrap_syslog (LOG_CRIT,"%s",syslog_message);
731 free (line);
732 if (have_oldline)
733 free (oldline);
734 exit (1);
735 }
736 }
737 }
738 break;
739 case P3_PPM:
740 {
741 /* This is included for completeness,
742 * but this implementation is PAINFULLY slow !
743 * is there a better way?
744 * (YES, USE THE PPMRAW FORMAT ONLY !)
745 */
746 unsigned int value ;
747 for ( i = 0 ; i < image->width * 3 ; i ++ )
748 {
749 switch (fscanf(image->fptr, "%u ", &value ) )
750 {
751 case '1':
752 break ;
753 case EOF:
754 snprintf(syslog_message,message_size,"read_line(): %s PPM\n",
755 gMessages[E_IM_EOFREADLINE]);
756 wrap_syslog (LOG_CRIT,"%s",syslog_message);
757
758 /* input data is truncated; set gTerminate mode
759 * and replace lost part of image with whitespace
760 * until print run ends.
761 */
762 gTerminate = true ;
763 break;
764 default:
765 snprintf(syslog_message,message_size,"read_line(): %s",
766 gMessages[E_IM_BADREADLINE]);
767 wrap_syslog (LOG_CRIT,"%s",syslog_message);
768 free (line);
769 if (have_oldline)
770 free (oldline);
771 exit (1);
772 break;
773 }
774 if(value <= 255)
775 line[i] = value ;
776 else
777 {
778 snprintf(syslog_message,message_size,"read_line() %s",
779 gMessages[E_IM_BADIMAGE]);
780 wrap_syslog (LOG_CRIT,"%s",syslog_message);
781 free (line);
782 if (have_oldline)
783 free (oldline);
784 exit (1);
785 }
786 }
787 }
788 break;
789 case P4_PBMRAW:
790 /* read pbmraw format and convert to ppmraw format */
791 {
792 int pbm_width, count, index ;
793 char* pbmraw_data;
794 unsigned char mask[8] =
795 { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
796 pbm_width = ( image->width + 7 ) / 8;
797
798 if (! (pbmraw_data = malloc(pbm_width)) )
799 {
800 snprintf(syslog_message,message_size,"read_line(): %s",
801 gMessages[E_BADMALLOC]);
802 wrap_syslog (LOG_CRIT,"%s",syslog_message);
803 if (have_oldline)
804 free (oldline);
805 free (line);
806 exit (1);
807 }
808
809 count = fread(pbmraw_data, 1 , pbm_width, image->fptr);
810 if (pbm_width == count)
811 {
812 /* success */
813 /* pbm raw format: 0=white, 1=black;
814 * bits are stored eight per byte, high bit
815 * first, low bit last.
816 */
817 index = 0;
818 for ( i = 0 ; i < image->width ; i ++ )
819 {
820 k = i % 8 ;
821 j = i / 8 ;
822 if ( pbmraw_data[j] & mask[k] )
823 line[index] = line[index + 1] = line[index + 2] = 0 ;
824 else
825 line[index] = line[index + 1] = line[index + 2] = 255; ;
826 index += 3;
827 }
828 free(pbmraw_data);
829 }
830 else
831 {
832 /* error reading line */
833 free(pbmraw_data);
834 fread_eof=feof(image->fptr);
835 clearerr(image->fptr);
836 if (fread_eof)
837 {
838 snprintf(syslog_message,message_size,"read_line(): %s PBMRAW\n",
839 gMessages[E_IM_EOFREADLINE]);
840 wrap_syslog (LOG_CRIT,"%s",syslog_message);
841
842 /* input data is truncated; set gTerminate mode
843 * and replace lost part of image with whitespace
844 * until print run ends.
845 */
846 gTerminate = true ;
847 }
848 else
849 {
850 snprintf(syslog_message,message_size,"read_line(): %s",
851 gMessages[E_IM_BADREADLINE]);
852 wrap_syslog (LOG_CRIT,"%s",syslog_message);
853 free (line);
854 if (have_oldline)
855 free (oldline);
856 exit (1);
857 }
858 }
859 }
860
861 break;
862 case P5_PGMRAW:
863
864 /* read pgmraw format and convert to ppmraw format */
865 {
866 int index ;
867 char* pgm_data;
868
869 pgm_data = malloc(image->width);
870 if (!pgm_data)
871 {
872 snprintf(syslog_message,message_size,"read_line(): %s",
873 gMessages[E_BADMALLOC]);
874 wrap_syslog (LOG_CRIT,"%s",syslog_message);
875 free (line);
876 if (have_oldline)
877 free (oldline);
878 exit (1);
879 }
880 if ( 1 == fread (pgm_data, image->width , 1, image->fptr) )
881 {
882 /* success */
883 index = 0 ;
884 for ( i = 0 ; i < image->width ; i ++ )
885 {
886 line[index] = line[index + 1] = line[index + 2]
887 = pgm_data[i] ;
888 index += 3;
889 }
890 free(pgm_data);
891 }
892 else
893 {
894 /* error reading line */
895 free(pgm_data);
896 fread_eof=feof(image->fptr);
897 clearerr(image->fptr);
898 if (fread_eof)
899 {
900 snprintf(syslog_message,message_size,"read_line:() %s PGMRAW\n",
901 gMessages[E_IM_EOFREADLINE]);
902 wrap_syslog (LOG_CRIT,"%s",syslog_message);
903
904 /* input data is truncated; set gTerminate mode
905 * and replace lost part of image with whitespace
906 * until print run ends.
907 */
908 gTerminate = true ;
909 }
910 else
911 {
912 snprintf(syslog_message,message_size,"read_line(): %s",
913 gMessages[E_IM_BADREADLINE]);
914 wrap_syslog (LOG_CRIT,"%s",syslog_message);
915 free (line);
916 if (have_oldline)
917 free (oldline);
918 exit (1);
919 }
920 }
921 }
922 break;
923 case P6_PPMRAW:
924 if (1 != fread (line, image->width * 3, 1, image->fptr) )
925 {
926 fread_eof=feof(image->fptr);
927 clearerr(image->fptr);
928 if (fread_eof)
929 {
930 snprintf(syslog_message,message_size,"read_line(): %s PPMRAW\n",
931 gMessages[E_IM_EOFREADLINE]);
932 wrap_syslog (LOG_CRIT,"%s",syslog_message);
933
934 /* input data is truncated; set gTerminate mode
935 * and replace lost part of image with whitespace
936 * until print run ends.
937 */
938 gTerminate = true ;
939 }
940 else
941 {
942 snprintf(syslog_message,message_size,"read_line(): %s",
943 gMessages[E_IM_BADREADLINE]);
944 wrap_syslog (LOG_CRIT,"%s",syslog_message);
945 free (line);
946 if (have_oldline)
947 free (oldline);
948 exit (1);
949 }
950 }
951 break;
952 case none:
953 default:
954 snprintf(syslog_message,message_size,"read_line(): %s",
955 gMessages[E_IM_BADFORMAT]);
956 wrap_syslog (LOG_CRIT,"%s",syslog_message);
957 free (line);
958 if (have_oldline)
959 free (oldline);
960 exit (1);
961 break;
962 }
963 }
964 else if (gGammaMode)
965 ProduceGamma (image, line ) ; /* generate color calibration page */
966
967 if ( gTerminate )
968 {
969 /* this becomes true if EOF was obtained when a line was read .
970 * The input image is incomplete .
971 * Print only previously-read complete lines.
972 * unread lines are replaced with blanks for the rest of the print run
973 */
974 int index ;
975 index = 0 ;
976 for ( i = 0 ; i < image->width ; i ++ )
977 {
978 line[index] = line[index + 1] = line[index + 2] = 255; ;
979 index += 3;
980 }
981 }
982
983
984
985 /* process ALL lines to avoid artifacts
986 (odd lines are only processed for black in *_Dither() functions )
987 hopefully, this minimal processing is quite fast */
988
989 if (gColorMode)
990 {
991 if (gFastMode)
992 HT_Color_Dither (image, line);
993 else
994 FS_Color_Dither (image, line);
995 }
996 else
997 HT_Black_Dither (image, line);
998
999 /* if the current line is odd, we only need to return black data */
1000 if (image->bufferCurLine % 2 == 1)
1001 {
1002 if ( (!gEcoMode || gColorMode) && !gPixmapMode )
1003 {
1004 convert_black_data (image, line, &black[0][b_off]);
1005 }
1006 else
1007 {
1008 /* in B&W EcoMode, or in PixmapMode,
1009 * don't print the odd line, but store it
1010 * (unless this is the last line!)
1011 */
1012 if ( image->bufferCurLine + 1 < image->height )
1013 {
1014 memset(&black[0] [b_off], 0x00, (image->width +7 ) / 8 );
1015 oldline = malloc (image->width * 3);
1016 memcpy(oldline, line, image->width * 3 );
1017 have_oldline = 1;
1018 }
1019 }
1020
1021
1022 }
1023 else
1024 {
1025 /* return both black and color data on even lines */
1026 /* note that convert_color_data must be called AFTER convert_black_data */
1027 if ( have_oldline )
1028 {
1029 /* add any black from previous unprinted odd line
1030 to next even line */
1031 for ( i = 0; i < image->width * 3; i += 3 )
1032 {
1033 if ( !oldline[i] && !oldline[i + 1] && !oldline[i + 2] )
1034 {
1035 line[i] = line[i + 1] = line[i + 2] = 0 ;
1036 }
1037 }
1038 free(oldline);
1039 have_oldline = 0;
1040 }
1041
1042
1043
1044 convert_black_data (image, line, &black[0][b_off]);
1045 if (gColorMode)
1046 convert_color_data (image, line, color, c_off);
1047 }
1048
1049
1050 free (line);
1051
1052 image->bufferCurLine++;
1053
1054 }
1055
1056 /* Drugo */
1057
1058
1059 /* buffer a black line or two and return color data */
1060
1061 void
1062 buffer_black_line (image_t *image, unsigned char *data[], int offset)
1063 {
1064 int lines, linesize = (image->width + 7) / 8;
1065
1066 /* if the current line is odd, we need to read 2 black lines */
1067 if (image->bufferCurLine % 2 == 1)
1068 lines = 2;
1069 else
1070 lines = 1; //mocho 1
1071
1072 remallocBuffer (image, linesize * lines);
1073
1074 /* read_line into buffer and 'data' */
1075 read_line (image, image->buffer,
1076 image->bufpos + image->buflines * linesize, data, offset);
1077 image->buflines++;
1078
1079 /* if we have to read 2 lines, then we haven't gotten any color data yet */
1080 if (lines == 2)
1081 {
1082 read_line (image, image->buffer,
1083 image->bufpos + image->buflines * linesize, data, offset);
1084 image->buflines++;
1085 }
1086
1087 image->buftype = bitmap;
1088 }
1089
1090 /* buffer a color line and return black data */
1091 void
1092 buffer_color_line (image_t *image, unsigned char *data[], int offset)
1093 {
1094 int linesize = (image->width / 2 + 7) / 8 * 3;
1095
1096 /* if the current line is odd, we don't need to buffer any color data */
1097 if (image->bufferCurLine % 2 == 1)
1098 {
1099 read_line (image, data, offset, NULL, 0);
1100 return;
1101 }
1102
1103 /* we need to buffer 1 color line */
1104 if (gColorMode)
1105 remallocBuffer (image, linesize);
1106
1107 read_line (image, data, offset, image->buffer,
1108 image->bufpos + image->buflines * linesize);
1109 image->buflines++;
1110
1111 image->buftype = color;
1112 }
1113
1114 /* Reads a single line of black image data into data which must be at least
1115 (image->width+7)/8 bytes of storage */
1116 int
1117 im_black_readline (image_t *image, unsigned char *data[], int offset)
1118 {
1119
1120 if (image->blackCurLine >= image->height)
1121 return 0;
1122
1123 if (image->unread)
1124 {
1125 memcpy (data[0] + offset, image->revdata, (image->width + 7) / 8);
1126 image->blackCurLine++;
1127 image->unread = 0;
1128 free (image->revdata);
1129 return 1;
1130 }
1131
1132 /* if there are buffered black lines, use one of them */
1133 /* if there aren't buffered black lines, process the next line and */
1134 /* buffer a color line */
1135 if (image->buftype == bitmap)
1136 {
1137 memcpy (data[0] + offset,
1138 &image->buffer[0][image->bufpos], (image->width + 7) / 8);
1139 image->bufpos += (image->width + 7) / 8;
1140 if (--image->buflines == 0)
1141 {
1142 image->bufpos = 0;
1143 image->buftype = empty;
1144 }
1145 }
1146 else
1147 buffer_color_line (image, data, offset);
1148 image->blackCurLine++;
1149 return 1;
1150
1151 }
1152
1153 /* Reads a single line of color image data into data which must be at least
1154 (image->width/2+7)/8*3 bytes of storage */
1155 int
1156 im_color_readline (image_t *image, unsigned char *data[], int offset)
1157 {
1158 int k;
1159
1160 if (image->colorCurLine >= image->height)
1161 {
1162 DPRINTF ("im_color_readline returning 0 immediately!\n");
1163 return 0;
1164 }
1165
1166 /* if there are buffered color lines, use one of them */
1167 /* if there aren't buffered color lines, process the next line and */
1168 /* buffer a black line */
1169 if (image->buftype == color)
1170 {
1171 for (k = 0; k < gMaxPass; k++)
1172 memcpy (data[k] + offset,
1173 &image->buffer[k][image->bufpos], 3 * ((image->width / 2 + 7) / 8)); //mocho changes /2
1174 image->bufpos += 3 * ((image->width / 2 + 7) / 8); //mocho changes /2
1175 image->buflines--;
1176 if (image->buflines == 0)
1177 {
1178 image->bufpos = 0;
1179 image->buftype = empty;
1180 }
1181 }
1182 else
1183 buffer_black_line (image, data, offset);
1184 image->colorCurLine += 2;
1185 return 1;
1186 }
1187
1188 /* push a black line back into the buffer; we read too much! */
1189 void
1190 im_unreadline (image_t * image, void *data)
1191 {
1192 /* can only store one line in the unread buffer */
1193 if (image->unread)
1194 return;
1195
1196 image->unread = 1;
1197 image->revdata = malloc ((image->width + 7) / 8);
1198 memcpy (image->revdata, data, (image->width + 7) / 8);
1199 image->blackCurLine--;
1200 }
0 /***************************************************************************
1 image.h - prototypes and stuff for image.c
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _IMAGE_H
18 #define _IMAGE_H
19
20 #include <stdio.h>
21
22 typedef struct
23 {
24 FILE *fptr;
25 enum
26 { none, P1_PBM, P2_PGM, P3_PPM, P4_PBMRAW, P5_PGMRAW, P6_PPMRAW }
27 version;
28 int width, height;
29 int blackCurLine, colorCurLine, bufferCurLine;
30 void *revdata; // used to stash a line read too early
31 int unread;
32
33 /* buffer */
34 int bufsize; /* size of buffer in bytes */
35 int bufpos; /* start position in buffer */
36 int buflines; /* number of lines in the buffer */
37 enum
38 {
39 empty = 0,
40 bitmap,
41 color,
42 grey
43 }
44 buftype; /* 0=empty, 1=black, 2=color, grey */
45 unsigned char *palette;
46 int ncols;
47 unsigned char *buffer[4];
48 int colors; /* for ppm and pgm formats (usually 255) */
49 }
50 image_t;
51
52 int initImage (image_t *, FILE *);
53
54 /* reads a single line into char* */
55 int im_black_readline (image_t *, unsigned char *data[], int offset);
56
57 /* reads a single line of color */
58 int im_color_readline (image_t *, unsigned char *data[], int offset);
59
60 /* pushes a single line back */
61 void im_unreadline (image_t *, void *);
62
63 /* produces color calibration page */
64 int ProduceGamma (image_t *, unsigned char *line );
65
66 #endif /* ; */
67
68
69
70
0 /***************************************************************************
1 lang.h - contains the language selectors for I18N purposes
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1999-2000 by Andrew van der Stock
5 email : ajv@greebo.net
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef __LANG_H__
18 #define __LANG_H__
19
20 typedef enum
21 {
22 E_CS_BADMALLOC, /* 00 */
23 E_CS_BADTOPMARG, /* 01 */
24 E_CS_BADBOTMARG, /* 02 */
25 E_CS_BADNEXTLINE, /* 03 */
26 E_CS_BADPPAMALLOC, /* 04 */
27 E_CS_ERROR, /* 05 */
28 E_CS_BADSWITCH, /* 06 */
29 W_PPA_NOZZLE, /* 07 */
30 E_IM_BADGAMMA, /* 08 */
31 E_IM_EOFREADLINE, /* 09 */
32 E_IM_BADREADLINE, /* 10 */
33 E_IM_BADIMAGE, /* 11 */
34 E_BADMALLOC, /* 12 */
35 E_IM_BADFORMAT, /* 13 */
36 /* 14 (removed) */
37 E_IM_BADPAPERSIZE, /* 15 */
38 E_IM_BADMAXVALUE, /* 16 */
39 E_PPA_UNKNOWN, /* 17 */
40 E_PPA_BADMALLOC, /* 18 */
41 LOG_START, /* 19 */
42 LOG_PAGE, /* 20 */
43 LOG_FINISH, /* 21 */
44 LOG_NOPAGES, /* 22 */
45 LOG_SUCCESS, /* 23 */
46 LOG_VERBOSE, /* 24 */
47 E_CONFIG, /* 25 */
48 E_BADCONFIGFILE, /* 26 */
49 E_BAD_PAPER, /* 27 */
50 E_BADPARM, /* 28 */
51 LINE, /* 29 */
52 E_PARSE_CONFIG, /* 30 */
53 E_UNKNOWN_ARG, /* 31 */
54 E_BAD_OUTPUT, /* 32 */
55 E_BAD_INPUT, /* 33 */
56 LOG_VERSION, /* 34 */
57 E_BAD_GAMMAFILE, /* 35 */
58 E_BAD_PATH , /* 36 */
59
60 E_LANGNOMESS /* placeholder */
61 }
62 mess_t;
63
64
65 #ifdef __PNM2PPA_C__
66 // only defined the once
67 char *gMessages[] = {
68
69 #ifdef LANG_CZ
70 #include "text-cz.h"
71 #endif
72
73 #ifdef LANG_EN
74 #include "text-en.h"
75 #endif
76
77 #ifdef LANG_ES
78 #include "text-es.h"
79 #endif
80
81 #ifdef LANG_FR
82 #include "text-fr.h"
83 #endif
84
85 #ifdef LANG_IT
86 #include "text-it.h"
87 #endif
88
89 #ifdef LANG_NL
90 #include "text-nl.h"
91 #endif
92 };
93
94 #else
95 // make the messages available to other files
96 extern char *gMessages[];
97 #endif
98
99 #endif
0 printcap contains BSD-style lpd printer descriptions for these printers:
1
2 color (best quality color)
3 coloreco (normal quality color)
4 bw (best quality black)
5 bweco (economy quality black)
6 ascii (filter for printing ascii text files)
7
8
9 The printcap entries say:
10 use a log file (lf) and an accounting file (af), suppress form feeds (sf),
11 suppress printing of burst page header (sh) and the maximum file size is
12 unlimited (mx#0). Edit these if necessary.
13
14 Then edit your /etc/printcap file to add the contents of printcap
15 to it. (Just copy printcap to /etc/printcap, if no other printers
16 are defined).
17
18 Now Run the shell script lpdsetup, specifying your desired paper size, e.g.:
19 ./lpdsetup letter
20 ./lpdsetup legal
21 ./lpdsetup a4
22 ./lpdsetup a3
23
24 This installs the filters in /usr/local/bin and creates the corresponding
25 spool directories /var/spool/lpd/color, etc, You must be root to do this.
26
27 You may wish to edit the options specified in the filter files
28 color.if
29 coloreco.if
30 bw.if
31 bweco.if
32 ascii.if
0 #! /bin/sh
1 # for printing black and white text (ascii) files.
2 FILTER="/usr/local/bin/bw.if"
3 #FILTER="/usr/local/bin/bweco.if"
4 #------enscript command line--------------------------
5 enscript -2rj -p- | $FILTER
6
0 #!/bin/sh
1 # high quality black and white printing using pbm BitMap format.
2 # uncomment or change these options as necessary
3 #PAPER=letter
4 #PAPER=legal
5 #PAPER=a4
6 #PAPER=a3
7 #PPAOPTS="-B 2"
8 PNM2PPA="/usr/local/bin/pnm2ppa"
9 #------------------dont change below this line----------------------
10 gs -sDEVICE=pbmraw -sPAPERSIZE=$PAPER -q -dNOPAUSE -r600 -sOutputFile=- - | \
11 $PNM2PPA --bw $PPAOPTS -i - -o -
0 #!/bin/sh
1 # ink economy mode black and white printing using pbm BitMap format.
2 # uncomment or change these options as necessary
3 #PAPER=letter
4 #PAPER=legal
5 #PAPER=a4
6 #PAPER=a3
7 #PPAOPTS="-B 2"
8 PNM2PPA="/usr/local/bin/pnm2ppa"
9 #------------------dont change below this line----------------------
10 gs -sDEVICE=pbmraw -sPAPERSIZE=$PAPER -q -dNOPAUSE -r600 -sOutputFile=- - | \
11 $PNM2PPA --bw --eco $PPAOPTS -i - -o -
0 #!/bin/sh
1 # best quality color printing using ppm PixMap format.
2 # uncomment or change these options as necessary
3 #PAPER=letter
4 #PAPER=legal
5 #PAPER=a4
6 #PAPER=a3
7 #PPAOPTS="-p"
8 PNM2PPA="/usr/local/bin/pnm2ppa"
9 #------------------dont change below this line----------------------
10 gs -sDEVICE=ppmraw -sPAPERSIZE=$PAPER -q -dNOPAUSE -r600 -sOutputFile=- - | \
11 $PNM2PPA $PPAOPTS -i - -o -
0 #!/bin/sh
1 # ink economy mode color printing using ppm PixMap format.
2 # uncomment or change these options as necessary
3 #PAPER=letter
4 #PAPER=legal
5 #PAPER=a4
6 #PAPER=a3
7 #PPAOPTS="--fd"
8 PNM2PPA="/usr/local/bin/pnm2ppa"
9 #------------------dont change below this line----------------------
10 gs -sDEVICE=ppmraw -sPAPERSIZE=$PAPER -q -dNOPAUSE -r600 -sOutputFile=- - | \
11 $PNM2PPA --eco $PPAOPTS -i - -o -
0 #!/bin/sh
1 INSTALLDIR="/usr/local/bin"
2 SPOOLDIR="/var/spool/lpd"
3 PAPER=letter
4 for paper in letter legal a3 a4 ; do
5 if [ "$1" = "$paper" ] ; then
6 PAPER=$paper
7 fi
8 done
9
10 echo "PAPERSIZE used by ghostscript will be $PAPER"
11
12 for PRINTER in color coloreco bw bweco ascii ; do
13
14 SEDCMD="sed s/^#PAPER=$PAPER/PAPER=$PAPER/ $PRINTER.if"
15 $SEDCMD > $INSTALLDIR/$PRINTER.if
16 chmod 0755 $INSTALLDIR/$PRINTER.if
17
18 if [ ! -d $SPOOLDIR/$PRINTER ] ; then
19 mkdir -p $SPOOLDIR/$PRINTER
20 touch $SPOOLDIR/$PRINTER/log
21 touch $SPOOLDIR/$PRINTER/acct
22 fi
23
24 done
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
0 # pnm2ppa printer descriptions for /etc/printcap
1
2 # color printing, "normal quality" (economy)
3 coloreco|lp:\
4 :lp=/dev/lp0:\
5 :sd=/var/spool/lpd/coloreco:\
6 :lf=/var/spool/lpd/coloreco/log:\
7 :af=/var/spool/lpd/coloreco/acct:\
8 :if=/usr/local/bin/coloreco.if:\
9 :la:mx#0:\
10 :sh:sf:
11
12 # color printing, "best quality"
13 color:\
14 :lp=/dev/lp0:\
15 :sd=/var/spool/lpd/color:\
16 :lf=/var/spool/lpd/color/log:\
17 :af=/var/spool/lpd/color/acct:\
18 :if=/usr/local/bin/color.if:\
19 :la:mx#0:\
20 :sh:sf:
21
22 # black and white printing, "best quality"
23 bw:\
24 :lp=/dev/lp0:\
25 :sd=/var/spool/lpd/bw:\
26 :lf=/var/spool/lpd/bw/log:\
27 :af=/var/spool/lpd/bw/acct:\
28 :if=/usr/local/bin/bw.if:\
29 :la:mx#0:\
30 :sh:sf:
31
32 # black and white printing, "economy quality"
33 bweco:\
34 :lp=/dev/lp0:\
35 :sd=/var/spool/lpd/bweco:\
36 :lf=/var/spool/lpd/bweco/log:\
37 :af=/var/spool/lpd/bweco/acct:\
38 :if=/usr/local/bin/bweco.if:\
39 :la:mx#0:\
40 :sh:sf:
41
42 # filter for black and white printing of ascii (text) files.
43 ascii:\
44 :lp=/dev/lp0:\
45 :sd=/var/spool/lpd/ascii:\
46 :lf=/var/spool/lpd/ascii/log:\
47 :af=/var/spool/lpd/ascii/acct:\
48 :if=/usr/local/bin/ascii.if:\
49 :la:mx#0:\
50 :sh:sf:
51
52
53
54
55
0 /*****************************************************************
1 make_hash_ink.h -generate hashed version of palette.h data
2 -----------------
3 begin : Tue Jan 24 2000
4 copyright : (C) 2000 by the pmn2ppa project
5 author : Klamer Schutte
6 email : Schutte@fel.tno.nl
7 ******************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <assert.h>
21
22 #include "palette.h"
23 #include "hash_ink.h"
24
25 #define SHIFTED (1 << (shift))
26 #define NOTSHIFTED (1 << (8 - shift))
27 #define ENTRIES_ARR (NOTSHIFTED * NOTSHIFTED * NOTSHIFTED)
28
29 int MaxPass;
30
31 struct entry
32 {
33 int xyz;
34 union {
35 int entry_nr;
36 struct hash_ink *hi;
37 } u;
38 struct entry *next; /* this list is sorted on xyz; lowest xyz first */
39 };
40
41 struct entry_list
42 {
43 struct entry *entries;
44 int num_entries;
45 struct entry_list *next; /* this list is sorted in num_entries; lowest
46 numbers first */
47 } *start_list = 0;
48
49 inline int
50 calc_xyz( struct hash_ink *hi )
51 {
52 /* if these assertions fail the result is not unique */
53 assert(hi->x < (1 << 3));
54 assert(hi->y < (1 << 3));
55
56 return hi->x + (hi->y << 3) + (hi->z << 6);
57 }
58
59 int
60 add_entry2( struct entry *e, int n, struct entry **ptr_to )
61 {
62 struct entry_list *cel, **prev_ptr, *new_el;
63 struct entry *ce1, *ce2;
64 static int this_entry = 0;
65 int next_entry;
66
67 assert(n > 0);
68
69 prev_ptr = &start_list;
70 for(cel = start_list; cel != 0; prev_ptr = &(cel->next), cel = cel->next)
71 {
72 if (cel->num_entries < n)
73 continue;
74
75 if (cel->num_entries > n)
76 break;
77
78 for(ce1 = cel->entries, ce2 = e; ce1 != 0;
79 ce1 = ce1->next, ce2 = ce2->next)
80 {
81 assert(ce2 != 0);
82
83 if (ce1->xyz != ce2->xyz)
84 goto next_cel;
85 }
86 /* OK, we have found the correct entry. Delete set *e, and
87 return the entry number */
88 for(ce1 = e; ce1 != 0; ce1 = ce2)
89 {
90 ce2 = ce1->next;
91 free(ce1);
92 }
93
94 if (ptr_to != 0)
95 *ptr_to = cel->entries;
96 return cel->entries->u.entry_nr;
97
98 next_cel: ;
99 }
100
101 /* Hmmm. The set e is not found. Add the first item to the set,
102 and recursively attempt it for its tail... */
103
104 new_el = (struct entry_list *) malloc(sizeof(struct entry_list));
105 /* printf(" New el %x assigned to %x\n", new_el, prev_ptr); */
106 *prev_ptr = new_el;
107 new_el->entries = e;
108 new_el->num_entries = n;
109 /* printf("new el next = %x\n", cel); */
110 new_el->next = cel;
111
112 if (e->next != 0)
113 next_entry = add_entry2( e->next, n-1, &(e->next));
114 else
115 next_entry = -1;
116
117 printf("\t/* %d */\t{ { %d, %d, %d}, %d, %d, %d, ", this_entry,
118 e->u.hi->data[0], e->u.hi->data[1], e->u.hi->data[2],
119 e->u.hi->x, e->u.hi->y, e->u.hi->z );
120 if (next_entry == -1)
121 printf("0 },\n");
122 else
123 printf("&entries%d[%d] },\n", MaxPass, next_entry);
124
125 e->u.entry_nr = this_entry++;
126 if (ptr_to != 0)
127 *ptr_to = e;
128 return e->u.entry_nr;
129 }
130
131 int
132 add_entry( struct hash_ink *hi )
133 {
134 /* First, convert the hash_ink set to a entry set
135 Second, check start_list if it is contained (done in add_entry2())
136 If contained: return the entry number
137 Else: add to start_list */
138
139 struct entry *first = 0, *cur, *loop, **prev_ptr;
140 struct hash_ink *chi;
141 int res;
142 int n = 0; /* n == number of entries in this set */
143
144 for(chi = hi; chi != 0; chi = chi->next)
145 {
146 n++;
147 cur = (struct entry *) malloc( sizeof(struct entry) );
148 cur->xyz = calc_xyz( chi );
149 cur->u.hi = chi;
150 prev_ptr = &first;
151 for(loop = first; loop != 0; loop = loop->next)
152 {
153 if (loop->xyz >= cur->xyz)
154 {
155 cur->next = loop;
156 *prev_ptr = cur;
157 break;
158 }
159 prev_ptr = &(loop->next);
160 }
161 if (loop == 0)
162 {
163 cur->next = 0;
164 *prev_ptr = cur;
165 }
166 }
167
168 res = add_entry2( first, n, 0 );
169
170 for(chi = hi; chi != 0; )
171 {
172 struct hash_ink *nhi = chi->next;
173 free(chi);
174 chi = nhi;
175 }
176
177 return res;
178 }
179
180 int
181 main(int argc, char *argv[] )
182 {
183 /* int MaxPass; */
184 int x, y, z, r, g, b;
185 int ra, ga, ba, rd, gd, bd;
186 float dmin = -1, dmax = -1, d1;
187 struct hash_ink /* **arr, */ *first, *prev, *cur;
188 int i, n;
189 int shift;
190 int *entries_arr;
191
192 if (argc != 3)
193 fprintf(stderr, "Usage: %s MaxPass shift >> hash_ink.c\n", argv[0]);
194
195 MaxPass = atoi(argv[1]);
196 shift = atoi(argv[2]);
197
198 /* arr = (struct hash_ink **) malloc( sizeof(struct hash_ink*) * ENTRIES_ARR );
199 for(i = 0; i < ENTRIES_ARR; i++)
200 arr[i] = 0; */
201 entries_arr = (int *) malloc(sizeof(int) * ENTRIES_ARR);
202 for(i = 0; i < ENTRIES_ARR; i++)
203 entries_arr[i] = -1;
204
205 printf("/* generated by %s %s %s */\n\n", argv[0], argv[1], argv[2] );
206 printf("#include \"hash_ink.h\"\n\n");
207 printf("int shift%d = %d;\n\n", MaxPass, shift);
208 printf("static struct hash_ink entries%d[] = {\n", MaxPass);
209
210 i = 0;
211
212 for(r=0; r < 256; r += SHIFTED)
213 for(g=0; g < 256; g += SHIFTED)
214 for(b=0; b < 256; b += SHIFTED)
215 {
216 int rr = r >> shift;
217 int gg = g >> shift;
218 int bb = b >> shift;
219 int h = (rr << (16 - shift * 2)) + (gg << (8-shift)) + bb;
220 /* fprintf(stderr, "%d %d %d -> %d %d %d -> %d\n", r, g, b, rr, gg, bb, h );*/
221 first = (struct hash_ink *) malloc( sizeof(struct hash_ink));
222 /* arr[h]->x = i++; */
223 cur = first;
224 cur->next = 0;
225
226 /* Now, calculate the dmin for hash entry h.
227 Fill in *first with minimal values */
228 dmin = -1;
229 for(ra = 0; ra < SHIFTED; ra+=(SHIFTED-1))
230 for(ga = 0; ga < SHIFTED; ga += (SHIFTED-1))
231 for(ba = 0; ba < SHIFTED; ba += (SHIFTED -1))
232 {
233 int R = r + ra;
234 int G = g + ga;
235 int B = b + ba;
236 int new_dmin = 0;
237
238 for (z = 0; z < MaxPass + 1; z++)
239 for (x = 0; x < MaxPass + 1; x++)
240 for (y = 0; y < MaxPass + 1; y++)
241 if (!
242 (((x == 4) && (y > 2) && (z > 2)) ||
243 ((y == 4) && (x > 2) && (z > 2)) ||
244 ((z == 4) && (y > 2) && (x > 2))))
245 {
246 rd =
247 (int) R - (int) hp_pal[4 - x][4 - y][4 -
248 z]
249 [0];
250 gd =
251 (int) G - (int) hp_pal[4 - x][4 - y][4 -
252 z]
253 [1];
254 bd =
255 (int) B - (int) hp_pal[4 - x][4 - y][4 -
256 z]
257 [2];
258
259 d1 = /* 0.5 * */ rd * rd + gd * gd + bd * bd;
260
261 if ((dmin < 0) || (d1 < dmin))
262 {
263 /* fprintf(stderr, "Found min %f, %d, %d, %d (%f, %d, %d %d)\n", d1, x, y, z, dmin, cur->x, cur->y, cur->z); */
264 cur->data[0] = hp_pal[4 - x][4 - y][4 - z][0];
265 cur->data[1] = hp_pal[4 - x][4 - y][4 - z][1];
266 cur->data[2] = hp_pal[4 - x][4 - y][4 - z][2];
267 cur->x = x;
268 cur->y = y;
269 cur->z = z;
270 dmin = d1;
271 new_dmin = 1;
272 }
273 }
274
275 }
276
277 /* Now, calculate the dmax for hash entry h.
278 Fill in *first with minimal values */
279 dmax = -1;
280 for(ra = 0; ra < SHIFTED; ra+=(SHIFTED-1))
281 for(ga = 0; ga < SHIFTED; ga += (SHIFTED-1))
282 for(ba = 0; ba < SHIFTED; ba += (SHIFTED-1))
283 {
284 int R = r + ra;
285 int G = g + ga;
286 int B = b + ba;
287
288 z = cur->z;
289 y = cur->y;
290 x = cur->x;
291 {
292 rd =
293 (int) R - (int) hp_pal[4 - x][4 - y][4 -
294 z]
295 [0];
296 gd =
297 (int) G - (int) hp_pal[4 - x][4 - y][4 -
298 z]
299 [1];
300 bd =
301 (int) B - (int) hp_pal[4 - x][4 - y][4 -
302 z]
303 [2];
304
305 d1 = /* 0.5 * */ rd * rd + gd * gd + bd * bd;
306
307 if (d1 > dmax)
308 {
309 /* fprintf(stderr, "Found max %f, %d, %d, %d (%f, %f)\n", d1, x, y, z, dmax, dmin); */
310 cur->data[0] = hp_pal[4 - x][4 - y][4 - z][0];
311 cur->data[1] = hp_pal[4 - x][4 - y][4 - z][1];
312 cur->data[2] = hp_pal[4 - x][4 - y][4 - z][2];
313 cur->x = x;
314 cur->y = y;
315 cur->z = z;
316 dmax = d1;
317 }
318 }
319 }
320
321 /* Now, for every {x,y,z} for which d1 is smaller then dmax add
322 this entry to the *first (as a linked list!) */
323 prev = cur;
324 n = 0;
325 for (z = 0; z < MaxPass + 1; z++)
326 for (x = 0; x < MaxPass + 1; x++)
327 for (y = 0; y < MaxPass + 1; y++)
328 {
329 if (!
330 (((x == 4) && (y > 2) && (z > 2)) ||
331 ((y == 4) && (x > 2) && (z > 2)) ||
332 ((z == 4) && (y > 2) && (x > 2))))
333 {
334 for(ra = 0; ra < SHIFTED; ra+=(SHIFTED-1))
335 for(ga = 0; ga < SHIFTED; ga += (SHIFTED-1))
336 for(ba = 0; ba < SHIFTED; ba += (SHIFTED-1))
337 {
338 int R = r + ra;
339 int G = g + ga;
340 int B = b + ba;
341
342 rd =
343 (int) R - (int) hp_pal[4 - x][4 - y][4 -
344 z]
345 [0];
346 gd =
347 (int) G - (int) hp_pal[4 - x][4 - y][4 -
348 z]
349 [1];
350 bd =
351 (int) B - (int) hp_pal[4 - x][4 - y][4 -
352 z]
353 [2];
354
355 d1 = /* 0.5 * */ rd * rd + gd * gd + bd * bd;
356
357 if ((d1 < dmax) && (!((x == first->x) &&
358 (y == first->y) &&
359 (z == first->z))))
360 {
361 struct hash_ink *cur = (struct hash_ink *)
362 malloc( sizeof(struct hash_ink) );
363 prev->next = cur;
364 cur->next = 0;
365 prev = cur;
366
367 /* fprintf(stderr, "Added min %f, %d, %d, %d (%f, %f, %d, %d %d)\n", d1, x, y, z, dmin, dmax, first->x, first->y, first->z); */
368
369 cur->data[0] = hp_pal[4 - x][4 - y][4 - z][0];
370 cur->data[1] = hp_pal[4 - x][4 - y][4 - z][1];
371 cur->data[2] = hp_pal[4 - x][4 - y][4 - z][2];
372 cur->x = x;
373 cur->y = y;
374 cur->z = z;
375 n++;
376 goto next_xyz; /* break out of ra gb ba loops */
377 }
378 }
379 }
380 next_xyz: ;
381 }
382 /* fprintf(stderr, "%d %d %d (%d): found %d %d %d (%d,%d,%d) (%f, %f) * %d\n",
383 r, g, b, h, first->x, first->y, first->z,
384 first->data[0], first->data[1], first->data[2],
385 dmin, dmax, n ); */
386 entries_arr[h] = add_entry(first);
387 }
388
389 #ifdef notdef
390 printf("#include \"hash_ink.h\"\n\n");
391 printf("int shift%d = %d;\n\n", MaxPass, shift);
392 printf("static struct hash_ink entries%d[] = {\n", MaxPass);
393
394 n = 0;
395 for(i = 0; i < ENTRIES_ARR; i++)
396 {
397 printf("\t{ {%d, %d, %d}, %d, %d, %d, ",
398 arr[i]->data[0], arr[i]->data[1], arr[i]->data[2],
399 arr[i]->x, arr[i]->y, arr[i]->z );
400 n++;
401 cur = arr[i]->next;
402 while( cur != 0 )
403 {
404 printf(" &entries%d[%d] },\n", MaxPass, n);
405 printf("\t\t{ { %d, %d, %d} , %d, %d, %d, ",
406 cur->data[0], cur->data[1], cur->data[2],
407 cur->x, cur->y, cur->z );
408 n++;
409 cur = cur->next;
410 }
411 printf(" 0 },\n");
412 }
413 #endif
414 printf("};\n\n");
415
416 printf("struct hash_ink *arr_max%d[] = {", MaxPass);
417
418 n = 0;
419 for(i = 0; i < ENTRIES_ARR; i++)
420 {
421 printf("\t&entries%d[%d], \n", MaxPass, entries_arr[i]);
422 #ifdef notdef
423 n++;
424 cur = arr[i]->next;
425 while( cur != 0)
426 {
427 n++;
428 cur = cur->next;
429 }
430 #endif
431 }
432
433 printf("};\n\n/* end of file generated by %s %s %s (%d entries) */\n\n",
434 argv[0], argv[1], argv[2], n);
435
436 return 0;
437 }
0 /***************************************************************************
1 palette.h - contains the possible palette of colors for HP PPA printers
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1999-2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 /*
18 * this array conteins rgb coordinates for each color printable
19 * different component values are obtained shooting 0 to 4 ink drops
20 * over the same pixel.
21 *
22 * Giorgio Marzano <mochoman@tin.it>
23 *
24 */
25
26
27 /* unsigned char */ int hp_pal[5][5][5][3] = {
28 {
29
30 {{25, 20, 20}, {69, 48, 49}, {83, 50, 49},
31 {107, 50, 47}, {246, 57, 50}},
32 {{60, 56, 54}, {67, 54, 50}, {82, 57, 50},
33 {109, 59, 50}, {254, 67, 53}},
34 {{59, 65, 56}, {65, 65, 53}, {80, 67, 52},
35 {109, 72, 52}, {254, 83, 56}},
36 {{57, 78, 58}, {64, 81, 55}, {77, 87, 55},
37 {109, 96, 56}, {255, 116, 60}},
38 {{56, 120, 62}, {62, 132, 60}, {76, 153, 61},
39 {106, 187, 63}, {255, 255, 71}}
40 },
41 {
42
43 {{58, 47, 57}, {65, 44, 52}, {78, 45, 51},
44 {103, 47, 51}, {248, 53, 53}},
45 {{56, 53, 58}, {63, 51, 54}, {75, 51, 52},
46 {103, 55, 53}, {249, 62, 55}},
47 {{54, 61, 61}, {60, 60, 56}, {74, 62, 55},
48 {105, 68, 57}, {243, 80, 60}},
49 {{53, 62, 72}, {60, 77, 61}, {72, 81, 59},
50 {104, 91, 61}, {254, 114, 70}},
51 {{54, 117, 71}, {60, 129, 68}, {72, 148, 69},
52 {105, 185, 73}, {255, 255, 85}}
53 },
54 {
55
56 {{56, 45, 63}, {61, 43, 58}, {74, 43, 56},
57 {99, 44, 56}, {240, 51, 58}},
58 {{53, 48, 64}, {60, 48, 61}, {73, 48, 59},
59 {101, 51, 60}, {245, 60, 63}},
60 {{52, 57, 68}, {57, 57, 65}, {72, 59, 64},
61 {102, 64, 65}, {251, 78, 71}},
62 {{51, 70, 73}, {57, 73, 71}, {70, 79, 71},
63 {103, 90, 74}, {254, 114, 82}},
64 {{51, 113, 84}, {59, 128, 85,}, {71, 146, 85},
65 {108, 186, 93}, {255, 255, 108}}
66 },
67 {
68
69 {{54, 41, 69}, {59, 40, 67}, {70, 41, 66},
70 {99, 43, 66}, {239, 52, 71}},
71 {{52, 47, 77}, {59, 46, 75}, {72, 48, 74},
72 {100, 50, 75}, {243, 61, 79}},
73 {{51, 55, 85}, {56, 54, 83}, {69, 56, 81},
74 {102, 63, 84}, {249, 77, 90}},
75 {{50, 70, 96}, {57, 74, 97}, {68, 78, 96},
76 {102, 89, 99}, {254, 118, 111}},
77 {{51, 115, 117}, {59, 129, 119}, {73, 151, 124},
78 {108, 191, 133}, {255, 255, 154}}
79 },
80 {
81
82 {{53, 40, 98}, {59, 40, 97}, {70, 40, 96},
83 {100, 45, 100}, {241, 55, 106}},
84 {{52, 45, 111}, {59, 45, 110}, {71, 47, 111},
85 {100, 53, 116}, {248, 66, 124}},
86 {{51, 52, 129}, {57, 54, 131}, {70, 56, 131},
87 {102, 66, 139}, {253, 89, 152}},
88 {{51, 68, 161}, {58, 72, 167}, {71, 79, 171},
89 {106, 93, 182}, {254, 131, 200}},
90 {{56, 122, 242}, {65, 138, 252}, {84, 163, 254},
91 {122, 204, 255}, {255, 255, 255}}
92 }
93 };
0 gs-pnm2ppa is a driver that integrates pnm2ppa into Jacob Langford's
1 simple spool-free printing system PDQ ("Print, Don't Queue").
2
3 It will work for the following printers that use the PPA protocol:
4
5 HP DeskJet 710C, 712C
6 HP DeskJet 720C, 722C
7 HP DeskJet 820Cse, 820Csi
8 HP DeskJet 1000Cse, 1000Csi
9
10 The printer must be installed LOCALLY on the host that runs pdq;
11 translation to the PPA format that the printer accepts must be done
12 on the host to which the printer is physically attached.
13 gs-pnm2ppa cannot be used to print to a PPA printer that is accessed
14 over a network.
15 -------------------------------------------------------------
16
17 PDQ currently has a homepage at:
18
19 http://pdq.sourceforge.net
20
21 The latest release (as of September 2000) is pdq-2.2.1.
22 ------------------------
23
24 After installing a version of pdq that does not include this driver,
25 just copy the file "gs-pnm2ppa" into the pdq ghostscript driver directory
26 (usually /etc/pdq/drivers/ghostscript/), and the file "dummy" into
27 the interfaces directory (usually /etc/pdq/interfaces).
28 You must be root to do this:
29
30 cp gs-pnm2ppa /etc/pdq/drivers/ghostscript
31 cp dummy /etc/pdq/intefaces
32
33 Then run "xpdq" to setup the printer, selecting the driver "gs-pnm2ppa",
34 and the interface "dummy". You must specify The local parallel printer port
35 to which the printer is attached when configuring the driver.
36 You must then return to the "driver option" screen and select the correct
37 printer model and desired color mode. You may need to exit xpdq to
38 activate the settings you just entered.
39
40 Note that the user of the printer must have write permission to
41 the port it is attached to.
42
43 Thats all!.
44 ------------------------------------------------------------------
45 The pnm2ppa homepage is at:
46
47 http://sourceforge.net/projects/pnm2ppa
48
49 send comments/bug reports about gs-pnm2ppa (but not pdq) to:
50
51 pnm2ppa_advice@users.sourceforge.net
52
53
54
55
56
57
0 # Copyright 2000 Duncan Haldane <duncan_haldane@users.sourceforge.net>
1 #
2 # PDQ interface: dummy
3 #
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License version 2.
6 #
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10 # for more details.
11 #
12 # You should have received a copy of the GNU General Public License along
13 # with this program; if not, write to the Free Software Foundation, Inc., 59
14 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 ############################################################
16
17
18
19 interface dummy {
20
21 help = "Use this dummy interface if your printer is connected
22 to a local parallel port of your computer, which is
23 configured by a driver (e.g., gs-pnm2ppa) that bypasses
24 the PDQ interface"
25
26
27 argument {
28 var = "PORT"
29 desc = "Dummy device"
30 help = "Do not change this setting"
31 def_value = "/dev/null"
32 }
33
34
35 send_exec {
36 echo "PDQ interface was bypassed"
37 }
38
39
40 }
41
42
43
44
45
46
47
0 # Copyright 2000 Duncan Haldane <duncan_haldane@users.sourceforge.net>
1 #
2 # PDQ driver: gs-pnm2ppa
3 #
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License version 2.
6 #
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10 # for more details.
11 #
12 # You should have received a copy of the GNU General Public License along
13 # with this program; if not, write to the Free Software Foundation, Inc., 59
14 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 #
16 ####################################################################
17 # v. 0.11 September 20, 2000
18 #
19 # This is a pdq driver for use with pnm2ppa, a postfilter used in combination
20 # with Ghostscript to print on HP DeskJet printers that use HP's proprietary
21 # "host-based" PPA ("Printer Performance Architecture") protocol.
22 # For information on pnm2ppa, see the pnm2ppa project homepage
23 # at http://sourceforge.net/projects/pnm2ppa
24 #
25 # It is designed to work with Jacob Langford's PDQ ("Print, Don't Queue")
26 # spool-free printing system (works with pdq-2.2.1).
27 # (homepage: http://feynman.tam.uiuc.edu/pdq )
28 #
29 # To add this to a pdq installation that does not already contain it,
30 # simply copy this file into the pdq ghostscript drivers directory
31 # (usually /etc/pdq/drivers/ghostscript/).
32 #
33 # The nnn.log file written by print job nnn in the .printjobs directory
34 # records the GhostScript DRIVER and PaperSize used, and the set of options
35 # passed to pnm2ppa. This information may be useful for troubleshooting,
36 # and can be viewed with the Job->"Show details" feature of xpdq.
37 #
38 #####################################################################
39 driver "gs-pnm2ppa" {
40
41 help "Designed for PostScript(tm) printing on HP DeskJet 710C, 712C,
42 720C, 722C, 820Cse, 820Cxi, 1000Cse, and 1000Cxi printers
43 which use the PPA protocol.
44 This driver can only print to a local parallel port to
45 which the printer is attached, and which is specified as
46 a (required) driver argument.
47 The \"dummy\" PDQ interface should be used.
48 Ghostscript \"pnmraw\" drivers are required, as well as the
49 \"pnm2ppa\" postfilter
50 (available from http://sourceforge.net/projects/pnm2ppa ).
51 Uses enscript for text-to-PostScript conversion before
52 printing text files."
53
54 requires "gs pnm2ppa"
55
56 required_args "LOCAL_PORT"
57
58 verify_exec {
59 (gs -h |grep -q pnmraw ) ||
60 (echo "Required Ghostscript driver \"pnmraw\" is not available." ; exit 1)
61 }
62
63 option {
64 desc = "Printer model"
65 var = PPA_PRINTER
66
67 choice "DJ710" {
68 value = "-v 710"
69 desc = "HP DeskJet 710C, 712C"
70 help = "Select this for HP 710C series
71 DeskJet printers"
72 }
73 choice "DJ720" {
74 value = "-v 720"
75 desc = "HP DeskJet 720C, 722C"
76 help = "Select this for HP 720C series
77 DeskJet printers"
78 }
79 choice "DJ820" {
80 value = "-v 820"
81 desc = "HP DeskJet 820Cse, 820Cxi"
82 help = "Select this for HP 820C series
83 DeskJet printers"
84 }
85 choice "DJ1000" {
86 value = "-v 1000"
87 desc = "HP DeskJet 1000Cse, 1000Cxi"
88 help = "Select this for HP 1000C series
89 DeskJet printers"
90 }
91 }
92
93 option {
94 desc = "Standard color/print quality choices"
95 var = PPA_MODE
96
97 default_choice "ColorNormal"
98
99 choice "BlackEconoFast" {
100 value = "b1"
101 desc = "Black and white, econofast mode"
102 help = "Ink economy mode, with black ink only"
103 }
104
105 choice "BlackNormal" {
106 value = "b2"
107 desc = "Black and white, normal quality"
108 help = "Normal printing, with black ink only"
109 }
110
111 choice "ColorEconoFast" {
112 value = "c1"
113 desc = "Color, econofast mode"
114 help = "Ink economy mode (single pass of print head),
115 with fast dithering option.
116 Both color and black inks are used."
117 }
118
119 choice "ColorNormal" {
120 value = "c5"
121 desc = "Color, normal quality"
122 help = "Ink economy mode (single pass of print head).
123 Both color and black inks are used. "
124 }
125
126 choice "ColorBest" {
127 value = "c3"
128 desc = "Color, high quality"
129 help = "Multiple passes of print head.
130 Both color and black inks are used."
131 }
132
133 choice "ColorNormalNoBlack" {
134 value = "c2"
135 desc = "Color, normal quality, black ink disabled"
136 help = "Ink economy mode (single pass of print head).
137 \"Black\" is made by mixing colored inks:
138 no black ink is used."
139 }
140
141 choice "ColorBestNoBlack" {
142 value = "c4"
143 desc = "Color, high quality, black ink disabled"
144 help = "This is the best (but slowest) choice for
145 color images.
146 \"Black\" is made by mixing colored inks;
147 no black ink is used.
148 Prints unidirectionally."
149 }
150 }
151
152
153 option {
154 desc = "Force uni/bidirectional printing"
155 var = PPA_UNIMODE
156
157 default_choice "Bi"
158
159 choice "Bi" {
160 value = ""
161 desc = "default choice"
162 help = "Use Bidirectional printing
163 (when this is faster)"
164 }
165 choice "Uni" {
166 value = "--uni"
167 desc = "force unidirectional print sweeps"
168 help = "Unidirectional printing is slower,
169 but may be best for images"
170 }
171 }
172
173
174 option {
175 var = PPA_BLACKNESS;
176 desc = "black ink correction (for text)"
177
178 default_choice "B2"
179
180 choice "B0" {
181 value = "-B 0"
182 desc = "blackness=0"
183 help = "No black ink is printed"
184 }
185
186 choice "B1" {
187 value = "-B 1"
188 desc = "blackness=1"
189 help = "Reduced black ink density"
190 }
191
192 choice "B2" {
193 value = ""
194 desc = "blackness=2"
195 help = "Default black ink density"
196 }
197
198 choice "B3" {
199 value = "-B 3"
200 desc = "blackness=3"
201 help = "Increased black ink density"
202 }
203 choice "B4" {
204 value = "-B 4"
205 desc = "blackness=4"
206 help = "Maximum black ink density
207 (May cause wetting of paper!)"
208 }
209 }
210
211
212
213 option {
214 desc = "Color Correction (\"Gamma\" curves)."
215 var = PPA_GAMMA
216
217 default_choice "useGamma"
218
219 choice "useGamma" {
220 value = ""
221 desc = "Use color correction"
222 help = "Carry out color correction using an optional
223 \"Gamma file\", or Gamma curves based
224 on configuration file parameters. (see
225 pnm2ppa documentation)"
226 }
227 choice "noGamma" {
228 value = "--noGamma"
229 desc = "No color correction"
230 help = "Do not use any color correction curves."
231 }
232 }
233
234 argument {
235 var = "PPA_CONF"
236 desc = "pnm2ppa configuration file"
237 help = "Give the full path to the pnm2ppa configuration file
238 you wish to use. See \"man pnm2ppa\", \"pnm2ppa -h\",
239 or the example configuration file distributed with
240 pnm2ppa for information about what can be configured
241 there."
242
243 def_value = "/etc/pnm2ppa.conf"
244 }
245
246 argument {
247 var = "PPA_GAMMA_NORMAL"
248 desc = "Gamma file (normal quality color)"
249 help = "Give the full path to an optional color
250 correction (\"Gamma curve\") file for use with
251 normal quality mode color printing (see pnm2ppa
252 documentation)."
253
254 def_value = ""
255 }
256
257
258 argument {
259 var = "PPA_GAMMA_HIQUAL"
260 desc = "Gamma file (high quality color)"
261 help = "Give the full path to an optional color
262 correction (\"Gamma curve\") file for use with
263 high-quality mode color printing (see pnm2ppa
264 documentation)."
265
266 def_value = ""
267 }
268
269
270 argument {
271 var = "EXTRA_PPA_OPTS"
272 desc = "Extra pnm2ppa options"
273 help = "Enter any extra pnm2ppa options you wish to add:
274 these will take precedence over other options set
275 by this driver. See \"man pnm2ppa\" or
276 \"pnm2ppa -h\" for a full description."
277
278 def_value = ""
279 }
280
281
282
283 argument {
284 var = "LOCAL_PORT"
285 desc = "Local printer port"
286 help = "pnm2ppa can only print to a printer attached to a
287 local parallel port on the host system running this
288 driver, and by-passes the \"interface\" in PDQ.
289 (The \"dummy\" PDQ interface should be selected.)
290 On Linux, parallel ports are called /dev/lp0,
291 /dev/lp1,.... On other systems, consult your
292 documentation. The parallel port used must be
293 \"world-writable\" (i.e, the user must be able
294 to write to it). "
295 }
296
297
298 argument {
299 var = "PAPERSIZE"
300 desc = "paper size"
301 help = "Set this to a valid Ghostscript papersize:
302 letter, legal, a3, a4, etc...
303 (see \"man gs \" for full list).
304 The papersize must of course be one compatible with
305 the particular HP DeskJet model, or pnm2ppa will
306 reject it."
307
308 def_value = "letter"
309 }
310
311 argument {
312 var = "ENSCRIPT_OPTS"
313 desc = "enscript options"
314 help = "enscript (if available) is used to convert text
315 files to postscript before printing by pnm2ppa.
316 Give enscript options, in particular
317 \"--media=(papersize)\". Note that enscript papersize
318 names (listed in the configuration file, usually
319 /etc/enscript.cfg) are a little different from the
320 Ghostscript papersize names. See \"man enscript\".
321 If enscript is not available,
322 you will only be able to print postscript files."
323
324 def_value = "--no-header --media=Letterdj"
325 }
326
327
328 language_driver postscript {} # Nothing to do...
329
330 language_driver text {
331 convert_exec {
332 if (enscript --help |grep -q sage); then
333 enscript -o $OUTPUT \
334 -b "$FILENAME %W Page \$% of \$=" \
335 $ENSCRIPT_OPTS $INPUT
336 exit 0
337 else
338 echo "ABORTED: enscript needed to print text files, but not found"
339 exit 1
340 fi
341 }
342 }
343
344 filter_exec {
345 PDQ_DRIVER="v0.11 September 20, 2000"
346 echo "PDQ ghostscript driver gs-pnm2ppa $PDQ_DRIVER:"
347 if [ "$PPA_MODE" = "b1" ]; then
348 GS_DEVICE="pbmraw"
349 PPA_COLOR="--bw --eco"
350 elif [ "$PPA_MODE" = "b2" ]; then
351 GS_DEVICE="pbmraw"
352 PPA_COLOR="--bw"
353 elif [ "$PPA_MODE" = "c1" ]; then
354 GS_DEVICE="ppmraw"
355 PPA_COLOR="--eco --fd"
356 elif [ "$PPA_MODE" = "c2" ]; then
357 GS_DEVICE="ppmraw"
358 PPA_COLOR="-p --eco -F $PPA_GAMMA_NORMAL "
359 elif [ "$PPA_MODE" = "c3" ]; then
360 GS_DEVICE="ppmraw"
361 PPA_COLOR=" -F $PPA_GAMMA_HIQUAL "
362 elif [ "$PPA_MODE" = "c4" ]; then
363 GS_DEVICE="ppmraw"
364 PPA_COLOR="-p --uni -F $PPA_GAMMA_HIQUAL "
365 elif [ "$PPA_MODE" = "c5" ]; then
366 GS_DEVICE="ppmraw"
367 PPA_COLOR="--eco -F $PPA_GAMMA_NORMAL "
368 else
369 echo "ABORTED: No valid Color choice found"
370 exit 1
371 fi
372
373 echo "Ghostscript: DEVICE=$GS_DEVICE, PaperSize=$PAPERSIZE"
374 PPA_OPTIONS="$PPA_PRINTER"
375 if [ -f $PPA_CONF ] ; then
376 PPA_OPTIONS="$PPA_OPTIONS -f $PPA_CONF"
377 else
378 echo "WARNING: specified pnm2ppa configuration file \"$PPA_CONF\" not found!"
379 fi
380 PPA_OPTIONS="$PPA_OPTIONS $PPA_COLOR"
381 PPA_OPTIONS="$PPA_OPTIONS $PPA_GAMMA"
382 PPA_OPTIONS="$PPA_OPTIONS $PPA_UNIMODE"
383 PPA_OPTIONS="$PPA_OPTIONS $PPA_BLACKNESS"
384 PPA_OPTIONS="$PPA_OPTIONS $EXTRA_PPA_OPTS"
385
386 echo "pnm2ppa options: $PPA_OPTIONS"
387 echo "PPA output streamed directly to local port $LOCAL_PORT"
388 gs \
389 -q -dBATCH -dSAFER -dNOPAUSE \
390 -sDEVICE=$GS_DEVICE \
391 -r600x600 \
392 -sPaperSize=$PAPERSIZE \
393 -sOutputFile=- \
394 $INPUT | pnm2ppa $PPA_OPTIONS -i - -o $LOCAL_PORT
395 rm -f $INPUT
396 rm -f $OUTPUT
397 exit 0
398
399
400 }
401
402 }
403
404
405
406
407
408
409
410
411
412
413
414
415
0 /***************************************************************************
1 pnm2ppa.c - program to print PNM input streams to PPA Deskjets
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <sys/stat.h>
21 #include <unistd.h>
22
23 #include <getopt.h>
24 #include <sys/param.h>
25
26 #define __PNM2PPA_C__
27
28 #include "syslog.h"
29 #include "global.h"
30 #include "image.h"
31 #include "debug.h"
32 #include "defaults.h"
33 #include "ppa.h"
34 #include "pnm2ppa.h"
35 #include "gamma.h"
36 #include "lang.h"
37
38
39 double Gamma_R, Gamma_G, Gamma_B;
40 int adjust_coloffsx, adjust_coloffsy;
41
42 int
43 print_pnm (FILE * fptr)
44 {
45 char line[1024];
46 image_t image;
47 int numpages = 0, pagenum ;
48 int res;
49 int image_width;
50
51 snprintf(syslog_message,message_size,"%s",
52 gMessages[LOG_START]);
53 wrap_syslog (LOG_INFO,"%s",syslog_message);
54
55
56 ppa_init_job (&printer);
57
58 while (initImage (&image, fptr))
59 {
60 pagenum = numpages + 1;
61 DPRINTF ("Initializing page %d...\n ", pagenum);
62 ppa_init_page (&printer);
63 DPRINTF ("Done!\n");
64 DPRINTF ("Loading page %d... \n", pagenum);
65 ppa_load_page (&printer);
66 DPRINTF ("Done!\n");
67 image_width = image.width * 3 * sizeof (int) ;
68 DPRINTF ("image.width * 3 * sizeof(int)) == %d\n",
69 image_width );
70
71 gErrVec = malloc (image_width );
72
73 if (!gErrVec)
74 {
75 snprintf(syslog_message,message_size,"print_pnm(): %s",
76 gMessages[E_BADMALLOC]);
77 wrap_syslog (LOG_CRIT, "%s",syslog_message);
78 exit (1);
79 }
80 memset (gErrVec, 0x00, image_width );
81
82 gErrVec_bw = malloc (image_width );
83
84 if (!gErrVec_bw)
85 {
86 snprintf(syslog_message,message_size, "print_pnm(): %s",
87 gMessages[E_BADMALLOC]);
88 wrap_syslog (LOG_CRIT, "%s",syslog_message);
89 exit (1);
90 }
91 memset (gErrVec_bw, 0x00, image_width );
92
93 snprintf(syslog_message,message_size, "%s %d (%s)\n",
94 gMessages[LOG_PAGE], pagenum, gFormat);
95 wrap_syslog (LOG_INFO, "%s",syslog_message);
96
97
98 if ((res = ppa_print_page (&printer, &image)) != 0)
99 {
100 DPRINTF ("ppa_print_page returned %d!!\n", res);
101 free (gErrVec);
102 return res;
103 }
104 free (gErrVec);
105 free (gErrVec_bw);
106 snprintf(syslog_message,message_size, "%s %d\n",
107 gMessages[LOG_FINISH], pagenum );
108 wrap_syslog (LOG_INFO, "%s",syslog_message);
109
110 DPRINTF ("Ejecting page %d... \n", pagenum);
111 ppa_eject_page (&printer);
112 DPRINTF ("Ejected!\n");
113
114 /* eat any remaining whitespace */
115 if (image.version == P1_PBM)
116 fgets (line, 1024, fptr);
117
118 numpages++;
119 if (gGammaMode)
120 break;
121 }
122
123 if (numpages == 0)
124 {
125 snprintf(syslog_message,message_size,"%s" ,
126 gMessages[LOG_NOPAGES]);
127 wrap_syslog (LOG_INFO, "%s",syslog_message);
128 return 1;
129 }
130
131 ppa_end_print (&printer);
132
133 snprintf(syslog_message,message_size,"%s" ,
134 gMessages[LOG_SUCCESS]);
135 wrap_syslog (LOG_INFO, "%s",syslog_message);
136
137 fclose (image.fptr);
138 fclose (printer.fptr);
139
140 return 0;
141 }
142
143 /* safe transcription of paths specified in user input */
144 char *
145 readPath(char *input )
146 {
147 char File_path[MAXPATHLEN];
148 char *path = NULL;
149 /* security audit ajv 20001007; be very careful with input strings!*/
150 if (strlen(input) < MAXPATHLEN )
151 {
152 if ( strncpy (File_path, input, MAXPATHLEN ))
153 {
154 /*
155 a user-specifed file *File_path may later be opened;
156 should any extra validation of this be performed now ?
157 */
158 path = File_path;
159 return path;
160 }
161 }
162 else
163 {
164 snprintf(syslog_message,message_size,"%s %d\n",
165 gMessages[E_BAD_PATH], MAXPATHLEN);
166 wrap_syslog (LOG_CRIT,"%s",syslog_message);
167 abort();
168 }
169 return path;
170 }
171
172 /* this should be called when you need to set up the printer
173 * object for a particular printer.
174 */
175
176 void
177 set_printer_specific_defaults (void)
178 {
179 if (printer.version != HP7X0 &&
180 printer.version != HP820 && printer.version != HP1000)
181 {
182 snprintf(syslog_message,message_size, "set_printer_defaults(): %s",
183 gMessages[E_PPA_UNKNOWN]);
184 wrap_syslog (LOG_CRIT,"%s",syslog_message);
185
186 exit (1);
187 }
188
189 printer.ColBwOffsX = gPrinterDefaults[printer.version].ColBwOffsX;
190 printer.ColBwOffsY = gPrinterDefaults[printer.version].ColBwOffsY;
191
192 printer.x_offset = gPrinterDefaults[printer.version].x_offset;
193 printer.y_offset = gPrinterDefaults[printer.version].y_offset;
194
195 printer.r2l_col_offset = gPrinterDefaults[printer.version].r2l_col_offset;
196 printer.r2l_bw_offset = gPrinterDefaults[printer.version].r2l_bw_offset;
197
198 printer.top_margin = gPrinterDefaults[printer.version].top_margin;
199 printer.bottom_margin = gPrinterDefaults[printer.version].bottom_margin;
200
201 printer.left_margin = gPrinterDefaults[printer.version].left_margin;
202 printer.right_margin = gPrinterDefaults[printer.version].right_margin;
203
204 printer.marg_diff = gPrinterDefaults[printer.version].marg_diff;
205 printer.bufsize = gPrinterDefaults[printer.version].bufsize;
206 printer.min_pagewidth = gPrinterDefaults[printer.version].min_pagewidth;
207 printer.max_pagewidth = gPrinterDefaults[printer.version].max_pagewidth;
208 printer.min_pageheight = gPrinterDefaults[printer.version].min_pageheight;
209 printer.max_pageheight = gPrinterDefaults[printer.version].max_pageheight;}
210
211 void
212 show_usage (char *prog)
213 {
214 printf ("usage: %s [ options ] [-i <infile> ] [ -o <outfile> ]] \n\n",
215 prog);
216 printf
217 (" Prints a pnm- or pnmraw-format <infile> to HP720/820/1000-format <outfile>.\n\n");
218 printf (" -b <margin> bottom margin in 1\"/600 (default: 150 = 0.25\")\n");
219 printf (" --bi forces bidirectional print head sweeps\n");
220 printf (" -B <n> density of black ink (n = 0,1,2,3 or 4)\n");
221 printf (" --bw forces black/white output\n");
222 printf (" -d dumps the configuration to stdout\n");
223 printf (" --eco Econofast mode (uses less ink)\n");
224 printf (" -f <cfgfile> read printer settings from configuration file <cfgfile>\n");
225 printf (" -F <gammaFile> read color correction table from file <gammaFile>\n");
226 printf (" --fd use fast dithering mode\n");
227 printf (" -g print color calibration page. See CALIBRATION.txt\n");
228 printf (" -h, --help displays this help text.\n");
229
230 printf (" -i <infile> input from file <infile>, \"-i -\" means stdin\n");
231 printf (" -l <margin> left margin in 1\"/600 (default: 150 = 0.25\")\n");
232 printf (" --noGamma suppresses any color correction\n");
233 printf (" -o <outfile> output to file <outfile>, \"-o -\" means stdout\n");
234 printf (" -p disable black ink cartridge\n");
235 printf (" -r <margin> right margin in 1\"/600 (default: 150 = 0.25\")\n");
236 printf (" -s <paper> default papersize (a4, legal, letter = us (default))\n");
237 printf (" -t <margin> top margin in 1\"/600 (default: 150 = 0.25\")\n");
238 printf (" --uni forces unidirectional print head sweeps\n");
239 printf (" -v <model> set the printer model (710, 712, 720, 722, 820, or 1000)\n");
240 printf (" --verbose outputs syslog output to stderr as well\n");
241 printf (" --version Display the version of %s to the syslog\n",
242 prog);
243 printf (" -x <offset> vertical offset adjustment in 1\"/600\n");
244 printf (" -y <offset> horizontal offset adjustment in 1\"/600\n\n");
245
246 printf
247 (" The -v option resets the margins and offset adjustments to the \n");
248 printf
249 (" default values for that printer model. <infile> and <outfile> default\n");
250 printf
251 (" to stdin and stdout. '-' is a synonym for stdin and stdout.\n\n");
252 printf
253 (" Configuration files specified with the '-f' parameter have the following\n format:\n\n");
254 printf (" # Comment\n");
255 printf (" <key1> <value1>\n");
256 printf (" <key2> <value2>\n");
257 printf (" [etc.]\n\n");
258 printf
259 (" Valid keys include 'version', 'xoffset', 'yoffset', 'topmargin', 'leftmargin',\n");
260 printf
261 (" 'rightmargin', 'bottommargin', 'blackness', 'papersize', or any non-null\n");
262 printf
263 (" truncated version of these words. Valid values are the same as with \n");
264 printf
265 (" the corresponding command-line parameters.\n");
266 printf
267 (" Other keys that can be set in the configuration file include:\n");
268 printf
269 (" 'silent', 'verbose', 'unimode', 'blackshear', 'colorshear',\n");
270 printf
271 (" 'RedGammaIdx','BlueGammaIdx', 'GreenGammaIdx',\n");
272 printf
273 (" 'GammaR', 'GammaG', 'GammaB', 'ColOffsX', 'ColOffsY',\n");
274 printf
275 (" 'black_ink', 'color_ink', 'cyan_ink', 'magenta_ink', 'yellow_ink';\n");
276 printf
277 (" see documentation in the sample configuration file for their usage.\n\n");
278 printf
279 (" The order in which parameters are specified is important:\n");
280 printf
281 (" the file /etc/pnm2ppa.conf, if it exists, is processed as a configuration\n");
282 printf
283 (" file before any command-line parameters are processed.\n");
284 printf
285 (" If an alternate configuration file is specified on the command line\n");
286 printf
287 (" with the '-f' parameter, its contents are processed at that point.\n");
288 printf
289 (" If a parameter is specified more than once, only its last value is used.\n\n");
290 }
291
292 void
293 parm_version (char *arg)
294 {
295
296 if (!strncasecmp (arg, "error", 5))
297 {
298 wrap_closelog ();
299 wrap_openlog ("pnm2ppa", 1);
300 snprintf(syslog_message,message_size,"parm_version(): %s",
301 gMessages[E_CONFIG]);
302 wrap_syslog (LOG_CRIT,"%s",syslog_message);
303
304 exit (1);
305 }
306
307 if (!strcasecmp (arg, "hp720") || !strcmp (arg, "720") ||
308 !strcasecmp (arg, "hp722") || !strcmp (arg, "722") ||
309 !strcasecmp (arg, "hp710") || !strcmp (arg, "710") ||
310 !strcasecmp (arg, "hp712") || !strcmp (arg, "712"))
311 printer.version = HP7X0;
312 else if (!strcasecmp (arg, "hp820") || !strcmp (arg, "820"))
313 printer.version = HP820;
314 else if (!strcasecmp (arg, "hp1000") || !strcmp (arg, "1000"))
315 printer.version = HP1000;
316 else
317 {
318 snprintf(syslog_message,message_size,"parm_version(): %s",
319 gMessages[E_PPA_UNKNOWN]);
320 wrap_syslog (LOG_CRIT,"%s",syslog_message);
321
322 exit (1);
323 }
324 set_printer_specific_defaults ();
325 }
326
327 void
328 parm_iversion (int arg)
329 {
330 switch (arg)
331 {
332 case 720:
333 case 722:
334 case 710:
335 case 712:
336 printer.version = HP7X0;
337 break;
338 case 820:
339 printer.version = HP820;
340 break;
341 case 1000:
342 printer.version = HP1000;
343 break;
344 default:
345 {
346 snprintf(syslog_message,message_size,"parm_iversion(): %s",
347 gMessages[E_PPA_UNKNOWN]);
348 wrap_syslog (LOG_CRIT,"%s",syslog_message);
349
350 exit (1);
351 }
352 }
353 set_printer_specific_defaults ();
354 }
355
356 void
357 dump_config (void)
358 {
359 printf ("pnm2ppa version " VERSION "\n\n");
360
361 printf ("Printer: ");
362 switch (printer.version)
363 {
364 case HP7X0:
365 printf ("HP 710c, 712c, 720c or 722c\n\n");
366 break;
367
368 case HP820:
369 printf ("HP820\n\n");
370 break;
371
372 case HP1000:
373 printf ("HP1000\n\n");
374 break;
375
376 case NOPRINTER:
377 default:
378 printf ("unknown printer\n");
379 exit (1);
380 }
381
382 printf ("Color Head Offset Adjustments:\n ColOffsX: %d\n ColOffsY: %d\n\n",
383 adjust_coloffsx, adjust_coloffsy);
384
385 printf ("Offsets:\n xoffset: %d\n yoffset: %d\n\n",
386 printer.x_offset, printer.y_offset);
387
388 printf ("Shearing corrections for bidirectional printing (right_to_left):\n blackshear: %d\n colorshear: %d\n\n",
389 printer.r2l_bw_offset, printer.r2l_col_offset);
390
391 printf ("Margins:\n\ttop:\t%d\n\tbottom:\t%d\n",
392 printer.top_margin, printer.bottom_margin);
393 printf ("\tleft:\t%d\n\tright:\t%d\n\n",
394 printer.left_margin, printer.right_margin);
395 printf ("Gamma values:\n\tRed:\t%f\n\tGreen:\t%f\n\tBlue:\t%f\n",
396 Gamma_R, Gamma_G, Gamma_B );
397 exit (0);
398 }
399
400 /* only let gSilent be set to switch off syslog from /etc/pnm2ppa.conf,
401 and not from
402 subsequent readings of config files
403 */
404 BOOLEAN system_config_file ;
405
406 void
407 read_config_file (char *fname)
408 {
409 FILE *cfgfile = fopen (fname, "r");
410 char line[1024], key[14], buf[10];
411 int len, value, count, lineno = 1;
412
413 if (!cfgfile)
414 {
415 snprintf(syslog_message,message_size,"read_config_file(): %s",
416 gMessages[E_BADCONFIGFILE] );
417 wrap_syslog (LOG_CRIT,"%s",syslog_message);
418
419 exit (1);
420 }
421
422 while (fgets (line, 1024, cfgfile))
423 {
424 if (strchr (line, '#'))
425 *strchr (line, '#') = 0;
426 count = sscanf (line, "%13s%9s", key, buf);
427 if (count == 2)
428 {
429 DPRINTF("config file %s: keyword %s value %s\n",fname,key,buf);
430 }
431 switch (count)
432 {
433 case 2:
434 value = atoi (buf);
435 len = strlen (key);
436 if (!strncmp (key, "version", len))
437 parm_iversion (value);
438 else if (!strncmp (key, "xoffset", len))
439 printer.x_offset = value;
440 else if (!strncmp (key, "yoffset", len))
441 printer.y_offset = value;
442 else if (!strncmp (key, "blackshear", len))
443 printer.r2l_bw_offset = value;
444 else if (!strncmp (key, "colorshear", len))
445 printer.r2l_col_offset = value;
446 else if (!strncmp (key, "dump", len))
447 dump_config ();
448 else if (!strncmp (key, "topmargin", len))
449 printer.top_margin = value;
450 else if (!strncmp (key, "leftmargin", len))
451 printer.left_margin = value;
452 else if (!strncmp (key, "rightmargin", len))
453 printer.right_margin = value;
454 else if (!strncmp (key, "bottommargin", len))
455 printer.bottom_margin = value;
456 else if (!strncmp (key, "GammaR", len))
457 Gamma_R = atof(buf);
458 else if (!strncmp (key, "GammaG", len))
459 Gamma_G = atof(buf);
460 else if (!strncmp (key, "GammaB", len))
461 Gamma_B = atof(buf);
462 else if (!strncmp (key, "RedGammaIdx", len))
463 Gamma_R = GammaValue(value);
464 else if (!strncmp (key, "GreenGammaIdx", len))
465 Gamma_G = GammaValue(value);
466 else if (!strncmp (key, "BlueGammaIdx", len))
467 Gamma_B = GammaValue(value);
468 else if (!strncmp (key, "ColOffsX", len))
469 adjust_coloffsx = value;
470 else if (!strncmp (key, "ColOffsY", len))
471 adjust_coloffsy = value;
472 else if (!strncmp (key, "blackness", len))
473 gBlackness = value;
474 else if (!strncmp (key, "unimode", len))
475 {
476 if ( value )
477 gUnimode = true ;
478 else
479 gUnimode = false ;
480 }
481 else if (!strncmp (key, "black_ink", len))
482 {
483 if ( value )
484 gBlack = true ;
485 else
486 gBlack = false ;
487 }
488 else if (!strncmp (key, "cyan_ink", len))
489 {
490 if ( value )
491 gCyan = true ;
492 else
493 gCyan = false ;
494 }
495 else if (!strncmp (key, "magenta_ink", len))
496 {
497 if ( value )
498 gMagenta = true ;
499 else
500 gMagenta = false ;
501 }
502 else if (!strncmp (key, "yellow_ink", len))
503 {
504 if ( value )
505 gYellow = true ;
506 else
507 gYellow = false ;
508 }
509 else if (!strncmp (key, "color_ink", len))
510 {
511 if ( value )
512 {
513 gCyan = true ;
514 gMagenta = true ;
515 gYellow = true ;
516 }
517 else
518 {
519 gCyan = false ;
520 gMagenta = false ;
521 gYellow = false ;
522 }
523 }
524 else if (!strncmp (key, "silent", len))
525 {
526 if (system_config_file)
527 {
528 gSilent = true;
529 wrap_closelog();
530 }
531 }
532 else if (!strncmp (key, "verbose", len))
533 {
534 gVerbose = true;
535 if (!(gSilent))
536 {
537 wrap_closelog ();
538 wrap_openlog ("pnm2ppa", 1);
539 }
540 snprintf(syslog_message,message_size, "pnm2ppa: %s",
541 gMessages[LOG_VERBOSE]);
542 wrap_syslog(LOG_INFO,"%s",syslog_message);
543
544 }
545 else if (!strncmp (key, "papersize", len))
546 {
547 if (!strncmp (buf, "us", 2) || !strncmp (buf, "letter", 6))
548 {
549 gWidth = LETTERWIDTH;
550 gHeight = LETTERHEIGHT;
551 }
552 else if (!strncmp (buf, "legal", 5))
553 {
554 gWidth = LEGALWIDTH;
555 gHeight = LEGALHEIGHT;
556 }
557 else if (!strncmp (buf, "a4", 2))
558 {
559 gWidth = A4WIDTH;
560 gHeight = A4HEIGHT;
561 }
562 else
563 {
564 snprintf(syslog_message,message_size,"read_config_file(): %s",
565 gMessages[E_BAD_PAPER] );
566 wrap_syslog (LOG_CRIT,"%s",syslog_message);
567
568 exit (1);
569 }
570 }
571 else
572 {
573 snprintf(syslog_message,message_size,"read_config_file(): %s (%s %d)\n",
574 gMessages[E_BADPARM] , gMessages[LINE],lineno );
575 wrap_syslog (LOG_CRIT,"%s",syslog_message);
576
577 show_usage ("pnm2ppa");
578 exit (1);
579 }
580 case EOF:
581 case 0:
582 break;
583 default:
584 snprintf(syslog_message,message_size, "read_config_file(): %s %s %d\n",
585 gMessages[E_PARSE_CONFIG], gMessages[LINE], lineno);
586 wrap_syslog (LOG_CRIT,"%s",syslog_message);
587
588 exit (1);
589 }
590 lineno++;
591 }
592
593 if (feof (cfgfile))
594 {
595 fclose (cfgfile);
596 return;
597 }
598 snprintf(syslog_message,message_size,"read_config_file(): %s\n",
599 gMessages[E_PARSE_CONFIG]);
600 wrap_syslog (LOG_CRIT,"%s",syslog_message);
601
602 exit (1);
603 }
604
605 int
606 main (int argc, char *argv[])
607 {
608 int i, opt_index;
609 FILE *in = NULL, *out = NULL, *gf = NULL;
610 struct stat tmpstat;
611 char c;
612 BOOLEAN get_Gamma = true;
613
614 char *gammaFile=NULL;
615 char *pnm_inputFile=NULL;
616 char *ppa_outputFile=NULL;
617 BOOLEAN use_stdin = false;
618 BOOLEAN use_stdout = false;
619 BOOLEAN got_Input = false;
620 BOOLEAN got_Output = false;
621 BOOLEAN got_Gamma = false;
622 gSilent = false;
623 gVerbose = false;
624
625 system_config_file = true;
626
627 #ifdef __BEOS__
628 gSilent = true;
629 #endif
630
631 gammaFile = defaultgammafile;
632
633 /* activate syslog */
634 if (!(gSilent))
635 {
636 #ifdef DEBUG
637 wrap_openlog( "pnm2ppa", 1);
638 #else
639 wrap_openlog( "pnm2ppa", 0);
640 #endif
641 }
642
643 if (argc < 2)
644 {
645 show_usage (*argv);
646 exit (0);
647 }
648
649 /* setup the printer object */
650
651 printer.version = HP7X0;
652 set_printer_specific_defaults ();
653
654 /* initialize global variables with default values */
655
656 gEcoMode = false;
657 gWidth = LETTERWIDTH;
658 gHeight = LETTERHEIGHT;
659 gBlackness = 2;
660 gPixmapMode = false;
661 gGammaMode = false;
662 gColorMode = true;
663 gFastMode = false;
664 gUnimode = false;
665 gBlack = true;
666 gCyan = true;
667 gMagenta = true;
668 gYellow = true;
669 Gamma_R = 1.0;
670 Gamma_G = 1.0;
671 Gamma_B = 1.0;
672
673 adjust_coloffsx = 0;
674 adjust_coloffsy = 0;
675
676
677 if (!stat (defaultcfgfile, &tmpstat))
678 read_config_file (defaultcfgfile);
679
680 system_config_file = false;
681
682 // read through the optional arguments before tring to find filenames
683
684 while ((c = getopt_long (argc, argv, "F:B:b:df:ghi:l:o:pr:s:t:v:x:y:",
685 long_opts, &opt_index)) != EOF)
686 {
687 switch (c)
688 {
689 case 0:
690 // long options
691 switch (opt_index)
692 {
693 case 0:
694 // --bw Black & White
695 gColorMode = false;
696 // gEcoMode = false; //this is not needed here (?) duncan
697 gMaxPass = 1;
698 break;
699
700 case 1:
701 // --fd Fast Dither
702 gFastMode = true;
703 gMaxPass = 1;
704 break;
705
706 case 2:
707 // --version
708 snprintf(syslog_message,message_size, "%s %s %s %s %s\n",
709 *argv, gMessages[LOG_VERSION],
710 VERSION, __DATE__, __TIME__);
711 wrap_syslog (LOG_INFO,"%s",syslog_message);
712 exit (0);
713 break;
714
715 case 3:
716 // --help
717 show_usage (*argv);
718 return 0;
719 break;
720
721 case 4:
722 // --verbose
723 gVerbose = true;
724 if (!(gSilent))
725 {
726 wrap_closelog ();
727 wrap_openlog ("pnm2ppa", 1);
728 }
729 break;
730
731 case 5:
732 // --eco
733 gEcoMode = true;
734 break;
735
736 case 6:
737 // --noGamma
738 get_Gamma = false;
739 break;
740
741 case 7:
742 // --uni
743 gUnimode = true;
744 break;
745
746 case 8:
747 // --bi
748 gUnimode=false;
749 break;
750
751 default:
752 snprintf(syslog_message,message_size,"main (): %s",
753 gMessages[E_UNKNOWN_ARG]);
754 wrap_syslog (LOG_CRIT,"%s",syslog_message);
755
756 DPRINTF(" unknown longopt switch case should not happen");
757 return 1;
758 break;
759 }
760 break;
761
762 case 'b':
763 printer.bottom_margin = atoi (optarg);
764 break;
765
766 case 'B':
767 gBlackness = atoi(optarg);
768 break;
769
770 case 'd':
771 dump_config ();
772 break;
773
774 case 'f':
775 {
776 char *configFile;
777 configFile = readPath (optarg);
778 if (configFile)
779 read_config_file (configFile);
780 }
781 break;
782
783 case 'F':
784 {
785 char *path;
786 path = readPath (optarg);
787 if (path)
788 gammaFile = path;
789 }
790 break;
791
792 case 'g':
793 gGammaMode = true;
794 break;
795
796 case 'h':
797 show_usage (*argv);
798 return 0;
799 break;
800
801 case 'i':
802 if (strncmp (optarg, "-", MAXPATHLEN) == 0)
803 {
804 use_stdin = true;
805 got_Input = true;
806 }
807 else
808 {
809 char *path;
810 path = readPath (optarg);
811 if (path)
812 {
813 pnm_inputFile = path;
814 use_stdin = false;
815 got_Input = true;
816 }
817 }
818 break;
819
820 case 'l':
821 printer.left_margin = atoi (optarg);
822 break;
823
824 case 'o':
825 if (strncmp (optarg, "-", MAXPATHLEN) == 0)
826 {
827 use_stdout = true;
828 got_Output = true;
829 }
830 else
831 {
832 char *path;
833 path = readPath(optarg);
834 if (path)
835 {
836 ppa_outputFile = path;
837 use_stdout = false ;
838 got_Output = true;
839 }
840 }
841 break;
842
843 case 'p':
844 gPixmapMode = true;
845 break;
846
847 case 'r':
848 printer.right_margin = atoi (optarg);
849 break;
850
851 case 's':
852 /* paper size stuffer (only used in -g mode ) */
853 if (!strncmp (optarg, "us", 2) || !strncmp (optarg, "letter", 6))
854 {
855 gWidth = LETTERWIDTH;
856 gHeight = LETTERHEIGHT;
857 }
858 else if (!strncmp (optarg, "legal", 5))
859 {
860 gWidth = LEGALWIDTH;
861 gHeight = LEGALHEIGHT;
862 }
863 else if (!strncmp (optarg, "a4", 2))
864 {
865 gWidth = A4WIDTH;
866 gHeight = A4HEIGHT;
867 }
868 else
869 {
870 snprintf(syslog_message,message_size,"main(): %s ",
871 gMessages[E_BAD_PAPER] );
872 wrap_syslog (LOG_CRIT,"%s",syslog_message);
873
874 return 1;
875 }
876
877 break;
878
879 case 't':
880 printer.top_margin = atoi (optarg);
881 break;
882
883 case 'v':
884 parm_version (optarg);
885 break;
886
887 case 'x':
888 printer.x_offset = atoi (optarg);
889 break;
890
891 case 'y':
892 printer.y_offset = atoi (optarg);
893 break;
894
895 default:
896 snprintf(syslog_message,message_size,"main(): %s",
897 gMessages[E_UNKNOWN_ARG]);
898 wrap_syslog (LOG_CRIT,"%s",syslog_message);
899
900 return 1;
901 break;
902 }
903 }
904
905 /* open input stream, if already specified */
906 if (got_Input)
907 {
908 if (use_stdin)
909 in = stdin;
910 else
911 {
912 if ((in = fopen (pnm_inputFile, "rb")) == NULL)
913 {
914 snprintf(syslog_message,message_size,"main(): %s",
915 gMessages[E_BAD_INPUT]);
916 wrap_syslog (LOG_CRIT,"%s",syslog_message);
917
918 return 1;
919 }
920 }
921 }
922
923 /* open output stream, if already specified */
924 if (got_Output)
925 {
926 if (use_stdout)
927 out = stdout;
928 else
929 {
930 if ((out = fopen (ppa_outputFile, "wb")) == NULL)
931 {
932 snprintf(syslog_message,message_size,"main(): %s",
933 gMessages[E_BAD_OUTPUT] );
934 wrap_syslog (LOG_CRIT,"%s",syslog_message);
935
936 return 1;
937 }
938 }
939 }
940
941
942
943
944 /* move on to the list argument*/
945
946 argc -= optind;
947 argv += optind;
948
949 /* if the user hasn't yet specified -i or -o, we see if there are
950 any remaining arguments. Only allows both arguments to work here.
951 This is a legacy option style used by pbm2ppa
952 */
953
954 if (argc == 2 && !in && !out)
955 {
956 if (strncmp (argv[1], "-", MAXPATHLEN) == 0)
957 {
958 in = stdin;
959 }
960 else
961 {
962 if ((in = fopen (argv[0], "rb")) == NULL)
963 {
964 snprintf(syslog_message,message_size,"main(): %s",
965 gMessages[E_BAD_INPUT]);
966 wrap_syslog (LOG_CRIT,"%s",syslog_message);
967
968 return 1;
969 }
970 }
971 if (strncmp (argv[1], "-", MAXPATHLEN) == 0)
972 {
973 out = stdout;
974 }
975 else
976 {
977 if ((out = fopen (argv[1], "wb")) == NULL)
978 {
979 snprintf(syslog_message,message_size,"main(): %s",
980 gMessages[E_BAD_OUTPUT]);
981 wrap_syslog (LOG_CRIT,"%s",syslog_message);
982
983 return 1;
984 }
985 }
986 }
987
988
989 // if the user doesn't specify an input or output file, we make like a pipe
990
991 if (in == NULL)
992 in = stdin;
993 if (out == NULL)
994 out = stdout;
995
996 printer.fptr = out;
997
998
999 /* set minimum and maximum paper sizes for the printer
1000 (the DeskJet 1000C has different limits from other models )
1001 */
1002
1003 gminWidth = printer.min_pagewidth ;
1004 gmaxWidth = printer.max_pagewidth ;
1005 gminHeight = printer.min_pageheight ;
1006 gmaxHeight = printer.max_pageheight ;
1007
1008
1009 /* set gMaxPass
1010 (number of sweeps for Floyd-Steenberg dithered color printing)
1011 */
1012
1013 gMaxPass = 1;
1014 if ( gColorMode && !(gEcoMode) )
1015 gMaxPass = 4;
1016
1017
1018 /* adjust color/bw offsets (alignment corrections) */
1019 printer.ColBwOffsY += adjust_coloffsy;
1020 printer.ColBwOffsX += adjust_coloffsx;
1021
1022
1023 /* initialize color correction curve
1024 (used in Floyd-Steenberg dithered color)
1025 */
1026
1027
1028 /* initialize for no color correction */
1029
1030 for (i = 0; i < 256; i++)
1031 {
1032 gEnh_curve_r[i] = i;
1033 gEnh_curve_g[i] = i;
1034 gEnh_curve_b[i] = i;
1035 }
1036
1037
1038 /* if color correction is used */
1039
1040 if (get_Gamma)
1041 {
1042 gf = fopen (gammaFile, "rb");
1043 if (gf == NULL)
1044 {
1045 DPRINTF ("Can't open gamma correction curve file %s!\n",
1046 gammaFile);
1047 }
1048 else
1049 {
1050 int num_read=0;
1051 got_Gamma = true ;
1052 /* read the gamma correction curve from gammaFile */
1053 DPRINTF("main(): reading color correction curve from %s\n",gammaFile);
1054
1055 num_read = fread (gEnh_curve_r, sizeof (int), 256, gf) ;
1056 DPRINTF(" num_read= %d\n",num_read);
1057 if ( num_read != 256 )
1058 got_Gamma = false ;
1059
1060 if (got_Gamma)
1061 {
1062 num_read = fread (gEnh_curve_g, sizeof (int), 256, gf);
1063 DPRINTF(" num_read= %d\n",num_read);
1064 if ( num_read != 256 )
1065 got_Gamma = false ;
1066 }
1067 if (got_Gamma)
1068 {
1069 num_read = fread (gEnh_curve_b, sizeof (int), 256, gf) ;
1070 DPRINTF(" num_read= %d\n",num_read);
1071 if ( num_read != 256 )
1072 got_Gamma = false ;
1073 }
1074 fclose (gf);
1075 if (!(got_Gamma))
1076 {
1077 DPRINTF ("main(): Gamma curve data from %s is truncated.\n",
1078 gammaFile );
1079 snprintf(syslog_message,message_size,"main(): %s",
1080 gMessages[E_BAD_GAMMAFILE]);
1081 wrap_syslog (LOG_CRIT,"%s",syslog_message);
1082
1083 return 1;
1084 }
1085 }
1086
1087 if ( !(got_Gamma) )
1088 {
1089 /* use the empirical color correction curve parametrized by
1090 Gamma_R ,Gamma_G, Gamma_B */
1091 DPRINTF("main(): using empirical color correction curve\n");
1092
1093 Make_GammaCurve ( Gamma_R, Gamma_G, Gamma_B);
1094
1095 }
1096
1097 }
1098
1099 /* now do the work! */
1100
1101 return print_pnm (in);
1102 }
1103
1104
0 # Sample configuration file
1 #
2 # This file will be automatically read upon startup if it is placed in
3 # /etc/pnm2ppa.conf
4 #
5 # uncomment entries by removing "#" to activate them.
6 #
7 #-----------set the printer model---------------------------
8 # YOU MUST CHOOSE ONE OF THE FOLLOWING, EVEN IF YOU DO NOTHING ELSE!
9 #
10 # If there is more than one "version" entry activated, the last one
11 # will be used. The printer version can also be set with the command line
12 # option e.g., "-v 720".
13
14 version ERROR # PNM2PPA WIIL *NOT* WORK UNTIUL THIS ENTRY IS REMOVED!!!!
15 #version 720 # 710, 712, 722 also acceptable
16 #version 820
17 #version 1000
18
19
20 #--------control system log messages from pnm2ppa-------------------
21 # pnm2ppa issues progress and error messages to the system log (syslog).
22 # For security reasons, no input from the user is ever sent to the syslog.
23 # The setting "silent 1" suppresses messages to the syslog. The
24 # setting "verbose 1" sends messages to the standard error stream (stderr)
25 # in addition to the syslog. (Note: on BeOS, syslog messages are
26 # diverted to stderr; use "silent 1" to suppress them.)
27 # Note: the "silent 1" keyword is only accepted from the system
28 # configuration file (/etc/pnm2ppa.conf), and not from configuration files
29 # specified with the pnm2ppa option "-f".
30
31 #silent 1
32 #verbose 1
33
34 #---------set the margins of the printed page-------------------
35 # Margins: these are distances from the edges of the paper in
36 # "dots" ( 600 dots = 1 inch = 2.54 cm).
37 # Nothing outside these margins will be printed.
38 # Default values are give below; uncomment and change, if necessary.
39 # (Older versions of pnm2ppa required larger left and right margins to avoid
40 # printer failure with "flashing lights", but this problem is believed to
41 # be solved)
42
43 #topmargin 10
44 #bottommargin 150
45 #leftmargin 10
46 #rightmargin 10
47
48 #----------center the printer output on the paper-------------------
49 # Offsets: these are adjustments for centering the print correctly on the
50 # paper. Units are dots (1/600 inch). Add a positive number of dots to
51 # xoff to move the printed image to the right, relative to the paper.
52 # add to yoff to move it down. The helper program calibrate_ppa prints
53 # a test page to check the offsets (see CALIBRATON.txt):
54 # usage: "calibrate_ppa --center | pnm2ppa --bw - - | lpr -l
55 # Default values are:
56
57 #xoffset 160
58 #yoffset 50
59
60 #------------align the black and color ink cartridges--------
61 # Color Offsets: these control alignment between the black ink
62 # and color ink print cartridges. This changes a little whenever you
63 # replace an ink cartridge, so the default values are just approximate.
64 #
65 # Use "calibrate_ppa --align | pnm2ppa --fd - - | lpr -l "
66 # to print a test page to help you adjust the color offsets.
67 #
68 # The first line checks horizontal alignment ColOffsX,:
69 # The second line checks vertical alignment ColOffsY,:
70 # The alignment is correct if alignment patterns "0" is best.
71 # If a diffent alignment pattern is best, add or subtract the + or
72 # - value shown below it to ColOffsX or ColOffSy.
73 #
74 # See CALIBRATION.txt for more details.
75 # Use "calibrate_ppa --test | pnm2ppa --fd - - | lpr -l " to check your
76 # new settings.
77
78 #ColOffsX 0
79 #ColOffsY 0
80
81 #---------------"shearing" corrections-------------------------------------
82 # shearing correction (for bidirectional printing modes)
83 # if there is a horizontal offset between right-to-left and left-to-right
84 # sweeps of the print head, adjust these in units of 1"/600 (1 dot).
85 # There are separate corrections colorshear and blackshear for the
86 # color and black print heads. The third and fourth lines of the
87 # alignment test page (see above) tests these.
88 # The setting is correct when alignments "0" are correct.
89 # Add or subtract the + or - number shown under the best-aligned shearing
90 # alignment pattern.
91
92 #colorshear 0
93 #blackshear 0
94
95 #-------------blackness control-----------------------------
96 # this controls the density of black ink used.
97 # valid blackness choices are 1 2 3 4; controls the
98 # density of black ink used: 1 (least ink), 2 (default), 4 (most).
99 # 0 = no black ink. This affects black ink bordered by whitespace
100 # only (e.g. text, but not black in color images)
101
102 #blackness 2
103
104 #------------Color correct curve Gamma parameters-------------------------
105 # Gamma color correction values for Red, Green and Blue:
106 # (Note: a more effective method of color correction is to use
107 # a calibration file /etc/pnm2ppa.gamma, in which case these
108 # Gamma values will not be used. See COLOR.html or COLOR.txt)
109 # The pnm2ppa option --noGamma suppresses color correction.
110
111 # The standard Gamma enhancement curve is
112 # gEnh(i) = (int) ( pow ( (double) i / 256, Gamma ) * 256 )
113 # (i.e., 256 times ( i*(1.0/256)) to the power Gamma ),
114 # where (int) i is the ppm color intensity, in the range 0 - 255.
115 # positive values of Gamma enhance (increase the intensity of)
116 # the corresponding color. Gamma = 1.0 corresponds to no
117 # color correction, gEnh[i] = i.
118
119 # You can specify Gamma values as a decimal number for each primary color
120
121 #GammaR 1.0 # red enhancement
122 #GammaG 1.0 # green enhancement
123 #GammaB 1.0 # blue enhancement
124
125 # For use with the printed output of "pnm2ppa -g ",
126 # you can also specify Gamma values using the integer GammaIdx,
127 # which gives Gamma = 1.0 - 0.033 * GammaIdx :
128
129 #RedGammaIdx 0
130 #GreenGammaIdx 0
131 #BlueGammaIdx 0
132
133 # Default papersize (only used for printing the color calibration
134 # test page with pnm2ppa -g).
135 # Valid choices are: a4, letter, legal:
136
137 #papersize letter # this is the default
138 #papersize legal
139 #papersize a4
140
141 #-----------suppress bidirectional printing---------------------
142
143 # by default the printing sweeps are now bidirectional (unimode 0);
144 # to make unidirectional printing (left-to-right) the default behavior,
145 # (unimode 1) uncomment the next line . (The command line options --uni
146 # and --bi override the default behavior). You might wish to print
147 # unidirectionally to avoid shearing effects in high-quality
148 # color images, for example)
149
150 #unimode 1
151
152 #=====================================================================
153 # the following are switches for debugging purposes only:
154 # set their values to 0 to switch off the corresponding ink type:
155
156 #black_ink 1
157 #color_ink 1
158 #cyan_ink 1
159 #magenta_ink 1
160 #yellow_ink 1
0 /***************************************************************************
1 pnm2ppa.h - main program header file
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _PNM2PPA_H_
18 #define _PNM2PPA_H_
19
20 #ifdef __PNM2PPA_C__
21
22 static char *defaultcfgfile = "/etc/pnm2ppa.conf";
23 static char *defaultgammafile = "/etc/pnm2ppa.gamma";
24
25 static ppaPrinter_t printer;
26
27 static struct option long_opts[] = {
28 {"bw", 0, 0, 0},
29 {"fd", 0, 0, 0},
30 {"version", 0, 0, 0},
31 {"help", 0, 0, 'h'},
32 {"verbose", 0, 0, 0},
33 {"eco", 0, 0, 0},
34 {"noGamma", 0, 0, 0},
35 {"uni", 0, 0, 0 },
36 {"bi", 0, 0, 0 },
37 {0, 0, 0, 0}
38 };
39
40 #endif
41
42 int ppa_print_page (ppaPrinter_t *printer, image_t *image);
43 int print_pnm (FILE *fptr);
44 void set_printer_specific_defaults (void);
45 void show_usage (char *prog);
46 void parm_version (char *arg);
47 void parm_iversion (int arg);
48 void dump_config (void);
49 void read_config_file (char *fname);
50 char * readPath( char * );
51 int main (int argc, char *argv[]);
52
53 #endif
54
55
0 /***************************************************************************
1 pnmtools.c - routines for creating pnm images.
2 -------------------
3 begin : Sat Oct 14 2000
4 copyright : (C) 2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #include <math.h>
18 #include "pnmtools.h"
19
20
21
22 /* setpixel(x,y,color) writes a pixel with bytecode color at (x,y)*/
23 void
24 setpixel(int x,int y, unsigned char color )
25 {
26 int charidx;
27 if( y < BitMap_topline || y >= BitMap_bottomline ) return;
28 if( x < 0 || x >= BitMap_Width ) return;
29 charidx = (y-BitMap_topline)*BitMap_Width+x;
30 color_bitmap[charidx] = color ;
31 }
32
33
34
35 /*setplus(x,y,s) writes a black "+" of size s centered at (x,y) */
36 void
37 setplus(int x,int y,int s)
38 {
39 int i;
40
41 for(i=0; i<s; i++)
42 {
43 setpixel(x+i,y,1);
44 setpixel(x-i,y,1);
45 setpixel(x,y+i,1);
46 setpixel(x,y-i,1);
47 }
48 }
49
50 /*setx(x,y,s) writes a black "X" of size s centered (x,y) */
51 void
52 setx(int x,int y,int s)
53 {
54 int i;
55
56 for(i=0; i<s; i++)
57 {
58 setpixel(x+i,y+i,1);
59 setpixel(x-i,y+i,1);
60 setpixel(x+i,y-i,1);
61 setpixel(x-i,y-i,1);
62 }
63 }
64
65 /*setblock(x,y,s) writes a solid black square block of size s
66 centered at (x,y) */
67 void
68 setblock(int x,int y,int s)
69 {
70 int i,j;
71
72 for(i=0; i<s; i++)
73 for(j=0; j<s; j++)
74 setpixel(x+i,y+j,1);
75 }
76
77 /*
78 setchar(x,y,c,s) writes a black character c at (x,y), using blocks
79 of size s. The supported characters c belong to a 38-character alphabet
80 (0-9, A-Z, -, +)
81 */
82 void
83 setchar(int x,int y,char c,int s)
84 {
85 int xo,yo;
86 static char charmap[38][5]= { { 0x3e, 0x41, 0x41, 0x41, 0x3e }, /* 0 */
87 { 0x00, 0x42, 0x7f, 0x40, 0x00 }, /* 1 */
88 { 0x42, 0x61, 0x51, 0x49, 0x46 }, /* 2 */
89 { 0x22, 0x41, 0x49, 0x49, 0x36 }, /* 3 */
90 { 0x18, 0x14, 0x12, 0x7f, 0x10 }, /* 4 */
91 { 0x27, 0x45, 0x45, 0x45, 0x39 }, /* 5 */
92 { 0x3e, 0x49, 0x49, 0x49, 0x32 }, /* 6 */
93 { 0x01, 0x01, 0x61, 0x19, 0x07 }, /* 7 */
94 { 0x36, 0x49, 0x49, 0x49, 0x36 }, /* 8 */
95 { 0x26, 0x49, 0x49, 0x49, 0x3e }, /* 9 */
96 { 0x7c, 0x12, 0x11, 0x12, 0x7c }, /* A */
97 { 0x7f, 0x49, 0x49, 0x49, 0x36 }, /* B */
98 { 0x3e, 0x41, 0x41, 0x41, 0x22 }, /* C */
99 { 0x7f, 0x41, 0x41, 0x41, 0x3e }, /* D */
100 { 0x7f, 0x49, 0x49, 0x49, 0x41 }, /* E */
101 { 0x7f, 0x09, 0x09, 0x09, 0x01 }, /* F */
102 { 0x3e, 0x41, 0x41, 0x51, 0x32 }, /* G */
103 { 0x7f, 0x08, 0x08, 0x08, 0x7f }, /* H */
104 { 0x00, 0x41, 0x7f, 0x41, 0x00 }, /* I */
105 { 0x61, 0x41, 0x41, 0x7f, 0x01 }, /* J */
106 { 0x7f, 0x08, 0x14, 0x22, 0x41 }, /* K */
107 { 0x7f, 0x40, 0x40, 0x40, 0x40 }, /* L */
108 { 0x7f, 0x02, 0x04, 0x02, 0x7f }, /* M */
109 { 0x7f, 0x06, 0x08, 0x30, 0x7f }, /* N */
110 { 0x3e, 0x41, 0x41, 0x41, 0x3e }, /* O */
111 { 0x7f, 0x09, 0x09, 0x09, 0x0f }, /* P */
112 { 0x3e, 0x41, 0x51, 0x61, 0x7e }, /* Q */
113 { 0x7f, 0x09, 0x19, 0x29, 0x4f }, /* R */
114 { 0x22, 0x45, 0x49, 0x51, 0x22 }, /* S */
115 { 0x01, 0x01, 0x7f, 0x01, 0x01 }, /* T */
116 { 0x3f, 0x40, 0x40, 0x40, 0x3f }, /* U */
117 { 0x07, 0x18, 0x60, 0x18, 0x07 }, /* V */
118 { 0x3f, 0x40, 0x20, 0x40, 0x3f }, /* W */
119 { 0x63, 0x14, 0x08, 0x14, 0x63 }, /* X */
120 { 0x03, 0x04, 0x78, 0x04, 0x03 }, /* Y */
121 { 0x61, 0x51, 0x49, 0x45, 0x43 }, /* Z */
122 { 0x00, 0x08, 0x08, 0x08, 0x00 }, /* - */
123 { 0x08, 0x08, 0x3e, 0x08, 0x08 } }; /* + */
124
125
126 if(c<='9' && c>='0' )
127 for(xo=0; xo<5; xo++)
128 for(yo=0; yo<8; yo++)
129 if((charmap[c-'0'][xo]>>yo)&1)
130 setblock(x+xo*s,y+yo*s,s);
131 if(c<='Z' && c>='A')
132 for(xo=0; xo<5; xo++)
133 for(yo=0; yo<8; yo++)
134 if((charmap[c-'A'+10][xo]>>yo)&1)
135 setblock(x+xo*s,y+yo*s,s);
136 if(c=='-')
137 for(xo=0; xo<5; xo++)
138 for(yo=0; yo<8; yo++)
139 if((charmap[36][xo]>>yo)&1)
140 setblock(x+xo*s,y+yo*s,s);
141 if(c=='+')
142 for(xo=0; xo<5; xo++)
143 for(yo=0; yo<8; yo++)
144 if((charmap[37][xo]>>yo)&1)
145 setblock(x+xo*s,y+yo*s,s);
146 }
147
148
149 /* setstring(x,y,*p,s) writes the string *p starting
150 at (x,y), in characters of size s. The letters of the string
151 must belong to the alphabet (0-9,A-Z,+,-) supported by setchar() */
152 void
153 setstring(int x,int y,char* s,int size)
154 {
155 char* p;
156 int xo;
157
158 for(xo=0, p=s; *p; xo+=((6*size)+1), p++)
159 setchar(x+xo,y,*p,size);
160 }
161
162 /* like setstring, but writes vertically downwards*/
163 void
164 setstringv(int x,int y,char* s,int size)
165 {
166 char* p;
167 int yo;
168
169 for(yo=0, p=s; *p; yo+=((7*size)+1), p++)
170 setchar(x,y+yo,*p,size);
171 }
172
173 /* setCG(x,y) writes a "centering symbol" at (x,y) */
174 void
175 setCG(int x,int y)
176 {
177 int xo,yo,zo;
178
179 for(xo=0; xo<=50; xo++)
180 {
181 yo=sqrt(50.0*50.0-xo*xo);
182 setpixel(x+xo,y+yo,1);
183 setpixel(x+yo,y+xo,1);
184 setpixel(x-1-xo,y-1-yo,1);
185 setpixel(x-1-yo,y-1-xo,1);
186 setpixel(x+xo,y-1-yo,1);
187 setpixel(x-1-xo,y+yo,1);
188 for(zo=0; zo<yo; zo++)
189 {
190 setpixel(x+xo,y-1-zo,1);
191 setpixel(x-1-xo,y+zo,1);
192 }
193 }
194 }
195
196 /* setsquare(x,y,s,r,g,b) looks like it is supposed to
197 write a solid colored square of size s, bounded by a black
198 box, "at" (x,y). with "color" (r,g,b). This is
199 definitely broken by the color coding scheme used by
200 setpixel
201 */
202
203 void
204 setsquare(int x, int y, int s, int r, int g, int b)
205 {
206 int i,j;
207 int charidx;
208
209
210 if(x<0 || x>=Width) return;
211 if(y<BitMap_topline || y>=BitMap_bottomline) return;
212
213 for(i=0; i<s; i++)
214 for(j=0; j<s; j++)
215 {
216 charidx=(y-BitMap_topline+j)*BitMap_Width+(x+i)*3;
217 color_bitmap[charidx] = r;
218 color_bitmap[charidx+1] = g;
219 color_bitmap[charidx+2] = b;
220 }
221 for(j=0; j<s; j++)
222 {
223 charidx=(y-BitMap_topline+j)*BitMap_Width+(x)*3;
224 color_bitmap[charidx] = color_bitmap[charidx+1] = color_bitmap[charidx+2] = 0;
225 charidx+=s*3;
226 color_bitmap[charidx] = color_bitmap[charidx+1] = color_bitmap[charidx+2] = 0;
227 }
228 for(i=0; i<s; i++)
229 {
230 charidx=(y-BitMap_topline)*BitMap_Width+(x+i)*3;
231 color_bitmap[charidx] = color_bitmap[charidx+1] = color_bitmap[charidx+2] = 0;
232 charidx+=s*BitMap_Width;
233 color_bitmap[charidx] = color_bitmap[charidx+1] = color_bitmap[charidx+2] = 0;
234 }
235
236 }
237
238
239
240
0 /***************************************************************************
1 pnmtools.h - headers for pnmtools.c .
2 -------------------
3 begin : Sat Oct 14, 2000
4 copyright : (C) 2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _PNMTOOLS_H
18 #define _PNMTOOLS_H
19
20 void setpixel(int, int, unsigned char );
21
22 void setplus(int, int, int );
23
24 void setx(int, int, int );
25
26 void setblock(int, int, int );
27
28 void setchar(int, int, char, int );
29
30 void setstring(int , int , char* , int);
31
32 void setstringv(int ,int ,char* ,int );
33
34 void setCG(int x,int y);
35
36 void setsquare(int , int , int , int , int , int );
37
38
39 extern int Width; /* width and height in 600ths of an inch */
40 extern int Height;
41 //extern int Pwidth; /* width in bytes */
42 extern char *color_bitmap;
43 extern int BitMap_topline; /* top line of bitmap */
44 extern int BitMap_bottomline; /* bottom line of bitmap */
45 extern int BitMap_Height; /* height for malloc */
46 extern int BitMap_Width; /* width for malloc */
47
48 #ifdef __CALIBRATE_PPA_C__
49 int Width; /* width and height in 600ths of an inch */
50 int Height;
51 //int Pwidth; /* width in bytes */
52 //int Pheight; /* height for malloc */
53 char *color_bitmap;
54 int BitMap_topline; /* top line of bitmap */
55 int BitMap_bottomline; /* bottom line of bitmap */
56 int BitMap_Height; /* height for malloc */
57 int BitMap_Width; /* width for malloc */
58
59 #endif
60
61 #endif
62
63
64
65
66
67
68
69
70
71
72
+695
-0
ppa.c less more
0 /***************************************************************************
1 ppa.c - functions to handle PPA, SCP, and VLINK protocols
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <assert.h>
21
22 #define __PPA_C__
23
24 #include "syslog.h"
25 #include "global.h"
26 #include "ppa.h"
27 #include "debug.h"
28 #include "lang.h"
29
30
31 /*
32 VLink packet structure:
33
34 Bytes Description
35 --------------------------------------------
36 1 Packet-start marker (always '$')
37 1 Channel (0: image data, 1: commands/responses(*), 2: autostatus(*), 128: pacing(*))
38 2 Data length (N)
39 N [remaining data (e.g., SCP or SCP2 packet when Channel=1)]
40
41 (*): responses, autostatus, and pacing are communicated from the printer to
42 the computer, and may be safely ignored.
43 */
44 void
45 vlink_put (FILE * fptr, int channel, int length, void *data)
46 {
47 fputc ('$', fptr);
48 fputc (channel, fptr);
49 fputc (length >> 8, fptr);
50 fputc (length & 0xFF, fptr);
51 fwrite (data, length, 1, fptr);
52 }
53
54 /*
55 SCP packet structure:
56
57 Bytes Description
58 --------------------------------------------
59 2 Command specifier
60 2 Command reference number
61 1 Priority
62 1 padding? (always zero)
63 2 Data length (N)
64 N [remaining data]
65
66 ComSpec ComRef Command
67 -------------------------------
68 35 1 Initialize1
69 101 2 Initialize2
70 21 1 Initialize3
71 19 1 Handle Media
72 18 1 Print Sweep
73 */
74 void
75 scp_put (FILE * fptr, int comspec, int comref, int priority,
76 int length, void *data)
77 {
78 /* encapsulate the vlink_put call in here, to avoid a memcpy */
79 fputc ('$', fptr);
80 fputc (1, fptr);
81 fputc ((length + 8) >> 8, fptr);
82 fputc ((length + 8) & 0xFF, fptr);
83
84 fputc (comspec >> 8, fptr);
85 fputc (comspec & 0xFF, fptr);
86 fputc (comref >> 8, fptr);
87 fputc (comref & 0xFF, fptr);
88 fputc (priority, fptr);
89 fputc (0, fptr);
90 fputc (length >> 8, fptr);
91 fputc (length & 0xFF, fptr);
92
93 fwrite (data, length, 1, fptr);
94 }
95
96
97 /*
98 SCP2 packet structure:
99
100 Bytes Description
101 --------------------------------------------
102 2 Command specifier
103 2 Packet length (N)
104 1 Priority
105 1 padding? (always zero)
106 2 Command reference number
107 4 Channel 0 buffer increment
108 4 version number? (always 00 02 00 00)
109 N-16 [remaining data]
110
111 ComSpec ComRef Command
112 -------------------------------
113 0x186 1 Initialize1
114 0x18f 2 Initialize2
115 0x183 1 Initialize3
116 0x181 1 Handle Media
117 0x180 1 Print Sweep
118 */
119 void
120 scp2_put (FILE * fptr, unsigned short comspec,
121 unsigned short pkt_len_s16,
122 unsigned char priority, unsigned short comref,
123 unsigned data_len, void *data)
124 {
125 /* encapsulate the vlink_put call in here, to avoid a memcpy */
126 fputc ('$', fptr);
127 fputc (1, fptr);
128 fputc ((pkt_len_s16 + 16) >> 8, fptr);
129 fputc ((pkt_len_s16 + 16), fptr);
130
131 fputc (comspec >> 8, fptr);
132 fputc (comspec, fptr);
133 fputc ((pkt_len_s16 + 16) >> 8, fptr);
134 fputc ((pkt_len_s16 + 16), fptr);
135 fputc (priority, fptr);
136 fputc (0, fptr);
137 fputc (comref >> 8, fptr);
138 fputc (comref, fptr);
139 fputc (data_len >> 24, fptr);
140 fputc (data_len >> 16, fptr);
141 fputc (data_len >> 8, fptr);
142 fputc (data_len, fptr);
143 fputc (0, fptr);
144 fputc (2, fptr);
145 fputc (0, fptr);
146 fputc (0, fptr);
147
148 fwrite (data, pkt_len_s16, 1, fptr);
149 }
150
151
152 /*
153 SCP3 packet structure:
154
155 Bytes Description
156 --------------------------------------------
157 2 Command specifier
158 2 Packet length (N)
159 1 Priority
160 1 padding? (always zero)
161 2 Command reference number
162 4 Channel 0 buffer increment
163 4 version number? (always 01 04 00 00)
164 N-16 [remaining data]
165
166 ComSpec ComRef Command
167 -------------------------------
168 0x186 1 Initialize1
169 0x18C 16 Initialize Printer name
170 0x1A1 1 Initialize4?
171 0x18f 2 Initialize2
172 0x183 1 Initialize3
173 0x181 1 Handle Media
174 0x180 1 Print Sweep
175 */
176 void
177 scp3_put (FILE * fptr, unsigned short comspec,
178 unsigned short pkt_len_s16,
179 unsigned char priority, unsigned short comref,
180 unsigned data_len, void *data)
181 {
182 /* encapsulate the vlink_put call in here, to avoid a memcpy */
183 fputc ('$', fptr);
184 fputc (1, fptr);
185 fputc ((pkt_len_s16 + 16) >> 8, fptr);
186 fputc ((pkt_len_s16 + 16), fptr);
187
188 fputc (comspec >> 8, fptr);
189 fputc (comspec, fptr);
190 fputc ((pkt_len_s16 + 16) >> 8, fptr);
191 fputc ((pkt_len_s16 + 16), fptr);
192 fputc (priority, fptr);
193 fputc (0, fptr);
194 fputc (comref >> 8, fptr);
195 fputc (comref, fptr);
196 fputc (data_len >> 24, fptr);
197 fputc (data_len >> 16, fptr);
198 fputc (data_len >> 8, fptr);
199 fputc (data_len, fptr);
200 fputc (1, fptr);
201 fputc (4, fptr);
202 fputc (0, fptr);
203 fputc (0, fptr);
204
205 fwrite (data, pkt_len_s16, 1, fptr);
206 }
207
208
209 void
210 ppa_init_job (ppaPrinter_t * printer)
211 {
212 unsigned char init1[8] =
213
214 { 0x00, 0x00, 0x01, 0xf4, 0x01, 0x00, 0x00, 0x00 };
215 unsigned char init2[4] = { 0xde, 0xad, 0xbe, 0xef };
216 unsigned char init3[8] =
217
218 { 0xde, 0xad, 0xbe, 0xef, 0x02, 0x00, 0x00, 0x00 };
219 unsigned char init4[60] = "!!TAZ \x81*HP DeskJet 1000C Prin (Copy 2)*FILE!!\x00\x00\x00"; /* plus 0 terminator */
220 unsigned char init5[4] = { 0x01, 0x01, 0x00, 0x00 };
221
222 switch (printer->version)
223 {
224 case HP820:
225 scp_put (printer->fptr, 35, 1, 7, sizeof (init1), init1);
226 vlink_put (printer->fptr, 0, sizeof (init2), init2);
227 scp_put (printer->fptr, 101, 2, 7, sizeof (init3), init3);
228 break;
229 case HP7X0:
230 scp2_put (printer->fptr, 0x0186, sizeof (init1), 7, 1, 0, init1);
231 vlink_put (printer->fptr, 0, sizeof (init2), init2);
232 scp2_put (printer->fptr, 0x018f, sizeof (init3), 7, 2, 4, init3);
233 break;
234 case HP1000:
235 scp3_put (printer->fptr, 0x0186, sizeof (init1), 7, 16, 0, init1);
236 scp3_put (printer->fptr, 0x018C, sizeof (init4), 7, 1, 0, init4);
237 scp3_put (printer->fptr, 0x01A1, sizeof (init5), 7, 1, 0, init5);
238 vlink_put (printer->fptr, 0, sizeof (init2), init2);
239 scp3_put (printer->fptr, 0x018f, sizeof (init3), 7, 2, 4, init3);
240 break;
241 default:
242 snprintf(syslog_message,message_size,"ppa_init_job(): %s",
243 gMessages[E_PPA_UNKNOWN]);
244 wrap_syslog (LOG_CRIT,"%s",syslog_message);
245
246 }
247 }
248
249 void
250 ppa_end_print (ppaPrinter_t * printer)
251 {
252 unsigned char pageA[4] = { 0x05, 0x01, 0x03, 0x84 };
253
254 if (printer->version == HP1000)
255 scp3_put (printer->fptr, 0x0181, sizeof (pageA), 7, 2, 0, pageA);
256 }
257
258 void
259 ppa_init_page (ppaPrinter_t * printer)
260 {
261 unsigned char pageA[16] =
262 { 0x28, 0x2d, 0x00, 0x41, 0x29, 0x2e, 0x00, 0x42,
263 0x29, 0x2e, 0x00, 0x42, 0x29, 0x2e, 0x00, 0x42
264 };
265 unsigned char pageB[16] =
266 { 0x28, 0x2d, 0x00, 0x41, 0x2d, 0x32, 0x00, 0x46,
267 0x2d, 0x32, 0x00, 0x46, 0x2d, 0x32, 0x00, 0x46
268 };
269
270 switch (printer->version)
271 {
272 case HP820:
273 scp_put (printer->fptr, 21, 1, 5, sizeof (pageA), pageA);
274 break;
275 case HP7X0:
276 scp2_put (printer->fptr, 0x0183, sizeof (pageB), 5, 1, 0, pageB);
277 break;
278 case HP1000:
279 scp3_put (printer->fptr, 0x0183, sizeof (pageA), 5, 1, 0, pageA);
280 break;
281 default:
282 snprintf(syslog_message,message_size,"ppa_init_page(): %s",
283 gMessages[E_PPA_UNKNOWN]);
284 wrap_syslog (LOG_CRIT,"%s",syslog_message);
285
286 }
287 }
288
289 void
290 ppa_load_page (ppaPrinter_t * printer)
291 {
292 unsigned char loadA[4] = { 0x01, 0x01, 0x09, 0x60 };
293 unsigned char loadB[4] = { 0x01, 0x01, 0x12, 0xc0 };
294 unsigned char loadC[4] = { 0x01, 0x01, 0x07, 0x08 };
295
296 switch (printer->version)
297 {
298 case HP820:
299 scp_put (printer->fptr, 19, 1, 7, sizeof (loadA), loadA);
300 break;
301 case HP7X0:
302 scp2_put (printer->fptr, 0x0181, sizeof (loadB), 7, 1, 0, loadB);
303 break;
304 case HP1000:
305 scp3_put (printer->fptr, 0x0181, sizeof (loadC), 7, 1, 0, loadC);
306 break;
307 default:
308 snprintf(syslog_message,message_size, "ppa_load_page(): %s",
309 gMessages[E_PPA_UNKNOWN]);
310 wrap_syslog (LOG_CRIT,"%s",syslog_message);
311
312 }
313 }
314
315 void
316 ppa_eject_page (ppaPrinter_t * printer)
317 {
318 unsigned char loadA[4] = { 0x02, 0x01, 0x09, 0x60 };
319 unsigned char loadB[4] = { 0x02, 0x01, 0x12, 0xc0 };
320 unsigned char loadC[4] = { 0x02, 0x01, 0x07, 0x08 };
321
322 switch (printer->version)
323 {
324 case HP820:
325 scp_put (printer->fptr, 19, 1, 7, sizeof (loadA), loadA);
326 break;
327 case HP7X0:
328 scp2_put (printer->fptr, 0x0181, sizeof (loadB), 7, 1, 0, loadB);
329 break;
330 case HP1000:
331 scp3_put (printer->fptr, 0x0181, sizeof (loadC), 7, 1, 0, loadC);
332 break;
333 default:
334 snprintf(syslog_message,message_size, "ppa_eject_page(): %s",
335 gMessages[E_PPA_UNKNOWN]);
336 wrap_syslog (LOG_CRIT,"%s",syslog_message);
337 }
338 }
339
340 int
341 compress (unsigned char *in, int num_lines_d2, int final_len,
342 unsigned char *iout)
343 {
344 unsigned char *out = iout;
345 int I, len = num_lines_d2;
346
347 for (I = 0; I < final_len; I += num_lines_d2, in += num_lines_d2)
348 {
349 int i = 0;
350
351 while (i < len)
352 {
353 /* Find the size of duplicate values */
354 int dup_len = 0;
355
356 while ((i + dup_len < len) && (in[i + dup_len] == in[i]))
357 {
358 dup_len++;
359 }
360 /* See if we have enough zeros to be worth compressing. */
361 /* I figure one is enough. */
362 if ((dup_len >= 1) && (in[i] == 0))
363 {
364 /* Output run of zeros. */
365 while (dup_len >= 128)
366 {
367 /* Max is 128 */
368 *out++ = 0x00;
369 i += 128;
370 dup_len -= 128;
371 }
372 if (dup_len >= 1)
373 {
374 *out++ = dup_len;
375 i += dup_len;
376 }
377 /* See if we have enough non-zeros to be worth compressing. */
378 /* Here two should be enough. */
379 }
380 else if (dup_len >= 2)
381 {
382 /* Output run of duplicates. */
383 while (dup_len >= 64)
384 {
385 /* Max is 64 */
386 *out++ = (char) 0x80;
387 *out++ = (char) in[i];
388 i += 64;
389 dup_len -= 64;
390 }
391 if (dup_len >= 2)
392 {
393 *out++ = dup_len + 0x80;
394 *out++ = in[i];
395 i += dup_len;
396 }
397 }
398 else
399 {
400 /* Look for two zeros, or three duplicates to end literal run. */
401 /* Note this is one more than the number to start a run. */
402 int lit_len = -1;
403 int add_more = 1;
404
405 while (add_more)
406 {
407 lit_len++;
408 if (i + lit_len == len)
409 add_more = 0;
410 /* Always add more if we are near the very end. */
411 if (i + lit_len < len - 3)
412 {
413 char a = in[i + lit_len + 0];
414 char b = in[i + lit_len + 1];
415 char c = in[i + lit_len + 2];
416
417 /* See if there are enough zeros */
418 if ((a == b) && (b == 0))
419 add_more = 0;
420 /* See if there are enough duplicates */
421 if ((a == b) && (b == c))
422 add_more = 0;
423 }
424 }
425 /* Output run of literals. */
426 while (lit_len >= 64)
427 {
428 /* Max is 64 */
429 int j;
430
431 *out++ = (char) 0xc0;
432 for (j = i; j < i + 64; j++)
433 {
434 *out++ = in[j];
435 }
436 i += 64;
437 lit_len -= 64;
438 }
439 if (lit_len)
440 {
441 int j;
442
443 *out++ = lit_len + 0xc0;
444 for (j = i; j < i + lit_len; j++)
445 {
446 *out++ = in[j];
447 }
448 i += lit_len;
449 }
450 }
451 }
452 }
453 return out - iout;
454 }
455
456 static inline void
457 packShort (int x, unsigned char *y)
458 {
459 y[0] = x >> 8;
460 y[1] = x;
461 }
462
463 static inline void
464 packLong (unsigned long x, unsigned char *y)
465 {
466 packShort(x >> 16, y);
467 packShort(x, y + 2);
468 #if 0
469 unsigned short t;
470
471 t = (unsigned short) ((x & 0xffff0000) >> 16);
472 packShort (t, y);
473 packShort ((unsigned short) x & 0xffff, y + 2);
474 #endif
475 }
476
477 //#define do_compress_data (1)
478
479 void
480 ppa_print_sweep (ppaPrinter_t * printer, ppaSweepData_t * data)
481 {
482 unsigned char *pc, *tpc;
483 unsigned i, datasize = data->data_size;
484 unsigned char sweep_packet[144];
485 int sweep_packet_size;
486 unsigned short HP7X0constants[] = { 0x8ca0, 0x4650, 0x12c0 };
487 unsigned short HP820constants[] = { 0x4650, 0x1c20, 0x0960 };
488 unsigned short HP1000constants[] = { 0x4650, 0x2328, 0x0708 };
489 unsigned short *constants;
490 int nozzle_data_size;
491 int MF; /* Multiplicative Factor -- quick hack */
492 int k;
493
494 unsigned char do_compress_data;
495
496 DPRINTF("ppa_print_sweep: Dir: %d Color: %d Size: %d Vpos: %d Hpos: %d,%d\n",
497 data->direction, data->in_color, data->data_size, data->vertical_pos,
498 data->left_margin, data->right_margin );
499 assert( ((data->direction == left_to_right) || (data->direction == right_to_left)) );
500
501 if (gColorMode)
502 do_compress_data = 0;
503 else
504 do_compress_data = 1;
505
506 // DPRINTF("*********k up to %d\n",(data->in_color == 1 ? gMaxPass : 1));
507 for (k = 0; k < (data->in_color == 1 ? gMaxPass : 1); k++)
508 {
509 // DPRINTF("********step %d\n",k);
510 pc = data->image_data[k];
511
512 if (do_compress_data)
513 {
514 if (!(pc = malloc ((datasize / 64 + 1) * 65)))
515 {
516 snprintf(syslog_message,message_size, "ppa_print_sweep(): %s",
517 gMessages[E_PPA_BADMALLOC]);
518 wrap_syslog (LOG_CRIT,"%s",syslog_message);
519 exit (-1);
520 }
521 datasize =
522 compress (data->image_data[k],
523 data->nozzle_data->pins_used_d2, datasize, pc);
524 }
525
526 /* send image data 16k at a time */
527 for (i = 0, tpc = pc; i < datasize; tpc += 16384, i += 16384)
528 {
529 vlink_put (printer->fptr, 0, ((datasize - i) > 16384) ? 16384 : (datasize - i), tpc);
530 }
531
532 /* memory leak fix courtesy of John McKown */
533 if (do_compress_data)
534 free (pc);
535
536 /* construct sweep packet */
537 switch (printer->version)
538 {
539 case HP820:
540 constants = HP820constants;
541 MF = 1;
542 break;
543 case HP7X0:
544 constants = HP7X0constants;
545 MF = 2;
546 break;
547 case HP1000:
548 constants = HP1000constants;
549 MF = 1;
550 break;
551 default:
552 snprintf(syslog_message,message_size, "ppa_print_sweep(): %s",
553 gMessages[E_PPA_UNKNOWN]);
554 wrap_syslog (LOG_CRIT,"%s",syslog_message);
555 return;
556 }
557
558 sweep_packet[0] = 0;
559 sweep_packet[1] = do_compress_data;
560 sweep_packet[2] = data->direction == right_to_left ? 1 : 2;
561 sweep_packet[3] = data->in_color ? 14 : 1;
562
563 packLong (datasize, sweep_packet + 4);
564
565 memset (sweep_packet + 8, 0, 8);
566
567 if (data->in_color)
568 packLong (MF * (data->vertical_pos +
569 /*96+ */ printer->y_offset) /*+ 1*/,
570 sweep_packet + 16);
571 else
572 packLong (MF *
573 (data->vertical_pos +
574 printer->y_offset), sweep_packet + 16);
575 packShort (constants[0], sweep_packet + 20);
576 packShort (MF *
577 (data->left_margin + printer->x_offset) /*+ 1*/,
578 sweep_packet + 22);
579 packShort (MF *
580 (data->right_margin + printer->x_offset) /*+ 1*/,
581 sweep_packet + 24);
582 if (data->in_color)
583 packShort (0x2ee0, sweep_packet + 26);
584 else
585 packShort (constants[1], sweep_packet + 26); /* 2ee0 in color on 820 */
586 packShort (constants[2], sweep_packet + 28);
587 packShort (0x100, sweep_packet + 30);
588
589
590 if ((data->in_color) && (k < gMaxPass - 1))
591 {
592 sweep_packet[32] = data->direction == right_to_left ? 1 : 2;
593 sweep_packet[33] = data->in_color ? 14 : 1;
594 packLong (MF *
595 (data->vertical_pos +
596 printer->y_offset), sweep_packet + 34);
597 packShort (MF *
598 (data->left_margin +
599 printer->x_offset), sweep_packet + 38);
600 packShort (MF *
601 (data->right_margin +
602 printer->x_offset), sweep_packet + 40);
603 packShort (0x2ee0, sweep_packet + 42);
604 packShort (constants[2], sweep_packet + 44);
605 }
606 else
607 {
608 if (data->next)
609 {
610 sweep_packet[32] =
611 data->next->direction == right_to_left ? 1 : 2;
612 sweep_packet[33] = data->next->in_color ? 14 : 1;
613 packLong (MF *
614 (data->next->vertical_pos +
615 printer->y_offset), sweep_packet + 34);
616 packShort (MF *
617 (data->next->left_margin +
618 printer->x_offset), sweep_packet + 38);
619 packShort (MF *
620 (data->next->right_margin +
621 printer->x_offset), sweep_packet + 40);
622 if (data->in_color)
623 packShort (0x2ee0, sweep_packet + 42);
624 else
625 packShort (constants[1], sweep_packet + 42); /* 2ee0 in color on 820 */
626 packShort (constants[2], sweep_packet + 44);
627 }
628 else
629 memset (sweep_packet + 32, 0, 14);
630 sweep_packet[46] = 8;
631 }
632 nozzle_data_size = data->nozzle_data_size;
633 if (nozzle_data_size > 6)
634 {
635 snprintf(syslog_message,message_size, "ppa_print_sweep(): %s %d\n",
636 gMessages[W_PPA_NOZZLE], nozzle_data_size);
637 wrap_syslog (LOG_WARNING,"%s",syslog_message);
638
639 nozzle_data_size = 6;
640 }
641 sweep_packet[47] = nozzle_data_size;
642
643 for (pc = sweep_packet + 48, i = 0;
644 i < nozzle_data_size; i++, pc += 16)
645 {
646 packShort (data->nozzle_data[i].DPI, pc);
647 packShort (data->nozzle_data[i].pins_used_d2, pc + 2);
648 packShort (data->nozzle_data[i].unused_pins_p1, pc + 4);
649 packShort (data->nozzle_data[i].first_pin, pc + 6);
650 packShort (data->nozzle_data[i].pins_used_d2, pc + 8);
651 packShort (MF * (data->nozzle_data[i].left_margin + printer->x_offset),
652 pc + 10);
653 packShort (MF * (data->nozzle_data[i].right_margin + printer->x_offset),
654 pc + 12);
655 pc[14] = data->nozzle_data[i].nozzle_delay;
656 pc[15] = 0;
657 }
658
659 sweep_packet_size = data->in_color ? 144 : 80;
660
661 /* send sweep packet */
662 switch (printer->version)
663 {
664 case HP820:
665 scp_put (printer->fptr, 18, 1, 7, sweep_packet_size, sweep_packet);
666 break;
667 case HP7X0:
668 scp2_put (printer->fptr, 0x0180, sweep_packet_size,
669 7, 1, datasize, sweep_packet);
670 break;
671 case HP1000:
672 scp3_put (printer->fptr, 0x0180, sweep_packet_size,
673 7, 1, datasize, sweep_packet);
674 break;
675 default:
676 snprintf(syslog_message,message_size,"ppa_print_sweep(): %s",
677 gMessages[E_PPA_UNKNOWN]);
678 wrap_syslog (LOG_CRIT,"%s",syslog_message);
679
680 return;
681 }
682 }
683 }
684
685
686 void
687 ppa_print_sweeps (ppaPrinter_t * printer, ppaSweepData_t * data)
688 {
689 ppaSweepData_t *current_sweep;
690
691 for (current_sweep = data; current_sweep;
692 current_sweep = current_sweep->next)
693 ppa_print_sweep (printer, current_sweep);
694 }
0 /***************************************************************************
1 ppa.h - PPA protocol definitions and routines
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by the pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _PPA_H
18 #define _PPA_H
19
20 #include "defaults.h"
21
22 typedef struct
23 {
24 FILE *fptr;
25 printerModel_t version; /* from defaults.h */
26 int ColBwOffsX;
27 int ColBwOffsY;
28 int x_offset;
29 int y_offset;
30 int r2l_bw_offset;
31 int r2l_col_offset;
32 int marg_diff;
33 int top_margin;
34 int left_margin;
35 int right_margin;
36 int bottom_margin;
37 int bufsize;
38 int min_pagewidth;
39 int max_pagewidth;
40 int min_pageheight;
41 int max_pageheight;
42 }
43 ppaPrinter_t;
44
45 typedef struct
46 {
47 unsigned short DPI;
48 unsigned short pins_used_d2;
49 unsigned short unused_pins_p1;
50 unsigned short first_pin;
51 unsigned short left_margin;
52 unsigned short right_margin;
53 unsigned char nozzle_delay;
54 }
55 ppaNozzleData_t;
56
57 typedef struct ppaSweepData_s
58 {
59 unsigned char *image_data[4];
60 unsigned data_size;
61 BOOLEAN in_color;
62 enum
63 { right_to_left, left_to_right }
64 direction;
65 int vertical_pos;
66 unsigned short left_margin;
67 unsigned short right_margin;
68 unsigned char nozzle_data_size;
69 ppaNozzleData_t *nozzle_data;
70 struct ppaSweepData_s *next; /* NULL indicates last print sweep */
71 }
72 ppaSweepData_t;
73
74 void ppa_init_job (ppaPrinter_t *);
75 void ppa_init_page (ppaPrinter_t *);
76 void ppa_load_page (ppaPrinter_t *);
77 void ppa_eject_page (ppaPrinter_t *);
78 void ppa_end_print (ppaPrinter_t *);
79 void ppa_print_sweep (ppaPrinter_t *, ppaSweepData_t *); /* prints one sweep */
80 void ppa_print_sweeps (ppaPrinter_t *, ppaSweepData_t *); /* prints a linked-list of sweeps */
81
82 #endif
83
84
85
86
87
88
89
90
0 #
1 # Makefile for parse_vlink
2 #
3
4 CC=gcc
5
6 CFLAGS=-Wall -pedantic -O2 -g
7
8 default: all
9
10 all: parse_vlink
11
12 clean:
13 rm -f *.o *~ parse_vlink
14
15 parse_vlink: parse_vlink.o
16 $(CC) $(LDFLAGS) $(CFLAGS) -o parse_vlink parse_vlink.o
17
18 parse_vlink.o: parse_vlink.c
19 $(CC) $(CFLAGS) -c parse_vlink.c
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
0 #include <stdio.h>
1
2 void parse_scp (FILE *fptr, int length, unsigned long *pos)
3 {
4 int comspec, comref, priority, blank, dlen, i, numbytes;
5
6 printf (" ** Encapsulated SCP packet found **\n");
7 comspec = (getc (fptr) << 8) | getc (fptr);
8 comref = (getc (fptr) << 8) | getc (fptr);
9 priority = getc (fptr);
10 blank = getc (fptr);
11 dlen = (getc (fptr) << 8) | getc (fptr);
12 *pos += 8;
13
14 printf (" Command specifier: %d (0x%X)\n", comspec, comspec);
15
16 if (dlen != length - 8 || comspec == 0x186)
17 {
18 printf (" ++ Detected HP 720/1000 format\n");
19 printf (" Command reference #: %d\n", dlen);
20 dlen = length - 16;
21
22 numbytes = (getc(fptr)<<24) | (getc(fptr)<<16) | (getc(fptr)<<8) |
23 getc(fptr);
24 getc (fptr);
25 getc (fptr);
26 getc (fptr);
27 getc (fptr);
28
29 *pos += 8;
30
31 printf (" Data consumed: %d\n", numbytes);
32 }
33 else
34 {
35 printf (" Data length: %d\n", dlen);
36 printf (" Command reference #: %d (0x%X)\n", comref, comref);
37 }
38
39 printf (" Priority: %d\n", priority);
40
41 /* print out data packet */
42 printf (" Data: (pos=%08lx)\n ", *pos);
43 for (i = 0; i < dlen; i++)
44 {
45 if (i != 0 && i % 16 == 0)
46 printf ("\n ");
47 else if (i != 0 && i % 8 == 0)
48 printf (" ");
49
50 printf ("%02X ", getc (fptr));
51 }
52 *pos += dlen;
53
54 printf ("\n");
55 }
56
57 int main (int argc, char *argv[])
58 {
59 FILE *fptr;
60 unsigned long pos = 0;
61
62 if (argc != 2)
63 {
64 fprintf (stderr, "Usage: %s <filename>\n", argv[0]);
65 return 1;
66 }
67
68 if (strcmp(argv[1], "-") == 0)
69 fptr = stdin;
70 else if ((fptr = fopen (argv[1], "rb")) == NULL)
71 {
72 fprintf (stderr, "Couldn't open file %s\n", argv[1]);
73 return 1;
74 }
75
76 while (1)
77 {
78 int channel, length, i, ch;
79
80 if ((ch = getc (fptr)) != '$')
81 {
82 if (ch == EOF)
83 return 0;
84
85 fprintf (stderr, "Couldn't find VLink Start of Packet mark\n");
86 return 1;
87 }
88 pos++;
89
90 printf ("\nVLink Packet start found\n");
91
92 channel = getc (fptr);
93 printf ("Channel: %d\n", channel);
94 pos++;
95
96 length = (getc (fptr) << 8) | getc (fptr);
97 printf ("Packet Length: %d\n", length);
98 pos += 2;
99
100 if (channel == 1 && length >= 8)
101 parse_scp (fptr, length, &pos);
102 else
103 {
104 FILE *f2;
105
106 if ((f2 = fopen ("lastdata", "wb")) == NULL)
107 for (i = 0; i < length; i++)
108 getc (fptr);
109 else
110 for (i = 0; i < length; i++)
111 putc (getc (fptr), f2);
112
113 pos += length;
114
115 fclose (f2);
116 }
117 }
118
119 fclose (fptr);
120 }
0 <HTML>
1
2 <HEAD><TITLE>PPA for the masses</TITLE></HEAD>
3
4 <BODY BGCOLOR=#FFFFFF TEXT=#000000>
5
6 <TABLE WIDTH=100%>
7
8
9 <TD BGCOLOR=#AAAAFF WIDTH=80% ROWSPAN=2>
10
11 <CENTER><H2>Protocol</H2></CENTER>
12
13 <p>Copyright &copy 1998 Tim Norman
14
15 <p>Disclaimer: This information may not be accurate. It has been
16 compiled by me from experimentation and other means that may be prone
17 to error.
18
19
20
21
22 <p>The PPA protocol is actually composed of two protocols: a
23 lower-level packet protocol called VLink and the Sleek Control
24 Protocol (SCP). The VLink protocol regulates all data transfered back
25 and forth between the printer and the computer. SCP sends command
26 sequences to tell the printer to do things like load a sheet of paper,
27 eject, and print a sweep.
28
29 <p>Although PPA is a bi-directional protocol, I have mainly
30 concentrated on its uni-directional component. It is not required for
31 the host to be aware of the bi-directional nature of the device, which
32 makes this easy to do.
33
34 <p>All values are stored in big-endian format.
35
36 <p> <em> Note added: the utility program <tt>parse_vlink</tt> is a
37 simple utility to step through the individual Vlink packets in a
38 PPA stream. It also decodes the SCP packets and prints the information
39 encoded in them. </em>
40
41 <H3>VLink</H3>
42
43 <p>VLink is a very simple protocol:
44
45 <p><TABLE BORDER>
46 <TR><TD><B>Bytes</B></TD><TD><B>Description</B></TD></TR>
47 <TR><TD>1</TD><TD>The character '$'</TD></TR>
48 <TR><TD>1</TD><TD>Channel. Several channels are used:<BR>
49 <TABLE><TR><TD>0</TD><TD>Image Data</TD></TR>
50 <TR><TD>1</TD><TD>Commands and responses</TD></TR>
51 <TR><TD>2</TD><TD>Autostatus</TD></TR>
52 <TR><TD>128</TD><TD>Periodic Ring Buffer Pacing</TD></TR>
53 </TABLE></TD>
54 <TR><TD>2</TD><TD>Length of packet</TD></TR>
55 <TR><TD>n</TD><TD>Packet data</TD></TR>
56 </TABLE>
57
58 <p>When image data is sent over the image data channel, it takes a
59 form that is very close to how it is presented to the print head
60 mechanism. The code in ppa.c best describes how this data is
61 organized. I will also attempt to explain the <A
62 href=sweep_data.html>PPA sweep data</A>.
63
64 <p>The image data may also be optionally compressed. I have not yet
65 worked out the details of the compression method, though it seems
66 similar to the compression used for the PCL protocol. My code
67 currently generates uncompressed data only.
68
69 <p>Note that there is a limit to the amount of data that can be sent
70 to the printer. If you overflow that limit, the printer will get
71 confused. This is why print_pbm uses only 150 of the 300 black
72 nozzles; using all of them would overflow the printer's data buffer.
73 I hope to improve this in the future with compression and multiple
74 sweeps per line. This limit is somewhere around 100k for the Deskjet
75 820Cse.
76
77 <p> (added 09/28/2000, by duncan_haldane@users.sourceforge.net):
78 Printing on HP820 with pnmn2ppa-1.0 fails with flashing lignt syndrome
79 if the vertical position of two successive sweeps differs by 1, 2, or 3
80 dots. (This was observed for the case when one sweep is black ,
81 the other is color). If the two sweeps have the same vertical position
82 (as in Windows 9x printing, its OK)
83
84 <H3>SCP</H3>
85
86 <p>SCP is the protocol that controls the printer's actions. I will
87 describe several of the commands that I use in my software.
88
89 <p>It appears that SCP differs depending on the series of printer that
90 is being used.
91
92 <p><A href=scp_820cse.html>820Cse SCP</a>
93
94 <p><A href=scp_720.html>720 series SCP</a>
95
96 </TD></TR>
97
98
99 </TABLE>
100
101 </BODY>
102
103 </HTML>
104
105
106
107
0 <HTML>
1
2 <HEAD><TITLE>PRINT_SWEEP specification</TITLE></HEAD>
3
4 <BODY BGCOLOR=#FFFFFF TEXT=#000000>
5
6 <table width=100%><tr><td bgcolor=#AAAAFF>
7
8 <H2>HP 720 SCP protocol</H2>
9
10 <p>Following is the probable specification for the SCP protocol on 720
11 printers. Thanks to Jim Peterson and Ben Boule for much of this
12 information.
13
14 <p><TABLE BORDER>
15 <TR><TD><B>Bytes</B></TD><TD><B>Description</B></TD></TR>
16 <TR><TD>2</TD><TD>Command specifier</TD></TR>
17 <TR><TD>2</TD><TD>Packet length (N)</TD></TR>
18 <TR><TD>1</TD><TD>Priority</TD></TR>
19 <TR><TD>1</TD><TD>Blank (always zero)</TD></TR>
20 <TR><TD>2</TD><TD>Command reference number</TD></TR>
21 <TR><TD>4</TD><TD>Number of channel 0 bytes this packet processes</TD></TR>
22 <TR><TD>4</TD><TD>Always (00 02 00 00) - version number?</TD></TR>
23 <TR><TD>N-16</TD><TD>Data, including parameters to this command</TD></TR>
24 </TABLE>
25
26 <p>Several of the commands are described below:
27
28 <p><B><U>CS=0x186, CR=1 (INIT_COM ?)</U></B>
29
30 <p>This is some sort of initialization command. It probably
31 initializes the communications channel, since it is always the first
32 packet sent by the windows driver. It's data consists of 8 bytes
33 that I have only seen as:<BR>
34 <pre><tt> 00 00 01 F4 01 00 00 00</tt></pre>
35
36 <p><B><U>CS=0x18F, CR=2 (INIT_DATA ?)</U></B>
37
38 <p>This is another initialization command. It is sent once at the
39 beginning of each file printed, after the INIT_COM packet. It is
40 preceded by a 4-byte VLink packet sent to channel 0. This suggests
41 that it somehow initializes the data channel of the printer (thus our
42 temporary name). This packet typically contains the values: <tt>DE AD
43 BE EF</tt>. The data portion of this command usually contains the
44 following 8 bytes:<BR>
45
46 <pre><tt> DE AD BE EF 02 00 00 00</tt></pre>
47
48 <p><B><U>CS=0x183, CR=1 (INIT_PAGE ?)</U></B>
49
50 <p>This command is sent each time before a page is loaded. It appears
51 to set some parameters for the page, possibly the minimum and maximum
52 horizontal positions for each of the four pens (?). The only data I have
53 seen it contain is the following:<BR>
54
55 <pre><tt> 28 2D 00 41 2D 32 00 46 2D 32 00 46 2D 32 00 46</tt></pre>
56
57 <p><B><U>CS=0x181, CR=1 (HANDLE_MEDIA)</U></B>
58
59 <p>This is the command that handles loading and ejecting of pages.
60
61 <p><table border>
62 <tr><td>1</td><td>1=load, 2=eject</td></tr>
63 <tr><td>1</td><td>?? usually 0x01</td></tr>
64 <tr><td>2</td><td>usually 0x12C0 (4800 decimal), perhaps the
65 horizontal position to place the print-head while loading/ejecting the
66 page. 4800 corresponds to 8" from the left.</td></tr>
67 </table>
68
69 <p><b><u>CS=0x180, CR=1 (PRINT_SWEEP)</u></b>
70
71 <p>This is the print sweep command. It causes the print head to print
72 a sweep of data (which has previously been sent over channel 0).
73
74 <p>The PRINT_SWEEP command controls the print head while printing data
75 on a page. It can take on two forms, one when printing with the black
76 nozzles, and one when printing with the color nozzles. The black form
77 is described in the most detail here, since it is what I have devoted
78 the most attention to.
79
80 <p>Following is the format of the first 48 bytes of data for this
81 command:
82
83 <p><table border><tr><td><b>Bytes</b></td><td><b>Description</b></td></tr>
84 <tr><td>1</td><td>always 0x00</td></tr>
85 <tr><td>1</td><td>1 = compressed, 0 = not compressed</td></tr>
86 <tr><td>1</td><td>2 = left-to-right, 1 = right-to-left</td></tr>
87 <tr><td>1</td><td>1 = black, 0xE = CMY colors</td></tr>
88 <tr><td>4</td><td>Compressed size of data</td></tr>
89 <tr><td>8</td><td>Typically 0</td><tr>
90 <tr><td><hr></td><td><hr></td></tr>
91
92 <tr><td>4</td><td>Signed number representing vertical
93 position</td></tr>
94 <tr><td>2</td><td>Usually 0x8CA0 (36000 decimal)</td></tr>
95 <tr><td>2</td><td>Horizontal position for left margin in
96 dots</td></tr>
97 <tr><td>2</td><td>Horizontal position for right margin in
98 dots</td></tr>
99 <tr><td>2</td><td>0x5DC0 (24000) for econo/normal, 0x4650 (18000) for best
100 quality</td></tr>
101 <tr><td>2</td><td>Usually 0x12C0 (4800)</td></tr>
102 <tr><td>2</td><td>Usually 0x0100 - has something to do with horizontal
103 placement</td></tr>
104 <tr><td><hr></td><td><hr></td></tr>
105
106 <tr><td>1</td><td>If 0, this is the last sweep on the page; the next
107 12 bytes are ignored. Otherwise, this field predicts the print head
108 direction for the next PRINT_SWEEP command</td></tr>
109 <tr><td>1</td><td>Prediction of number of colors in next PRINT_SWEEP
110 (0x01 or 0x0E)</td></tr>
111 <tr><td>4</td><td>Vertical position of next sweep</td></tr>
112 <tr><td>2</td><td>Horizontal position for left margin in next
113 sweep</td></tr>
114 <tr><td>2</td><td>Horizontal position for right margin in next
115 sweep</td></tr>
116 <tr><td>2</td><td>Predicts the third-to-last word (2-byte value) of
117 the next sweep packet - 0x5DC0</td></tr>
118 <tr><td>2</td><td>Usually 0x12C0 - predicts the second-to-last word of
119 the next sweep packet</td></tr>
120 <tr><td>1</td><td>0x08</td></tr>
121 <tr><td>1</td><td>Number of 16-byte rows to follow this header. This
122 is 2 for black and 6 for CMY.</td></tr>
123 </table>
124
125 <p>Following this header are sets of 16-byte rows to describe how to
126 handle the nozzles. The odd nozzles are described by the first row,
127 and the even nozzles are described by the second row.
128
129 <p><table border><tr><td><b>Bytes</b></td><td><b>Description</b></td></tr>
130 <tr><td>2</td><td>DPI (dots per inch) - 300 or 600</td></tr>
131 <tr><td>2</td><td>Half of the total number of pins used</td></tr>
132 <tr><td>2</td><td>Number of unused pins + 1</td></tr>
133 <tr><td>2</td><td>First pin to start printing with, typically
134 1</td></tr>
135 <tr><td>2</td><td>Half of the total number of pins used</td></tr>
136 <tr><td>2</td><td>Left margin in dots. For black printing, this is
137 always 0x02 greater for the odd pins (first set) than the even
138 pins</td></tr>
139 <tr><td>2</td><td>Right margin in dots.</td></tr>
140 <tr><td>1</td><td>Some sort of delay before this set of nozzles starts
141 firing. For black, odd nozzle is 07, even is 00. For color, the
142 first set of nozzles is 04, the next set is 06, and the last set is
143 00</td></tr>
144 <tr><td>1</td><td>0</td></tr>
145 </table>
146
147 </td></tr></table>
148
149 </body></html>
0 <HTML>
1
2 <HEAD><TITLE>PRINT_SWEEP specification</TITLE></HEAD>
3
4 <BODY BGCOLOR=#FFFFFF TEXT=#000000>
5
6 <table width=100%><tr><td bgcolor=#AAAAFF>
7
8 <H2>Sweep data explanation</H2>
9
10 <p>It took me quite a while to understand the explanation of the sweep
11 data from the HP Journal articles, so I will try to explain it in a
12 little clearer terms here.
13
14 <P>The swing buffer separation applies for black as well as CMY
15 sweeps. I have only deciphered the ordering for the black data,
16 however.
17
18 <H3>What's a sweep?</H3>
19
20 <P>Let's first start off by describing how the nozzles on the
21 printhead are arranged.
22
23 <P>For the black nozzles, there are 300 total nozzles. They are
24 numbered from 1 to 300. There are two columns of nozzles - odd and
25 even. The odd colum consists of 150 nozzles separated by 1/300 of an
26 inch. The even column is similar, but it is shifted down 1/600 of an
27 inch from the odd column. Thus, we can get 300 dpi by printing with
28 one column and 600 dpi by printing "between the lines" with the other
29 column.
30
31 <P>For the color nozzles, each color (CMY - cyan, magenta, yellow) has
32 64 nozzles. They are split into two columns of 32 nozzles each. The
33 odd column has nozzles separated by 1/150 of an inch, and the even
34 column has the same set of nozzles, but shifted 1/300 of an inch
35 down. This allows us to get 300 dpi color. (This may differ slightly
36 on printers other than the 820Cse)
37
38 <P>When the printer prints a graphical image, it must convert the
39 image data into a form that it can understand. The first task is to
40 separate the image into <b>swaths</b>. Let us assume that we have a
41 black-and-white bitmap that is X pixels wide and Y pixels tall that we
42 want to send to the printer. We must cut this into several swaths,
43 each of a certain height. For example, we might choose to cut it into
44 swaths that are 300 pixels high (1/2 an inch). This produces a series
45 of bitmaps that are X by 300 pixels in dimension.
46
47 <P>With this swath data, we can now produce a series of
48 <b>sweeps</b>. A sweep is simply a set of data that tells the
49 printhead how to move across the page and what data to print. For
50 each swath, there may be only one sweep, or there may be multiple
51 sweeps.
52
53 <H3>Formatting the sweep data</H3>
54
55 <P>The sweep data is formatted in a very specific way so that the
56 printer can understand it. The first thing that we need to do is
57 convert the bitmap data into the correct form. The form that is
58 required looks like this:
59
60 <p><table border>
61 <tr><td><b>Columns 0-7</b></td><td><b>Columns
62 8-15</b></td><td><b>...</b></td> <td><b>Columns ceil(X/8)*8-8 to
63 ceil(X/8)*8-1</b></td></tr>
64 <tr><td>Byte 0</td><td>Byte 1</td><td>...</td><td>Byte
65 ceil(X/8)-1</td></tr>
66 <tr><td>Byte ceil(X/8)</td><td>Byte
67 ceil(X/8)+1</td><td>...</td><td>Byte 2*ceil(X/8)-1</td></tr>
68 <tr><Td>...</td><td>...</td><td>...</td><td>...</td></tr></table>
69
70 <P>Each of the 8 bit values are packed into a byte in big-endian
71 order.
72
73 <P>To give a more concrete example, assume we have a sweep that is 64
74 pixels wide and 8 pixels tall. Here is what our data organization
75 will look like:
76
77 <p><table border>
78 <tr><td></td><td><b>Col 0-7</b></td><td><b>Col 8-15</b></td><td><b>Col
79 16-23</b></td><td><b>Col 24-31</b></td><td><b>Col
80 32-39</b></td><td><b>Col 40-47</b></td><td><b>Col
81 48-55</b></td><td><b>Col 56-63</b></td></tr>
82
83 <tr><td><b>Row 0</b></td>
84 <td>Byte 0</td><td>Byte 1</td><td>Byte 2</td><td>Byte
85 3</td><td>Byte 4</td><td>Byte 5</td><td>Byte 6</td><td>Byte
86 7</td></tr>
87
88 <tr><td><b>Row 1</b></td><td>Byte 8</td><td>Byte 9</td><td>Byte 10</td><td>Byte
89 11</td><td>Byte 12</td><td>Byte 13</td><td>Byte 14</td><td>Byte
90 15</td></tr>
91
92 <tr><td><b>Row 2</b></td><td>Byte 16</td><td>Byte 17</td><td>Byte 18</td><td>Byte
93 19</td><td>Byte 20</td><td>Byte 21</td><td>Byte 22</td><td>Byte
94 23</td></tr>
95
96 <tr><td><b>Row 3</b></td><td>Byte 24</td><td>Byte 25</td><td>Byte 26</td><td>Byte
97 27</td><td>Byte 28</td><td>Byte 29</td><td>Byte 30</td><td>Byte
98 31</td></tr>
99
100 <tr><td><b>Row 4</b></td><td>Byte 32</td><td>Byte 33</td><td>Byte 34</td><td>Byte
101 35</td><td>Byte 36</td><td>Byte 37</td><td>Byte 38</td><td>Byte
102 39</td></tr>
103
104 <tr><td><b>Row 5</b></td><td>Byte 40</td><td>Byte 41</td><td>Byte 42</td><td>Byte
105 43</td><td>Byte 44</td><td>Byte 45</td><td>Byte 46</td><td>Byte
106 47</td></tr>
107
108 <tr><td><b>Row 6</b></td><td>Byte 48</td><td>Byte 49</td><td>Byte 50</td><td>Byte
109 51</td><td>Byte 52</td><td>Byte 53</td><td>Byte 54</td><td>Byte
110 55</td></tr>
111
112 <tr><td><b>Row 7</b></td><td>Byte 56</td><td>Byte 57</td><td>Byte 58</td><td>Byte
113 59</td><td>Byte 60</td><td>Byte 61</td><td>Byte 62</td><td>Byte
114 63</td></tr>
115 </table>
116
117 <P>Our next task is to separate this data into <b>swing buffers</b>. Since
118 the odd and even nozzles on the printhead are physically separated, we
119 must extract the appropriate rows of pixels to give to the printer. Two
120 swing buffers are created for each column of bytes. The first is the
121 odd swing buffer, and the second is the even swing buffer. These
122 correspond to which pins will be printing the data. Thus, the odd
123 swing buffer for the first column in the above example would look like
124 this:
125
126 <p><table border>
127 <tr><td>Byte 0</td></tr>
128 <tr><td>Byte 16</td></tr>
129 <tr><td>Byte 32</td></tr>
130 <tr><td>Byte 48</td></tr>
131 </table>
132
133 <P>And the even swing buffer looks like this:
134
135 <p><table border>
136 <tr><td>Byte 8</td></tr>
137 <tr><td>Byte 24</td></tr>
138 <tr><td>Byte 40</td></tr>
139 <tr><td>Byte 56</td></tr>
140 </table>
141
142 <H3>Ordering the swing buffers</H3>
143
144 <p>Now we have odd and even swing buffers for each of the columns in
145 the print sweep. The next thing for us to do is order these swing
146 buffers and send them to the printer.
147
148 <p>From experimentation, I have determined the ordering for the black
149 data on the 820Cse.
150
151 <ol>
152 <li>First, the odd swing buffers for the left 12 columns are sent as
153 sweep data.
154
155 <li>Next, the odd swing buffer for the 13th column is sent, followed by
156 the even swing buffer for the first column. This alternates until we
157 run out of odd swing buffers.
158
159 <li>Finally, the even swing buffers for the last 12 columns are sent.
160 </ol>
161
162 <p>From experimentation, it seems that the values of the first and
163 last 12 columns of data MUST be all 0's. Otherwise, strange results
164 occur, including the repetition of a single swing buffer across the
165 whole sweep.
166
167 <P>Here is a quick reference for the ordering of the swing buffer
168 data, assuming X columns of data.
169
170 <p><table border>
171 <tr><td>Odd swing buffer for column 0</td></tr>
172 <tr><td>Odd swing buffer for column 1</td></tr>
173 <tr><td>...</td></tr>
174 <tr><td>Odd swing buffer for column 11</td></tr>
175 <tr><td>Odd swing buffer for column 12</td></tr>
176 <tr><td>Even swing buffer for column 0</td></tr>
177 <tr><td>Odd swing buffer for column 13</td></tr>
178 <tr><td>Even swing buffer for column 1</td></tr>
179 <tr><td>...</td></tr>
180 <tr><td>Odd swing buffer for column X-1</td></tr>
181 <tr><td>Even swing buffer for column X-13</td></tr>
182 <tr><td>Even swing buffer for column X-12</td></tr>
183 <tr><td>Even swing buffer for column X-11</td></tr>
184 <tr><td>...</td></tr>
185 <tr><td>Even swing buffer for column X-1</td></tr>
186
187 </table>
188
189 <p>For different printers and color printing, the number of columns to
190 send before we start interleaving seems to vary.
191
192 </td></tr></table>
193
194 </body></html>
0 **********************************************
1 The updates here are scheduled for future
2 inclusion in: rhs-printfilters-1.72
3 **********************************************
4
5
6 (1) If you have a printtool < 3.44 system (Red Hat 6.1 or earlier,
7 Mandrake 7.0 or earlier) just get the updated RPMS
8
9 rhs-printfilters-1.57-4ppa4.i386.rpm (for Red Hat)
10 rhs-printfilters-1.58-4ppa5mdk.i386.rpm (for Mandrake)
11
12 from http://sourceforge.net/projects/pnm2ppa .
13
14 (For older Red Hat or Mandrake systems, you may need to rebuild the
15 source RPMs.) These RPMS already incorporate the changes described here,
16 so just install the appropriate one.
17
18 ------------------
19
20 (2) If you have printtool 3.44 or greater, but rhs-printfilters >= 1.61 and
21 < 1.72 (Red Hat 6.2, Mandrake 7.1) you may wish to manually update the
22 files
23
24 /usr/lib/rhs/rhs-printfilters/printerdb
25 /usr/lib/rhs/rhs-printfilters/ppaprint
26
27 as described here. This will provide improved functionality
28 of pnm2ppa configuration using printtool.
29
30 (3) Future releases of Red Hat or Mandrake will probably include
31 rhs-printfilters >= 1.72, so these changes will already be made.
32
33 =================================================================
34 Instructions. (Red Hat 6.2, Mandrake 7.1)
35
36 (a) replace /usr/lib/rhs/rhs-printfilters/ppaprint .
37
38 (as root:)
39
40 cd /usr/lib/rhs/rhs-printfilters
41
42 copy ppaprint-latest and printerdb-ppa to this directory, if necessary.
43 (if you installed pnm2ppa-1.0 from a RPM they should be there already).
44
45 mv ppaprint ppaprint-old
46 mv ppaprint-latest ppaprint
47 chmod 0755 ppaprint
48
49
50 (b) update printerdb.
51
52 Save your current printerdb:
53
54 cp printerdb printerdb-saved
55
56 Now edit printerdb to replace the PPA printer entries with the
57 updated ones from printerdb-ppa. Use your favorite editor to cut
58 out the older PPA printer entries from printerdb, and paste in the contents
59 of printerdb-ppa in their place.
60
61
62 **TIP: for this to work, the PPA Printer entries in your old printerdb must
63 say "GSDriver: ppa" and *NOT* "GSDriver: pnmraw" (which is an older
64 printerdb style meant for printtool < 3.44). "ppa" is not a true
65 GS driver name, but a dummy device name added to the list of available
66 drivers by printtool >= 3.44 after it has detected that pnm2ppa is
67 installed.
68
69 -------
70
71 Note that these manually-made changes may be lost whenever the
72 rhs-printfilters rpm is updated using the rpm utility.
73 Eventually, they will be incorporated in newer "official" releases of
74 rhs-printfilters-1.72 or above, as they are released.
75
76
77
0 #!/bin/sh
1 # ppaprint v2.12 July 7, 2000
2 #
3 # make pnm2ppa (or pbm2ppa) command line for postprocessing to produce PPA
4 # output for HP's PPA printers (DeskJet 710, 720, 820, 1000 series).
5 #
6 # Duncan Haldane, the pnm2ppa project, <duncan_haldane@users.sourceforge.net>
7 # see also http://sourceforge.net/projects/pnm2ppa
8 #
9 BINDIR=/usr/bin
10 CONFIG_DIR=/etc
11
12 PPA_CONFIG=$1
13 PAPERSIZE=$2
14 RESOLUTION=$3
15 EXTRA_GS_OPTIONS=$@
16 for arg in $1 $2 $3 ; do
17 EXTRA_GS_OPTIONS=$(echo "${EXTRA_GS_OPTIONS}" | eval "sed -e 's/^.*$arg//'")
18 done
19
20 if ! [ "$RESOLUTION" = "600x600" ] ; then
21 echo "Error - ppaprint: unsupported RESOLUTION=$RESOLUTION"
22 exit 1
23 fi
24
25 # extract any extra PPA options from $EXTRA_GS_OPTIONS:
26 # format is $EXTRA_GS_OPTIONS= "(gs_options)PPA(ppa_options)"
27 EXTRA_PPA_OPTIONS=""
28 if echo $EXTRA_GS_OPTIONS | grep -e "PPA" >/dev/null 2>&1 ; then
29 EXTRA_PPA_OPTIONS=$EXTRA_GS_OPTIONS
30 EXTRA_GS_OPTIONS=$(echo "${EXTRA_GS_OPTIONS}" | sed -e 's/PPA.*$//' )
31 EXTRA_PPA_OPTIONS=$(echo "${EXTRA_PPA_OPTIONS}" | sed -e 's/^.*PPA//')
32 fi
33
34
35 # identify paper size
36 if [ "$PAPERSIZE" = "letter" ]; then
37 PPA_PAPERSIZE="-s letter"
38 elif [ "$PAPERSIZE" = "a4" ]; then
39 PPA_PAPERSIZE="-s a4"
40 elif [ "$PAPERSIZE" = "legal" ]; then
41 PPA_PAPERSIZE="-s legal"
42 else
43 PPA_PAPERSIZE="-s letter"
44 fi
45
46 # identify printer type
47 # (at present, a type 710 is treated as a type 720 in printerdb)
48 if echo $PPA_CONFIG | grep -e "ppa710" > /dev/null 2>&1 ; then
49 PPA_PRINTER="-v 710"
50 elif echo $PPA_CONFIG | grep -e "ppa720" > /dev/null 2>&1 ; then
51 PPA_PRINTER="-v 720"
52 elif echo $PPA_CONFIG | grep -e "ppa820" > /dev/null 2>&1 ; then
53 PPA_PRINTER="-v 820"
54 elif echo $PPA_CONFIG | grep -e "ppa1000" > /dev/null 2>&1 ; then
55 PPA_PRINTER="-v 1000"
56 fi
57
58 PPA_OPTIONS="$PPA_PAPERSIZE $EXTRA_PPA_OPTIONS"
59
60 if echo $PPA_CONFIG | grep -e "pbm" >/dev/null 2>&1 ; then
61 # use the old pbm2ppa Black-and-White-only driver
62 # first check that old pbm2ppa driver is installed
63 if ! $BINDIR/pbm2ppa -h > /dev/null 2>&1 ; then
64 echo "Error - ppaprint: pbm2ppa driver was not found"
65 exit 1
66 fi
67
68 # assemble the pbm2ppa command line:
69 GSDEVICE=pbmraw
70 PPA_CONF="$CONFIG_DIR/pbm2ppa.conf"
71 if [ -f $PPA_CONF ] ; then
72 PPA_CONF="-f $PPA_CONF"
73 else
74 PPA_CONF=""
75 fi
76 PPA_OPTIONS="$PPA_PRINTER $PPA_CONF $PPA_OPTIONS"
77 PPA="$BINDIR/pbm2ppa $PPA_OPTIONS - - "
78
79 else
80 # use the new pnm2ppa driver with color support
81 # first check that new pnm2ppa driver is installed
82 if ! $BINDIR/pnm2ppa -h > /dev/null 2>&1 ; then
83 echo "Error - ppaprint: pnm2ppa driver was not found"
84 exit 1
85 fi
86
87 # papersize is no longer needed by pnm2ppa >= 0.99
88 # (the papersize is now taken from the pnm input file header).
89 PPA_PAPERSIZE=""
90
91 # all pnm formats are now supported by pnm2ppa >= 0.99
92 # -- use ppmraw for color-enabled printing
93 # -- use pbmraw in --bw black and white modes.
94
95
96
97 # identify color option
98 if echo $PPA_CONFIG | grep -e "ppa.*0b1" > /dev/null 2>&1 ; then
99 GSDEVICE=pbmraw
100 PPA_COLOR="--bw --eco"
101 elif echo $PPA_CONFIG | grep -e "ppa.*0b2" > /dev/null 2>&1 ; then
102 GSDEVICE=pbmraw
103 PPA_COLOR="--bw"
104 elif echo $PPA_CONFIG | grep -e "ppa.*0c1" > /dev/null 2>&1 ; then
105 GSDEVICE=ppmraw
106 PPA_COLOR="--eco --fd"
107 elif echo $PPA_CONFIG | grep -e "ppa.*0c2" > /dev/null 2>&1 ; then
108 GSDEVICE=ppmraw
109 PPA_COLOR="-p --eco"
110 elif echo $PPA_CONFIG | grep -e "ppa.*0c3" > /dev/null 2>&1 ; then
111 GSDEVICE=ppmraw
112 PPA_COLOR=""
113 elif echo $PPA_CONFIG | grep -e "ppa.*0c4" > /dev/null 2>&1 ; then
114 GSDEVICE=ppmraw
115 PPA_COLOR="-p --uni"
116 elif echo $PPA_CONFIG | grep -e "ppa.*0c5" > /dev/null 2>&1 ; then
117 GSDEVICE=ppmraw
118 PPA_COLOR="--eco"
119
120 fi
121
122 # assemble the pnm2ppa command line:
123
124 PPA_CONF="$CONFIG_DIR/pnm2ppa.conf"
125 if [ -f $PPA_CONF ] ; then
126 PPA_CONF="-f $PPA_CONF"
127 else
128 PPA_CONF=""
129 fi
130 PPA_OPTIONS="$PPA_PRINTER $PPA_CONF $PPA_COLOR $PPA_OPTIONS"
131 PPA="$BINDIR/pnm2ppa $PPA_OPTIONS -i - -o - "
132 fi
133
134 echo "-sDEVICE=$GSDEVICE $EXTRA_GS_OPTIONS - | $PPA "
135
136 exit 0
137
138
139
140
0
1 #
2 # this is for the pnm2ppa driver for the HP DeskJet PPA (720)
3 #
4 StartEntry: HP DeskJet 720
5 GSDriver: ppa
6 # to use with rhs-printfilters < 1.62 and printtool < 3.44
7 # comment out the above line and uncomment the line below
8 # GSDriver: pnmraw
9 Description: {HP DeskJet 710/720 series (PPA)}
10 About: { \
11 IMPORTANT: Do *NOT* check \
12 the "Fast text printing (non-PS printers only)" box. \
13 \
14 These drivers are for DeskJet 710C, 712C, 720C, 722C printers \
15 which use HP's proprietary PPA protocol instead of PCL. \
16 Postscript images are converted by ghostscript into \
17 "Portable PixMap" (color) or "Portable BitMap" (black) formats \
18 and then converted to PPA instructions by the pnm2ppa \
19 post-processor. \
20 (The older black-only pbm2ppa post-processor is also \
21 provided as a legacy alternative.) \
22 You may add PPA processor options \
23 after a "PPA" separator in the "extra GS options" box,\
24 in the format: " gs_options PPA ppa_options "; \
25 type "pnm2ppa -h" or "pbm2ppa -h" to list the options. \
26 \
27 The primary site for the PPA driver is the pnm2ppa \
28 project at http://sourceforge.net/projects/pnm2ppa .\
29 }
30 Resolution: {600} {600} {}
31 BitsPerPixel: {ppa720b1} {Black and white, econofast mode}
32 BitsPerPixel: {ppa720b2} {Black and white, normal quality}
33 BitsPerPixel: {ppa720c1} {Color, econofast mode}
34 BitsPerPixel: {ppa720c5} {Color, normal quality}
35 BitsPerPixel: {ppa720c3} {Color, high quality}
36 BitsPerPixel: {ppa720c2} {Color, normal quality, black ink disabled}
37 BitsPerPixel: {ppa720c4} {Color, high quality, black ink disabled}
38 BitsPerPixel: {ppa720pbm} {Black and white, legacy pbm2ppa driver}
39 EndEntry
40
41 #
42 # this is for the pnm2ppa driver for the HP DeskJet PPA (820)
43 #
44
45 StartEntry: HP DeskJet 820
46 GSDriver: ppa
47 # to use with rhs-printfilters < 1.62 and printtool < 3.44
48 # comment out the above line and uncomment the line below
49 # GSDriver: pnmraw
50 Description: {HP DeskJet 820 series (PPA)}
51 About: { \
52 IMPORTANT: Do *NOT* check \
53 the "Fast text printing (non-PS printers only)" box. \
54 \
55 This driver is for HP 820Cse, 820Cxi printers \
56 which use HP's proprietary PPA protocol instead of PCL. \
57 Postscript images are converted by ghostscript into \
58 "Portable PixMap" (color) or "Portable BitMap" (black) formats \
59 and then converted to PPA instructions by the pnm2ppa \
60 post-processor. \
61 (The older black-only pbm2ppa post-processor is also \
62 provided as a legacy alternative.) \
63 You may add PPA processor options \
64 after a "PPA" separator in the "extra GS options" box,\
65 in the format: " gs_options PPA ppa_options "; \
66 type "pnm2ppa -h" or "pbm2ppa -h" to list the options. \
67 \
68 The primary site for the PPA driver is the pnm2ppa \
69 project at http://sourceforge.net/projects/pnm2ppa .\
70 }
71 Resolution: {600} {600} {}
72 BitsPerPixel: {ppa820b1} {Black and white, econofast mode}
73 BitsPerPixel: {ppa820b2} {Black and white, normal quality}
74 BitsPerPixel: {ppa820c1} {Color, econofast mode}
75 BitsPerPixel: {ppa820c5} {Color, normal quality}
76 BitsPerPixel: {ppa820c3} {Color, high quality}
77 BitsPerPixel: {ppa820c2} {Color, normal quality, black ink disabled}
78 BitsPerPixel: {ppa820c4} {Color, high quality, black ink disabled}
79 BitsPerPixel: {ppa820pbm} {Black and white, legacy pbm2ppa driver}
80 EndEntry
81 #
82 # this is for the pnm2ppa driver for the HP DeskJet PPA (1000)
83 #
84
85 StartEntry: HP DeskJet 1000
86 GSDriver: ppa
87 # to use with rhs-printfilters < 1.62 and printtool < 3.44
88 # comment out the above line and uncomment the line below
89 # GSDriver: pnmraw
90 Description: {HP DeskJet 1000 series (PPA)}
91 About: { \
92 IMPORTANT: Do *NOT* check \
93 the "Fast text printing (non-PS printers only)" box. \
94 \
95 This driver is for HP 1000Cse, 1000Cxi printers \
96 which use HP's proprietary PPA protocol instead of PCL. \
97 Postscript images are converted by ghostscript into \
98 "Portable PixMap" (color) or "Portable BitMap" (black) formats \
99 and then converted to PPA instructions by the pnm2ppa \
100 post-processor. \
101 (The older black-only pbm2ppa post-processor is also \
102 provided as a legacy alternative.) \
103 You may add PPA processor options \
104 after a "PPA" separator in the "extra GS options" box,\
105 in the format: " gs_options PPA ppa_options "; \
106 type "pnm2ppa -h" or "pbm2ppa -h" to list the options. \
107 \
108 The primary site for the PPA driver is the pnm2ppa \
109 project at http://sourceforge.net/projects/pnm2ppa .\
110 }
111 Resolution: {600} {600} {}
112 BitsPerPixel: {ppa1000b1} {Black and white, econofast mode}
113 BitsPerPixel: {ppa1000b2} {Black and white, normal quality}
114 BitsPerPixel: {ppa1000c1} {Color, econofast mode}
115 BitsPerPixel: {ppa1000c5} {Color, normal quality}
116 BitsPerPixel: {ppa1000c3} {Color, high quality}
117 BitsPerPixel: {ppa1000c2} {Color, normal quality, black ink disabled}
118 BitsPerPixel: {ppa1000c4} {Color, high quality, black ink disabled}
119 BitsPerPixel: {ppa1000pbm} {Black and white, legacy pbm2ppa driver}
120 EndEntry
121
0 #!/bin/sh
1 #
2 # convert ps to the format required by the printer on this queue
3 #
4 # if the printer is a PostScript printer, just cat it through
5 # if the printer uses ghostscript, we'll run it now
6 # if the printer is neither, we die (with good message to someone)
7 #
8
9 # location of the ppaprint script
10 FPIDIR=/usr/lib/rhs/rhs-printfilters/
11
12 #
13 # read in PostScript configuration settings
14 #
15
16 source ${SPOOLDIR}/postscript.cfg
17
18 #
19 # see if we should reverse order
20 #
21 # support will be added for this in the future
22 # psorder needed and is part of netatalk, which we dont currently ship
23 #
24
25 if [ "$PAPERSIZE" = "letter" ]; then
26 mpage_paper="Letter"
27 elif [ "$PAPERSIZE" = "a4" ]; then
28 mpage_paper="A4"
29 elif [ "$PAPERSIZE" = "legal" ]; then
30 mpage_paper="Legal"
31 else
32 mpage_paper="Letter"
33 fi
34
35 #
36 # weird case - some PS doesnt get handled by mpage well
37 # so we allow nup=1 to just cat PS to printer w/o mpage interferring
38 #
39 if [ "$NUP" = "1" ]; then
40 border="-o"
41 mpage_cmd="cat -"
42 else
43 border=""
44 mpage_cmd="mpage -b$mpage_paper $border -$NUP -m${RTLFTMAR}lr -m${TOPBOTMAR}tb"
45 fi
46
47 #
48 # if the driver is
49 # "POSTSCRIPT" it means the printer handles Postscript natively,
50 # no need to run gs.
51 # "TEXT" it means the printer cannot handle PS input
52 # "uniprint" use the driver set by COLOR in postscript.cfg
53 # "ppa" use the driver and postprocessor returned by ppaprint
54
55 if [ "$GSDEVICE" = "POSTSCRIPT" ]; then
56 eval $mpage_cmd
57 elif [ "$GSDEVICE" = "TEXT" ]; then
58 echo "Error - ps-to-printer.fpi - this printer cannot print postscript"
59 echo " and ghostscript does not have support"
60 exit 1
61 #
62 # We're using ghostscript with "uniprint" command line style,
63 # $COLOR holds filename of driver parameters (filename.upp)
64 # Since real driver name is stored in *.upp files, this style can
65 # activate traditional drivers provided you create corresponding
66 # *.upp files, entry to printdb, and compile ghostscript with uniprint.
67 # ( Without compiling uniprint in ghostscript, this script will filter
68 # out all uniprint entries in printdb including fake ones for
69 # traditional drivers )
70 #
71 elif [ "$GSDEVICE" = "uniprint" ]; then
72 # Set default *.upp driver (your default printer upp driver here)
73 if [ "$COLOR" = "" ]; then
74 COLOR="stcany"
75 echo "No filename for parameters given. Assume $COLOR."
76 fi
77 #
78 eval "$mpage_cmd | gs -q @$COLOR.upp \
79 -sPAPERSIZE=$PAPERSIZE \
80 -sOutputFile=- \
81 $EXTRA_GS_OPTIONS \
82 -"
83
84 # support for HP DeskJet PPA printers (710, 720, 820, 1000 series).
85 # assemble the PPA postprocessor command line using the ppaprint script.
86 # GSDEVICE is selected from among the pnm devices.
87 # $EXTRA_GS_OPTIONS is processed to remove PPA options.
88 # PPA configuration is encoded in $COLOR
89
90 # (use the GSDEVICE=ppa test when Red Hat have modified printtool
91 # to recognise printerdb entries with GSDEVICE=ppa ....)
92 #elif [ "$GSDEVICE" = "ppa" ]; then
93 # (until then, test $COLOR instead ....)
94 elif echo $COLOR | grep -e "ppa" > /dev/null 2>&1 ; then
95 PPA=$FPIDIR/ppaprint
96 PPA_CMD=$(eval "$PPA $COLOR $PAPERSIZE $RESOLUTION $EXTRA_GS_OPTIONS ")
97 if ! echo $PPA_CMD | grep -e "Error" > /dev/null 2>&1 ; then
98 eval "$mpage_cmd | sed \"s/[(]%%.*%%[)].*flush//g\" | \
99 gs -q \
100 -r$RESOLUTION \
101 -sPAPERSIZE=$PAPERSIZE \
102 -dNOPAUSE \
103 -dSAFER \
104 -sOutputFile=- \
105 $PPA_CMD"
106 else
107 echo "Error - ps-to-printer.fpi - PPA postprocessor error:"
108 echo $PPA_CMD
109 exit 1
110 fi
111 else
112 # We're using ghostscript in traditional manner
113
114 eval "$mpage_cmd | sed \"s/[(]%%.*%%[)].*flush//g\" | \
115 gs -q -sDEVICE=$GSDEVICE \
116 -r$RESOLUTION \
117 -sPAPERSIZE=$PAPERSIZE \
118 -dNOPAUSE \
119 -dSAFER \
120 -sOutputFile=- \
121 $COLOR \
122 $EXTRA_GS_OPTIONS \
123 -"
124
125 fi
126
127 #
128 #
129 # see if we need to send a form feed to eject the page from printer
130 #
131 if [ "$PS_SEND_EOF" = "YES" ]; then
132 printf "\004"
133 fi
134
135 exit 0
136
137
138
139
140
141
142
143
144
0 diff -uNr pnm2ppa-1.04/Makefile pnm2ppa-1.04.redhat/Makefile
1 --- pnm2ppa-1.04/Makefile Thu Nov 2 13:33:08 2000
2 +++ pnm2ppa-1.04.redhat/Makefile Sat Nov 11 13:25:28 2000
3 @@ -10,7 +10,7 @@
4 INSTALL=install
5
6 # production build
7 -CFLAGS=-Wall -pedantic -O2 -g -DNDEBUG
8 +CFLAGS= $(RPM_OPT_FLAGS) -DNDEBUG
9 LDFLAGS=-lm
10 OBJS = pnm2ppa.o syslog.o ppa.o image.o dither.o cutswath.o hash_ink.o gamma.o
11 SRC = pnm2ppa.c syslog.c ppa.c image.c dither.c cutswath.c hash_ink.c gamma.c
12 diff -uNr pnm2ppa-1.04/pnm2ppa.conf pnm2ppa-1.04.redhat/pnm2ppa.conf
13 --- pnm2ppa-1.04/pnm2ppa.conf Sat Oct 28 11:02:57 2000
14 +++ pnm2ppa-1.04.redhat/pnm2ppa.conf Sat Nov 11 13:26:57 2000
15 @@ -12,7 +12,7 @@
16 # will be used. The printer version can also be set with the command line
17 # option e.g., "-v 720".
18
19 -version ERROR # PNM2PPA WIIL *NOT* WORK UNTIUL THIS ENTRY IS REMOVED!!!!
20 +
21 #version 720 # 710, 712, 722 also acceptable
22 #version 820
23 #version 1000
24 @@ -29,8 +29,9 @@
25 # configuration file (/etc/pnm2ppa.conf), and not from configuration files
26 # specified with the pnm2ppa option "-f".
27
28 -#silent 1
29 -#verbose 1
30 +silent 1 #SYSTEM LOG MESSAGES SILENCED
31 +#verbose 1
32 +
33
34 #---------set the margins of the printed page-------------------
35 # Margins: these are distances from the edges of the paper in
0 %define _mandir /usr/man
1
2 Name: pnm2ppa
3 Summary: Drivers for printing to HP PPA printers
4 Serial: 1
5 Obsoletes: ppa
6 Obsoletes: pbm2ppa
7 Version: 1.04
8 Release: 1
9 URL: http://sourceforge.net/projects/pnm2ppa
10 Source: http://download.sourceforge.net/pnm2ppa/pnm2ppa-%{version}.tar.gz
11 Source1: http://www.httptech.com/ppa/files/ppa-0.8.6.tar.gz
12 Patch2: pbm2ppa-20000205.diff
13 Patch3: pnm2ppa-redhat.patch
14 Copyright: GPL
15 Group: Applications/Publishing
16 Buildroot: /var/tmp/pnm2ppa-buildroot
17 %define topdir pnm2ppa-%{version}
18
19 %description
20 pnm2ppa is a color driver for HP PPA host-based printers such
21 as the HP710C, 712C, 720C, 722C, 820Cse, 820Cxi, 1000Cse, and 1000Cxi.
22 It accepts ghostscript output in PNM formats, and sends it to the printer
23 in PPA format. The older (black only) driver pbm2ppa is also included.
24
25 Install pnm2ppa if you have a PPA printer and need to print.
26
27 For further information, see the pnm2ppa project homepage at
28 http://sourceforge.net/projects/pnm2ppa .
29
30 %prep
31 rm -rf $RPM_BUILD_ROOT
32
33 %setup -q -n %{topdir}
34
35 #pbm2ppa source
36 %setup -T -D -a 1 -n %{topdir}
37 %patch2 -p0
38 %patch3 -p1 -b .rh
39
40 %build
41 make
42 cd pbm2ppa-0.8.6
43 make
44
45
46 %install
47 install -d $RPM_BUILD_ROOT/usr/bin
48 install -d $RPM_BUILD_ROOT/etc
49 install -d $RPM_BUILD_ROOT%{_mandir}/man1
50 make INSTALLDIR=$RPM_BUILD_ROOT/usr/bin CONFDIR=$RPM_BUILD_ROOT/etc \
51 MANDIR=$RPM_BUILD_ROOT%{_mandir}/man1 install
52 install -m 0755 utils/Linux/detect_ppa $RPM_BUILD_ROOT/usr/bin/
53 install -m 0755 utils/Linux/test_ppa $RPM_BUILD_ROOT/usr/bin/
54 install -m 0755 pbm2ppa-0.8.6/pbm2ppa $RPM_BUILD_ROOT/usr/bin/
55 install -m 0755 pbm2ppa-0.8.6/pbmtpg $RPM_BUILD_ROOT/usr/bin/
56 install -m 0644 pbm2ppa-0.8.6/pbm2ppa.conf $RPM_BUILD_ROOT/etc
57 install -m 0644 pbm2ppa-0.8.6/pbm2ppa.1 $RPM_BUILD_ROOT%{_mandir}/man1
58
59 chmod 644 docs/en/LICENSE
60 mkdir -p pbm2ppa
61 for file in CALIBRATION CREDITS INSTALL INSTALL-MORE LICENSE README ; do
62 install -m 0644 pbm2ppa-0.8.6/$file pbm2ppa/$file
63 done
64
65 #---omit this section from Official RedHat/Mandrake releases!--------------
66 install -d $RPM_BUILD_ROOT/usr/lib/rhs/rhs-printfilters
67 install -m 0755 rhs-printfilters/ppaprint $RPM_BUILD_ROOT/usr/lib/rhs/rhs-printfilters/ppaprint-latest
68 install -m 0644 rhs-printfilters/printerdb-ppa $RPM_BUILD_ROOT/usr/lib/rhs/rhs-printfilters
69 install -m 0644 rhs-printfilters/README.ppa $RPM_BUILD_ROOT/usr/lib/rhs/rhs-printfilters
70 #-------------------------------------------------
71
72
73 %clean
74 rm -rf $RPM_BUILD_ROOT
75
76 %files
77 %defattr(-,root,root)
78 %doc docs/en/CREDITS docs/en/INSTALL docs/en/LICENSE docs/en/README
79 %doc docs/en/RELEASE-NOTES docs/en/TODO
80 %doc docs/en/INSTALL.REDHAT.txt docs/en/COLOR.txt docs/en/CALIBRATION.txt
81 %doc docs/en/INSTALL.REDHAT.html docs/en/COLOR.html docs/en/CALIBRATION.html
82 %doc test.ps
83 %doc pbm2ppa
84 /usr/bin/pnm2ppa
85 /usr/bin/pbm2ppa
86 /usr/bin/pbmtpg
87 /usr/bin/calibrate_ppa
88 /usr/bin/test_ppa
89 /usr/bin/detect_ppa
90 %{_mandir}/man1/pnm2ppa.1*
91 %{_mandir}/man1/pbm2ppa.1*
92 %config /etc/pnm2ppa.conf
93 %config /etc/pbm2ppa.conf
94
95
96 #---omit from RedHat--------------------
97 %doc docs/en/INSTALL.MANDRAKE.html docs/en/INSTALL.MANDRAKE.txt
98 #------omit from Official RedHat/Mandrake releases!
99 /usr/lib/rhs/rhs-printfilters/ppaprint-latest
100 /usr/lib/rhs/rhs-printfilters/printerdb-ppa
101 /usr/lib/rhs/rhs-printfilters/README.ppa
102 #-----------------------------------------
103
104
105
106 %changelog
107 * Tue Nov 24 2000 Duncan Haldane <duncan_haldane@users.sourceforge.net>
108 - updated for 1.04 release.
109
110 * Tue Oct 24 2000 Duncan Haldane <duncan_haldane@users.sourceforge.net>
111 - updated for 1.01 release; calibrate renamed to calibrate_ppa.
112
113 * Tue Jul 11 2000 Duncan Haldane <duncan_haldane@users.sourceforge.net>
114 - updated for 1.0 release.
115
116 * Sun Apr 09 2000 <duncan_haldane@users.sourceforge.net>
117 - added optional updated rhs-printfilter files
118
119 * Thu Feb 10 2000 Bill Nottingham <notting@redhat.com>
120 - adopt upstream package
121
122 * Sun Feb 6 2000 <duncan_haldane@users.sourceforge.net>
123 - new pnm2ppa release, and add pbm2ppa driver.
124
125 * Thu Jan 7 2000 <duncan_haldane@users.sourceforge.net>
126 - created rpm
127
128
129
0 cat $1 | \
1 gs -sDEVICE=ppmraw -q -sPAPERSIZE=a4 -dNOPAUSE -r600 -sOutputFile=- - | \
2 ./pnm2ppa --bw --eco $2 $3 $4 $5 -i - -o /dev/lp0
0 cat $1 | \
1 gs -sDEVICE=ppmraw -q -sPAPERSIZE=a4 -dNOPAUSE -r600 -sOutputFile=- - | \
2 ./pnm2ppa $2 $3 $4 $5 -i - -o /dev/lp0
0 cat $1 | \
1 gs -sDEVICE=ppmraw -q -sPAPERSIZE=a4 -dNOPAUSE -r600 -sOutputFile=- - | \
2 ./pnm2ppa --eco $2 $3 $4 $5 -i - -o /dev/lp0
0 /***************************************************************************
1 syslog.c - handles syslog messages
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16 /*Michael Mancini <gwaihir@email.com>
17 16 Jan 2000
18 BeOS syslog() wrapper
19 syslog.c
20 modified Duncan Haldane <duncan_haldane@users.sourceforge.net>
21 Oct 2000. all syslog messages arrive here wrapped.
22 */
23
24 #include <stdio.h>
25 #include "syslog.h"
26 #include "global.h"
27
28
29
30 /*
31 For some reason, BeOS doesn't seem to implement syslog(), even though it is
32 included with the system. Wierd. This wraps the syslog functions used
33 and writes the info to the stderr stream.
34 */
35
36
37 void
38 wrap_syslog(int log_pri, char *fmt, char *message )
39 {
40 if (!(gSilent))
41 #ifdef __BEOS__
42 {
43 gSilent = true;
44 gVerbose = true;
45 }
46 #else
47 {
48 syslog ( log_pri , "%s", message );
49 }
50 #endif
51
52 if (gVerbose)
53 {
54 /* Send the syslog data to the stderr stream */
55 fprintf(stderr,"pnm2ppa: %s",message);
56 }
57 return ;
58 }
59
60 void wrap_openlog( char *ident, int level )
61 {
62 #ifndef __BEOS__
63 if ( level )
64 {
65 /* level 1 has LOG_PERROR (prints to stderr) */
66 openlog ( ident, LOG_PERROR | LOG_CONS | LOG_PID, LOG_LPR);
67 }
68 else
69 {
70 /* standard level 0 */
71 openlog ( ident, LOG_CONS | LOG_PID, LOG_LPR);
72 }
73 #endif
74 return;
75 }
76
77 void
78 wrap_closelog( void)
79 {
80 #ifndef __BEOS__
81 closelog();
82 #endif
83 return;
84 }
85
86
87
88
89
90
91
92
93
94
95
96
0 /***************************************************************************
1 syslog.h - prototypes and stuff for syslog.c
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 1998-2000 by pnm2ppa project
5 email :
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16 /*
17 syslog.h
18 modified Duncan Haldane <duncan_haldane@users.sourceforge.net>
19 Oct 2000. all syslog messages are now wrapped.
20 */
21
22 #ifndef _PNM2PPA_SYSLOG_H_
23 #define _PNM2PPA_SYSLOG_H_
24
25
26 #ifdef __BEOS__
27 /* these are not actually used for BeOS messages... */
28 #define LOG_EMERG 0 /* system is unusable */
29 #define LOG_ALERT 1 /* action must be taken immediately */
30 #define LOG_CRIT 2 /* critical conditions */
31 #define LOG_ERR 3 /* error conditions */
32 #define LOG_WARNING 4 /* warning conditions */
33 #define LOG_NOTICE 5 /* normal but significant condition */
34 #define LOG_INFO 6 /* informational */
35 #define LOG_DEBUG 7 /* debug-level messages */
36
37 #else
38 #include <syslog.h>
39 #endif
40
41 char syslog_message[128];
42 extern size_t message_size ;
43
44 void wrap_syslog( int, char *, char *);
45 void wrap_openlog( char *, int );
46 void wrap_closelog (void);
47
48 #ifdef __PNM2PPA_C__
49 size_t message_size = 128;
50 #endif
51
52
53 #endif
54
55
56
57
58
59
60
61
62
63
64
65
66
0 %!PS-Adobe-2.0
1 %%Title: test.ps
2 %%Creator: fig2dev Version 3.2 Patchlevel 1
3 %%CreationDate: Sun Nov 28 23:02:49 1999
4 %%For: klamer@thuiscomputer (Klamer Schutte)
5 %%Orientation: Portrait
6 %%BoundingBox: 149 175 446 666
7 %%Pages: 1
8 %%BeginSetup
9 %%IncludeFeature: *PageSize A4
10 %%EndSetup
11 %%Magnification: 1.0000
12 %%EndComments
13 /$F2psDict 200 dict def
14 $F2psDict begin
15 $F2psDict /mtrx matrix put
16 /col-1 {0 setgray} bind def
17 /col0 {0.000 0.000 0.000 srgb} bind def
18 /col1 {0.000 0.000 1.000 srgb} bind def
19 /col2 {0.000 1.000 0.000 srgb} bind def
20 /col3 {0.000 1.000 1.000 srgb} bind def
21 /col4 {1.000 0.000 0.000 srgb} bind def
22 /col5 {1.000 0.000 1.000 srgb} bind def
23 /col6 {1.000 1.000 0.000 srgb} bind def
24 /col7 {1.000 1.000 1.000 srgb} bind def
25 /col8 {0.000 0.000 0.560 srgb} bind def
26 /col9 {0.000 0.000 0.690 srgb} bind def
27 /col10 {0.000 0.000 0.820 srgb} bind def
28 /col11 {0.530 0.810 1.000 srgb} bind def
29 /col12 {0.000 0.560 0.000 srgb} bind def
30 /col13 {0.000 0.690 0.000 srgb} bind def
31 /col14 {0.000 0.820 0.000 srgb} bind def
32 /col15 {0.000 0.560 0.560 srgb} bind def
33 /col16 {0.000 0.690 0.690 srgb} bind def
34 /col17 {0.000 0.820 0.820 srgb} bind def
35 /col18 {0.560 0.000 0.000 srgb} bind def
36 /col19 {0.690 0.000 0.000 srgb} bind def
37 /col20 {0.820 0.000 0.000 srgb} bind def
38 /col21 {0.560 0.000 0.560 srgb} bind def
39 /col22 {0.690 0.000 0.690 srgb} bind def
40 /col23 {0.820 0.000 0.820 srgb} bind def
41 /col24 {0.500 0.190 0.000 srgb} bind def
42 /col25 {0.630 0.250 0.000 srgb} bind def
43 /col26 {0.750 0.380 0.000 srgb} bind def
44 /col27 {1.000 0.500 0.500 srgb} bind def
45 /col28 {1.000 0.630 0.630 srgb} bind def
46 /col29 {1.000 0.750 0.750 srgb} bind def
47 /col30 {1.000 0.880 0.880 srgb} bind def
48 /col31 {1.000 0.840 0.000 srgb} bind def
49
50 end
51 save
52 86.0 734.5 translate
53 1 -1 scale
54
55 /cp {closepath} bind def
56 /ef {eofill} bind def
57 /gr {grestore} bind def
58 /gs {gsave} bind def
59 /sa {save} bind def
60 /rs {restore} bind def
61 /l {lineto} bind def
62 /m {moveto} bind def
63 /rm {rmoveto} bind def
64 /n {newpath} bind def
65 /s {stroke} bind def
66 /sh {show} bind def
67 /slc {setlinecap} bind def
68 /slj {setlinejoin} bind def
69 /slw {setlinewidth} bind def
70 /srgb {setrgbcolor} bind def
71 /rot {rotate} bind def
72 /sc {scale} bind def
73 /sd {setdash} bind def
74 /ff {findfont} bind def
75 /sf {setfont} bind def
76 /scf {scalefont} bind def
77 /sw {stringwidth} bind def
78 /tr {translate} bind def
79 /tnt {dup dup currentrgbcolor
80 4 -2 roll dup 1 exch sub 3 -1 roll mul add
81 4 -2 roll dup 1 exch sub 3 -1 roll mul add
82 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
83 bind def
84 /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
85 4 -2 roll mul srgb} bind def
86 /reencdict 12 dict def /ReEncode { reencdict begin
87 /newcodesandnames exch def /newfontname exch def /basefontname exch def
88 /basefontdict basefontname findfont def /newfont basefontdict maxlength dict def
89 basefontdict { exch dup /FID ne { dup /Encoding eq
90 { exch dup length array copy newfont 3 1 roll put }
91 { exch newfont 3 1 roll put } ifelse } { pop pop } ifelse } forall
92 newfont /FontName newfontname put newcodesandnames aload pop
93 128 1 255 { newfont /Encoding get exch /.notdef put } for
94 newcodesandnames length 2 idiv { newfont /Encoding get 3 1 roll put } repeat
95 newfontname newfont definefont pop end } def
96 /isovec [
97 8#200 /grave 8#201 /acute 8#202 /circumflex 8#203 /tilde
98 8#204 /macron 8#205 /breve 8#206 /dotaccent 8#207 /dieresis
99 8#210 /ring 8#211 /cedilla 8#212 /hungarumlaut 8#213 /ogonek 8#214 /caron
100 8#220 /dotlessi 8#230 /oe 8#231 /OE
101 8#240 /space 8#241 /exclamdown 8#242 /cent 8#243 /sterling
102 8#244 /currency 8#245 /yen 8#246 /brokenbar 8#247 /section 8#250 /dieresis
103 8#251 /copyright 8#252 /ordfeminine 8#253 /guillemotleft 8#254 /logicalnot
104 8#255 /endash 8#256 /registered 8#257 /macron 8#260 /degree 8#261 /plusminus
105 8#262 /twosuperior 8#263 /threesuperior 8#264 /acute 8#265 /mu 8#266 /paragraph
106 8#267 /periodcentered 8#270 /cedilla 8#271 /onesuperior 8#272 /ordmasculine
107 8#273 /guillemotright 8#274 /onequarter 8#275 /onehalf
108 8#276 /threequarters 8#277 /questiondown 8#300 /Agrave 8#301 /Aacute
109 8#302 /Acircumflex 8#303 /Atilde 8#304 /Adieresis 8#305 /Aring
110 8#306 /AE 8#307 /Ccedilla 8#310 /Egrave 8#311 /Eacute
111 8#312 /Ecircumflex 8#313 /Edieresis 8#314 /Igrave 8#315 /Iacute
112 8#316 /Icircumflex 8#317 /Idieresis 8#320 /Eth 8#321 /Ntilde 8#322 /Ograve
113 8#323 /Oacute 8#324 /Ocircumflex 8#325 /Otilde 8#326 /Odieresis 8#327 /multiply
114 8#330 /Oslash 8#331 /Ugrave 8#332 /Uacute 8#333 /Ucircumflex
115 8#334 /Udieresis 8#335 /Yacute 8#336 /Thorn 8#337 /germandbls 8#340 /agrave
116 8#341 /aacute 8#342 /acircumflex 8#343 /atilde 8#344 /adieresis 8#345 /aring
117 8#346 /ae 8#347 /ccedilla 8#350 /egrave 8#351 /eacute
118 8#352 /ecircumflex 8#353 /edieresis 8#354 /igrave 8#355 /iacute
119 8#356 /icircumflex 8#357 /idieresis 8#360 /eth 8#361 /ntilde 8#362 /ograve
120 8#363 /oacute 8#364 /ocircumflex 8#365 /otilde 8#366 /odieresis 8#367 /divide
121 8#370 /oslash 8#371 /ugrave 8#372 /uacute 8#373 /ucircumflex
122 8#374 /udieresis 8#375 /yacute 8#376 /thorn 8#377 /ydieresis] def
123 /Times-Roman /Times-Roman-iso isovec ReEncode
124 /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
125 /$F2psEnd {$F2psEnteredState restore end} def
126 %%EndProlog
127
128 $F2psBegin
129 10 setmiterlimit
130 n -1000 10312 m -1000 -1000 l 7000 -1000 l 7000 10312 l cp clip
131 0.06000 0.06000 sc
132 %%Page: 1 1
133 % Polyline
134 7.500 slw
135 n 3100 1250 m 3200 1250 l gs col0 s gr
136 % Polyline
137 n 3100 1300 m 3200 1300 l gs col0 s gr
138 % Polyline
139 n 3100 1350 m 3200 1350 l gs col0 s gr
140 % Polyline
141 n 3100 1450 m 3200 1450 l gs col0 s gr
142 % Polyline
143 n 3100 1500 m 3200 1500 l gs col0 s gr
144 % Polyline
145 n 3100 1550 m 3200 1550 l gs col0 s gr
146 % Polyline
147 n 3100 1650 m 3200 1650 l gs col0 s gr
148 % Polyline
149 n 3100 1700 m 3200 1700 l gs col0 s gr
150 % Polyline
151 n 3100 1750 m 3200 1750 l gs col0 s gr
152 % Polyline
153 n 3100 1850 m 3200 1850 l gs col0 s gr
154 % Polyline
155 n 3100 1900 m 3200 1900 l gs col0 s gr
156 % Polyline
157 n 3100 1950 m 3200 1950 l gs col0 s gr
158 % Polyline
159 n 3000 1200 m 3200 1200 l gs col0 s gr
160 % Polyline
161 n 3000 2000 m 3200 2000 l gs col0 s gr
162 % Polyline
163 n 3050 1400 m 3200 1400 l gs col0 s gr
164 % Polyline
165 n 3050 1600 m 3200 1600 l gs col0 s gr
166 % Polyline
167 n 3050 1800 m 3200 1800 l gs col0 s gr
168 % Polyline
169 n 3100 2050 m 3200 2050 l gs col0 s gr
170 % Polyline
171 n 3100 2100 m 3200 2100 l gs col0 s gr
172 % Polyline
173 n 3100 2150 m 3200 2150 l gs col0 s gr
174 % Polyline
175 n 3100 2250 m 3200 2250 l gs col0 s gr
176 % Polyline
177 n 3100 2300 m 3200 2300 l gs col0 s gr
178 % Polyline
179 n 3100 2350 m 3200 2350 l gs col0 s gr
180 % Polyline
181 n 3100 2450 m 3200 2450 l gs col0 s gr
182 % Polyline
183 n 3100 2500 m 3200 2500 l gs col0 s gr
184 % Polyline
185 n 3100 2550 m 3200 2550 l gs col0 s gr
186 % Polyline
187 n 3100 2650 m 3200 2650 l gs col0 s gr
188 % Polyline
189 n 3100 2700 m 3200 2700 l gs col0 s gr
190 % Polyline
191 n 3100 2750 m 3200 2750 l gs col0 s gr
192 % Polyline
193 n 3000 2000 m 3200 2000 l gs col0 s gr
194 % Polyline
195 n 3000 2800 m 3200 2800 l gs col0 s gr
196 % Polyline
197 n 3050 2200 m 3200 2200 l gs col0 s gr
198 % Polyline
199 n 3050 2400 m 3200 2400 l gs col0 s gr
200 % Polyline
201 n 3050 2600 m 3200 2600 l gs col0 s gr
202 % Polyline
203 n 3100 2850 m 3200 2850 l gs col0 s gr
204 % Polyline
205 n 3100 2900 m 3200 2900 l gs col0 s gr
206 % Polyline
207 n 3100 2950 m 3200 2950 l gs col0 s gr
208 % Polyline
209 n 3100 3050 m 3200 3050 l gs col0 s gr
210 % Polyline
211 n 3100 3100 m 3200 3100 l gs col0 s gr
212 % Polyline
213 n 3100 3150 m 3200 3150 l gs col0 s gr
214 % Polyline
215 n 3100 3250 m 3200 3250 l gs col0 s gr
216 % Polyline
217 n 3100 3300 m 3200 3300 l gs col0 s gr
218 % Polyline
219 n 3100 3350 m 3200 3350 l gs col0 s gr
220 % Polyline
221 n 3100 3450 m 3200 3450 l gs col0 s gr
222 % Polyline
223 n 3100 3500 m 3200 3500 l gs col0 s gr
224 % Polyline
225 n 3100 3550 m 3200 3550 l gs col0 s gr
226 % Polyline
227 n 3000 2800 m 3200 2800 l gs col0 s gr
228 % Polyline
229 n 3000 3600 m 3200 3600 l gs col0 s gr
230 % Polyline
231 n 3050 3000 m 3200 3000 l gs col0 s gr
232 % Polyline
233 n 3050 3200 m 3200 3200 l gs col0 s gr
234 % Polyline
235 n 3050 3400 m 3200 3400 l gs col0 s gr
236 % Polyline
237 n 3100 3650 m 3200 3650 l gs col0 s gr
238 % Polyline
239 n 3100 3700 m 3200 3700 l gs col0 s gr
240 % Polyline
241 n 3100 3750 m 3200 3750 l gs col0 s gr
242 % Polyline
243 n 3100 3850 m 3200 3850 l gs col0 s gr
244 % Polyline
245 n 3100 3900 m 3200 3900 l gs col0 s gr
246 % Polyline
247 n 3100 3950 m 3200 3950 l gs col0 s gr
248 % Polyline
249 n 3100 4050 m 3200 4050 l gs col0 s gr
250 % Polyline
251 n 3100 4100 m 3200 4100 l gs col0 s gr
252 % Polyline
253 n 3100 4150 m 3200 4150 l gs col0 s gr
254 % Polyline
255 n 3100 4250 m 3200 4250 l gs col0 s gr
256 % Polyline
257 n 3100 4300 m 3200 4300 l gs col0 s gr
258 % Polyline
259 n 3100 4350 m 3200 4350 l gs col0 s gr
260 % Polyline
261 n 3000 3600 m 3200 3600 l gs col0 s gr
262 % Polyline
263 n 3000 4400 m 3200 4400 l gs col0 s gr
264 % Polyline
265 n 3050 3800 m 3200 3800 l gs col0 s gr
266 % Polyline
267 n 3050 4000 m 3200 4000 l gs col0 s gr
268 % Polyline
269 n 3050 4200 m 3200 4200 l gs col0 s gr
270 % Polyline
271 n 3100 4450 m 3200 4450 l gs col0 s gr
272 % Polyline
273 n 3100 4500 m 3200 4500 l gs col0 s gr
274 % Polyline
275 n 3100 4550 m 3200 4550 l gs col0 s gr
276 % Polyline
277 n 3100 4650 m 3200 4650 l gs col0 s gr
278 % Polyline
279 n 3100 4700 m 3200 4700 l gs col0 s gr
280 % Polyline
281 n 3100 4750 m 3200 4750 l gs col0 s gr
282 % Polyline
283 n 3100 4850 m 3200 4850 l gs col0 s gr
284 % Polyline
285 n 3100 4900 m 3200 4900 l gs col0 s gr
286 % Polyline
287 n 3100 4950 m 3200 4950 l gs col0 s gr
288 % Polyline
289 n 3100 5050 m 3200 5050 l gs col0 s gr
290 % Polyline
291 n 3100 5100 m 3200 5100 l gs col0 s gr
292 % Polyline
293 n 3100 5150 m 3200 5150 l gs col0 s gr
294 % Polyline
295 n 3000 4400 m 3200 4400 l gs col0 s gr
296 % Polyline
297 n 3000 5200 m 3200 5200 l gs col0 s gr
298 % Polyline
299 n 3050 4600 m 3200 4600 l gs col0 s gr
300 % Polyline
301 n 3050 4800 m 3200 4800 l gs col0 s gr
302 % Polyline
303 n 3050 5000 m 3200 5000 l gs col0 s gr
304 % Polyline
305 n 3100 5250 m 3200 5250 l gs col0 s gr
306 % Polyline
307 n 3100 5300 m 3200 5300 l gs col0 s gr
308 % Polyline
309 n 3100 5350 m 3200 5350 l gs col0 s gr
310 % Polyline
311 n 3100 5450 m 3200 5450 l gs col0 s gr
312 % Polyline
313 n 3100 5500 m 3200 5500 l gs col0 s gr
314 % Polyline
315 n 3100 5550 m 3200 5550 l gs col0 s gr
316 % Polyline
317 n 3100 5650 m 3200 5650 l gs col0 s gr
318 % Polyline
319 n 3100 5700 m 3200 5700 l gs col0 s gr
320 % Polyline
321 n 3100 5750 m 3200 5750 l gs col0 s gr
322 % Polyline
323 n 3100 5850 m 3200 5850 l gs col0 s gr
324 % Polyline
325 n 3100 5900 m 3200 5900 l gs col0 s gr
326 % Polyline
327 n 3100 5950 m 3200 5950 l gs col0 s gr
328 % Polyline
329 n 3000 5200 m 3200 5200 l gs col0 s gr
330 % Polyline
331 n 3000 6000 m 3200 6000 l gs col0 s gr
332 % Polyline
333 n 3050 5400 m 3200 5400 l gs col0 s gr
334 % Polyline
335 n 3050 5600 m 3200 5600 l gs col0 s gr
336 % Polyline
337 n 3050 5800 m 3200 5800 l gs col0 s gr
338 % Polyline
339 n 3111 1200 m 3200 1200 l 3200 6000 l 3111 6000 l gs col0 s gr
340 % Polyline
341 n 5021 3651 m 4948 3651 l gs col4 s gr
342 % Polyline
343 n 5021 3602 m 4948 3602 l gs col4 s gr
344 % Polyline
345 n 5021 3553 m 4948 3553 l gs col4 s gr
346 % Polyline
347 n 5021 3502 m 4948 3502 l gs col4 s gr
348 % Polyline
349 n 5021 3402 m 4948 3402 l gs col4 s gr
350 % Polyline
351 n 5021 3353 m 4948 3353 l gs col4 s gr
352 % Polyline
353 n 5021 3304 m 4948 3304 l gs col4 s gr
354 % Polyline
355 n 5021 3252 m 4948 3252 l gs col4 s gr
356 % Polyline
357 n 5021 3153 m 4948 3153 l gs col4 s gr
358 % Polyline
359 n 5021 3105 m 4948 3105 l gs col4 s gr
360 % Polyline
361 n 5021 3055 m 4948 3055 l gs col4 s gr
362 % Polyline
363 n 5021 3002 m 4948 3002 l gs col4 s gr
364 % Polyline
365 n 5021 3902 m 4948 3902 l gs col4 s gr
366 % Polyline
367 n 5021 3849 m 4948 3849 l gs col4 s gr
368 % Polyline
369 n 5021 3798 m 4948 3798 l gs col4 s gr
370 % Polyline
371 n 5021 3749 m 4948 3749 l gs col4 s gr
372 % Polyline
373 n 5021 4152 m 4948 4152 l gs col4 s gr
374 % Polyline
375 n 5021 4102 m 4948 4102 l gs col4 s gr
376 % Polyline
377 n 5021 4049 m 4948 4049 l gs col4 s gr
378 % Polyline
379 n 5021 4000 m 4948 4000 l gs col4 s gr
380 % Polyline
381 n 5045 3951 m 4948 3951 l gs col4 s gr
382 % Polyline
383 n 5045 3702 m 4948 3702 l gs col4 s gr
384 % Polyline
385 n 5045 3453 m 4948 3453 l gs col4 s gr
386 % Polyline
387 n 5045 3202 m 4948 3202 l gs col4 s gr
388 % Polyline
389 n 5045 2950 m 4948 2950 l 4948 4200 l 5045 4200 l gs col4 s gr
390 % Polyline
391 n 4824 3674 m 4894 3674 l gs col0 s gr
392 % Polyline
393 n 4824 3624 m 4894 3624 l gs col0 s gr
394 % Polyline
395 n 4824 3577 m 4894 3577 l gs col0 s gr
396 % Polyline
397 n 4824 3529 m 4894 3529 l gs col0 s gr
398 % Polyline
399 n 4824 3432 m 4894 3432 l gs col0 s gr
400 % Polyline
401 n 4824 3385 m 4894 3385 l gs col0 s gr
402 % Polyline
403 n 4824 3338 m 4894 3338 l gs col0 s gr
404 % Polyline
405 n 4824 3288 m 4894 3288 l gs col0 s gr
406 % Polyline
407 n 4824 3193 m 4894 3193 l gs col0 s gr
408 % Polyline
409 n 4824 3147 m 4894 3147 l gs col0 s gr
410 % Polyline
411 n 4824 3098 m 4894 3098 l gs col0 s gr
412 % Polyline
413 n 4824 3051 m 4894 3051 l gs col0 s gr
414 % Polyline
415 n 4824 3913 m 4894 3913 l gs col0 s gr
416 % Polyline
417 n 4824 3863 m 4894 3863 l gs col0 s gr
418 % Polyline
419 n 4824 3815 m 4894 3815 l gs col0 s gr
420 % Polyline
421 n 4824 3766 m 4894 3766 l gs col0 s gr
422 % Polyline
423 n 4824 4154 m 4894 4154 l gs col0 s gr
424 % Polyline
425 n 4824 4106 m 4894 4106 l gs col0 s gr
426 % Polyline
427 n 4824 4055 m 4894 4055 l gs col0 s gr
428 % Polyline
429 n 4824 4008 m 4894 4008 l gs col0 s gr
430 % Polyline
431 n 4801 3960 m 4894 3960 l gs col0 s gr
432 % Polyline
433 n 4801 3721 m 4894 3721 l gs col0 s gr
434 % Polyline
435 n 4801 3482 m 4894 3482 l gs col0 s gr
436 % Polyline
437 n 4801 3242 m 4894 3242 l gs col0 s gr
438 % Polyline
439 n 4801 2998 m 4894 2998 l 4894 4200 l 4801 4200 l gs col0 s gr
440 % Polyline
441 n 2100 3600 m 2850 3600 l gs col1 s gr
442 % Polyline
443 n 3300 3600 m 4050 3600 l gs col14 s gr
444 /Times-Roman-iso ff 180.00 scf sf
445 2925 3675 m
446 gs 1 -1 sc (0) dup sw pop neg 0 rm col0 sh gr
447 /Times-Roman-iso ff 180.00 scf sf
448 2925 2925 m
449 gs 1 -1 sc (-400) dup sw pop neg 0 rm col0 sh gr
450 /Times-Roman-iso ff 180.00 scf sf
451 2925 2100 m
452 gs 1 -1 sc (-800) dup sw pop neg 0 rm col0 sh gr
453 /Times-Roman-iso ff 180.00 scf sf
454 2925 1275 m
455 gs 1 -1 sc (-1200) dup sw pop neg 0 rm col0 sh gr
456 /Times-Roman-iso ff 180.00 scf sf
457 2925 4500 m
458 gs 1 -1 sc (400) dup sw pop neg 0 rm col0 sh gr
459 /Times-Roman-iso ff 180.00 scf sf
460 2925 5325 m
461 gs 1 -1 sc (800) dup sw pop neg 0 rm col0 sh gr
462 /Times-Roman-iso ff 180.00 scf sf
463 2925 6075 m
464 gs 1 -1 sc (1200) dup sw pop neg 0 rm col0 sh gr
465 /Times-Roman-iso ff 180.00 scf sf
466 4737 4286 m
467 gs 1 -1 sc (0) dup sw pop neg 0 rm col0 sh gr
468 /Times-Roman-iso ff 180.00 scf sf
469 4730 4039 m
470 gs 1 -1 sc (5) dup sw pop neg 0 rm col0 sh gr
471 /Times-Roman-iso ff 180.00 scf sf
472 4745 3836 m
473 gs 1 -1 sc (10) dup sw pop neg 0 rm col0 sh gr
474 /Times-Roman-iso ff 180.00 scf sf
475 4737 3574 m
476 gs 1 -1 sc (15) dup sw pop neg 0 rm col0 sh gr
477 /Times-Roman-iso ff 180.00 scf sf
478 4730 3334 m
479 gs 1 -1 sc (20) dup sw pop neg 0 rm col0 sh gr
480 /Times-Roman-iso ff 180.00 scf sf
481 4707 3094 m
482 gs 1 -1 sc (25) dup sw pop neg 0 rm col0 sh gr
483 % Polyline
484 n 1175 8300 m 1175 8200 l gs col0 s gr
485 % Polyline
486 n 1225 8300 m 1225 8200 l gs col0 s gr
487 % Polyline
488 n 1275 8300 m 1275 8200 l gs col0 s gr
489 % Polyline
490 n 1375 8300 m 1375 8200 l gs col0 s gr
491 % Polyline
492 n 1425 8300 m 1425 8200 l gs col0 s gr
493 % Polyline
494 n 1475 8300 m 1475 8200 l gs col0 s gr
495 % Polyline
496 n 1575 8300 m 1575 8200 l gs col0 s gr
497 % Polyline
498 n 1625 8300 m 1625 8200 l gs col0 s gr
499 % Polyline
500 n 1675 8300 m 1675 8200 l gs col0 s gr
501 % Polyline
502 n 1775 8300 m 1775 8200 l gs col0 s gr
503 % Polyline
504 n 1825 8300 m 1825 8200 l gs col0 s gr
505 % Polyline
506 n 1875 8300 m 1875 8200 l gs col0 s gr
507 % Polyline
508 n 1125 8400 m 1125 8200 l gs col0 s gr
509 % Polyline
510 n 1925 8400 m 1925 8200 l gs col0 s gr
511 % Polyline
512 n 1325 8350 m 1325 8200 l gs col0 s gr
513 % Polyline
514 n 1525 8350 m 1525 8200 l gs col0 s gr
515 % Polyline
516 n 1725 8350 m 1725 8200 l gs col0 s gr
517 % Polyline
518 n 1975 8300 m 1975 8200 l gs col0 s gr
519 % Polyline
520 n 2025 8300 m 2025 8200 l gs col0 s gr
521 % Polyline
522 n 2075 8300 m 2075 8200 l gs col0 s gr
523 % Polyline
524 n 2175 8300 m 2175 8200 l gs col0 s gr
525 % Polyline
526 n 2225 8300 m 2225 8200 l gs col0 s gr
527 % Polyline
528 n 2275 8300 m 2275 8200 l gs col0 s gr
529 % Polyline
530 n 2375 8300 m 2375 8200 l gs col0 s gr
531 % Polyline
532 n 2425 8300 m 2425 8200 l gs col0 s gr
533 % Polyline
534 n 2475 8300 m 2475 8200 l gs col0 s gr
535 % Polyline
536 n 2575 8300 m 2575 8200 l gs col0 s gr
537 % Polyline
538 n 2625 8300 m 2625 8200 l gs col0 s gr
539 % Polyline
540 n 2675 8300 m 2675 8200 l gs col0 s gr
541 % Polyline
542 n 1925 8400 m 1925 8200 l gs col0 s gr
543 % Polyline
544 n 2725 8400 m 2725 8200 l gs col0 s gr
545 % Polyline
546 n 2125 8350 m 2125 8200 l gs col0 s gr
547 % Polyline
548 n 2325 8350 m 2325 8200 l gs col0 s gr
549 % Polyline
550 n 2525 8350 m 2525 8200 l gs col0 s gr
551 % Polyline
552 n 2775 8300 m 2775 8200 l gs col0 s gr
553 % Polyline
554 n 2825 8300 m 2825 8200 l gs col0 s gr
555 % Polyline
556 n 2875 8300 m 2875 8200 l gs col0 s gr
557 % Polyline
558 n 2975 8300 m 2975 8200 l gs col0 s gr
559 % Polyline
560 n 3025 8300 m 3025 8200 l gs col0 s gr
561 % Polyline
562 n 3075 8300 m 3075 8200 l gs col0 s gr
563 % Polyline
564 n 3175 8300 m 3175 8200 l gs col0 s gr
565 % Polyline
566 n 3225 8300 m 3225 8200 l gs col0 s gr
567 % Polyline
568 n 3275 8300 m 3275 8200 l gs col0 s gr
569 % Polyline
570 n 3375 8300 m 3375 8200 l gs col0 s gr
571 % Polyline
572 n 3425 8300 m 3425 8200 l gs col0 s gr
573 % Polyline
574 n 3475 8300 m 3475 8200 l gs col0 s gr
575 % Polyline
576 n 2725 8400 m 2725 8200 l gs col0 s gr
577 % Polyline
578 n 3525 8400 m 3525 8200 l gs col0 s gr
579 % Polyline
580 n 2925 8350 m 2925 8200 l gs col0 s gr
581 % Polyline
582 n 3125 8350 m 3125 8200 l gs col0 s gr
583 % Polyline
584 n 3325 8350 m 3325 8200 l gs col0 s gr
585 % Polyline
586 n 3575 8300 m 3575 8200 l gs col0 s gr
587 % Polyline
588 n 3625 8300 m 3625 8200 l gs col0 s gr
589 % Polyline
590 n 3675 8300 m 3675 8200 l gs col0 s gr
591 % Polyline
592 n 3775 8300 m 3775 8200 l gs col0 s gr
593 % Polyline
594 n 3825 8300 m 3825 8200 l gs col0 s gr
595 % Polyline
596 n 3875 8300 m 3875 8200 l gs col0 s gr
597 % Polyline
598 n 3975 8300 m 3975 8200 l gs col0 s gr
599 % Polyline
600 n 4025 8300 m 4025 8200 l gs col0 s gr
601 % Polyline
602 n 4075 8300 m 4075 8200 l gs col0 s gr
603 % Polyline
604 n 4175 8300 m 4175 8200 l gs col0 s gr
605 % Polyline
606 n 4225 8300 m 4225 8200 l gs col0 s gr
607 % Polyline
608 n 4275 8300 m 4275 8200 l gs col0 s gr
609 % Polyline
610 n 3525 8400 m 3525 8200 l gs col0 s gr
611 % Polyline
612 n 4325 8400 m 4325 8200 l gs col0 s gr
613 % Polyline
614 n 3725 8350 m 3725 8200 l gs col0 s gr
615 % Polyline
616 n 3925 8350 m 3925 8200 l gs col0 s gr
617 % Polyline
618 n 4125 8350 m 4125 8200 l gs col0 s gr
619 % Polyline
620 n 4375 8300 m 4375 8200 l gs col0 s gr
621 % Polyline
622 n 4425 8300 m 4425 8200 l gs col0 s gr
623 % Polyline
624 n 4475 8300 m 4475 8200 l gs col0 s gr
625 % Polyline
626 n 4575 8300 m 4575 8200 l gs col0 s gr
627 % Polyline
628 n 4625 8300 m 4625 8200 l gs col0 s gr
629 % Polyline
630 n 4675 8300 m 4675 8200 l gs col0 s gr
631 % Polyline
632 n 4775 8300 m 4775 8200 l gs col0 s gr
633 % Polyline
634 n 4825 8300 m 4825 8200 l gs col0 s gr
635 % Polyline
636 n 4875 8300 m 4875 8200 l gs col0 s gr
637 % Polyline
638 n 4975 8300 m 4975 8200 l gs col0 s gr
639 % Polyline
640 n 5025 8300 m 5025 8200 l gs col0 s gr
641 % Polyline
642 n 5075 8300 m 5075 8200 l gs col0 s gr
643 % Polyline
644 n 4325 8400 m 4325 8200 l gs col0 s gr
645 % Polyline
646 n 5125 8400 m 5125 8200 l gs col0 s gr
647 % Polyline
648 n 4525 8350 m 4525 8200 l gs col0 s gr
649 % Polyline
650 n 4725 8350 m 4725 8200 l gs col0 s gr
651 % Polyline
652 n 4925 8350 m 4925 8200 l gs col0 s gr
653 % Polyline
654 n 5175 8300 m 5175 8200 l gs col0 s gr
655 % Polyline
656 n 5225 8300 m 5225 8200 l gs col0 s gr
657 % Polyline
658 n 5275 8300 m 5275 8200 l gs col0 s gr
659 % Polyline
660 n 5375 8300 m 5375 8200 l gs col0 s gr
661 % Polyline
662 n 5425 8300 m 5425 8200 l gs col0 s gr
663 % Polyline
664 n 5475 8300 m 5475 8200 l gs col0 s gr
665 % Polyline
666 n 5575 8300 m 5575 8200 l gs col0 s gr
667 % Polyline
668 n 5625 8300 m 5625 8200 l gs col0 s gr
669 % Polyline
670 n 5675 8300 m 5675 8200 l gs col0 s gr
671 % Polyline
672 n 5775 8300 m 5775 8200 l gs col0 s gr
673 % Polyline
674 n 5825 8300 m 5825 8200 l gs col0 s gr
675 % Polyline
676 n 5875 8300 m 5875 8200 l gs col0 s gr
677 % Polyline
678 n 5125 8400 m 5125 8200 l gs col0 s gr
679 % Polyline
680 n 5925 8400 m 5925 8200 l gs col0 s gr
681 % Polyline
682 n 5325 8350 m 5325 8200 l gs col0 s gr
683 % Polyline
684 n 5525 8350 m 5525 8200 l gs col0 s gr
685 % Polyline
686 n 5725 8350 m 5725 8200 l gs col0 s gr
687 % Polyline
688 n 1125 8289 m 1125 8200 l 5925 8200 l 5925 8289 l gs col0 s gr
689 % Polyline
690 n 3576 6379 m 3576 6452 l gs col4 s gr
691 % Polyline
692 n 3527 6379 m 3527 6452 l gs col4 s gr
693 % Polyline
694 n 3478 6379 m 3478 6452 l gs col4 s gr
695 % Polyline
696 n 3427 6379 m 3427 6452 l gs col4 s gr
697 % Polyline
698 n 3327 6379 m 3327 6452 l gs col4 s gr
699 % Polyline
700 n 3278 6379 m 3278 6452 l gs col4 s gr
701 % Polyline
702 n 3229 6379 m 3229 6452 l gs col4 s gr
703 % Polyline
704 n 3177 6379 m 3177 6452 l gs col4 s gr
705 % Polyline
706 n 3078 6379 m 3078 6452 l gs col4 s gr
707 % Polyline
708 n 3030 6379 m 3030 6452 l gs col4 s gr
709 % Polyline
710 n 2980 6379 m 2980 6452 l gs col4 s gr
711 % Polyline
712 n 2927 6379 m 2927 6452 l gs col4 s gr
713 % Polyline
714 n 3827 6379 m 3827 6452 l gs col4 s gr
715 % Polyline
716 n 3774 6379 m 3774 6452 l gs col4 s gr
717 % Polyline
718 n 3723 6379 m 3723 6452 l gs col4 s gr
719 % Polyline
720 n 3674 6379 m 3674 6452 l gs col4 s gr
721 % Polyline
722 n 4077 6379 m 4077 6452 l gs col4 s gr
723 % Polyline
724 n 4027 6379 m 4027 6452 l gs col4 s gr
725 % Polyline
726 n 3974 6379 m 3974 6452 l gs col4 s gr
727 % Polyline
728 n 3925 6379 m 3925 6452 l gs col4 s gr
729 % Polyline
730 n 3876 6355 m 3876 6452 l gs col4 s gr
731 % Polyline
732 n 3627 6355 m 3627 6452 l gs col4 s gr
733 % Polyline
734 n 3378 6355 m 3378 6452 l gs col4 s gr
735 % Polyline
736 n 3127 6355 m 3127 6452 l gs col4 s gr
737 % Polyline
738 n 2875 6355 m 2875 6452 l 4125 6452 l 4125 6355 l gs col4 s gr
739 % Polyline
740 n 3599 6576 m 3599 6506 l gs col0 s gr
741 % Polyline
742 n 3549 6576 m 3549 6506 l gs col0 s gr
743 % Polyline
744 n 3502 6576 m 3502 6506 l gs col0 s gr
745 % Polyline
746 n 3454 6576 m 3454 6506 l gs col0 s gr
747 % Polyline
748 n 3357 6576 m 3357 6506 l gs col0 s gr
749 % Polyline
750 n 3310 6576 m 3310 6506 l gs col0 s gr
751 % Polyline
752 n 3263 6576 m 3263 6506 l gs col0 s gr
753 % Polyline
754 n 3213 6576 m 3213 6506 l gs col0 s gr
755 % Polyline
756 n 3118 6576 m 3118 6506 l gs col0 s gr
757 % Polyline
758 n 3072 6576 m 3072 6506 l gs col0 s gr
759 % Polyline
760 n 3023 6576 m 3023 6506 l gs col0 s gr
761 % Polyline
762 n 2976 6576 m 2976 6506 l gs col0 s gr
763 % Polyline
764 n 3838 6576 m 3838 6506 l gs col0 s gr
765 % Polyline
766 n 3788 6576 m 3788 6506 l gs col0 s gr
767 % Polyline
768 n 3740 6576 m 3740 6506 l gs col0 s gr
769 % Polyline
770 n 3691 6576 m 3691 6506 l gs col0 s gr
771 % Polyline
772 n 4079 6576 m 4079 6506 l gs col0 s gr
773 % Polyline
774 n 4031 6576 m 4031 6506 l gs col0 s gr
775 % Polyline
776 n 3980 6576 m 3980 6506 l gs col0 s gr
777 % Polyline
778 n 3933 6576 m 3933 6506 l gs col0 s gr
779 % Polyline
780 n 3885 6599 m 3885 6506 l gs col0 s gr
781 % Polyline
782 n 3646 6599 m 3646 6506 l gs col0 s gr
783 % Polyline
784 n 3407 6599 m 3407 6506 l gs col0 s gr
785 % Polyline
786 n 3167 6599 m 3167 6506 l gs col0 s gr
787 % Polyline
788 n 2923 6599 m 2923 6506 l 4125 6506 l 4125 6599 l gs col0 s gr
789 % Polyline
790 n 3525 9300 m 3525 8550 l gs col1 s gr
791 % Polyline
792 n 3525 8100 m 3525 7350 l gs col14 s gr
793 /Times-Roman-iso ff 180.00 scf sf
794 3600 8475 m
795 gs 1 -1 sc 90.0 rot (0) dup sw pop neg 0 rm col0 sh gr
796 /Times-Roman-iso ff 180.00 scf sf
797 2850 8475 m
798 gs 1 -1 sc 90.0 rot (-400) dup sw pop neg 0 rm col0 sh gr
799 /Times-Roman-iso ff 180.00 scf sf
800 2025 8475 m
801 gs 1 -1 sc 90.0 rot (-800) dup sw pop neg 0 rm col0 sh gr
802 /Times-Roman-iso ff 180.00 scf sf
803 1200 8475 m
804 gs 1 -1 sc 90.0 rot (-1200) dup sw pop neg 0 rm col0 sh gr
805 /Times-Roman-iso ff 180.00 scf sf
806 4425 8475 m
807 gs 1 -1 sc 90.0 rot (400) dup sw pop neg 0 rm col0 sh gr
808 /Times-Roman-iso ff 180.00 scf sf
809 5250 8475 m
810 gs 1 -1 sc 90.0 rot (800) dup sw pop neg 0 rm col0 sh gr
811 /Times-Roman-iso ff 180.00 scf sf
812 6000 8475 m
813 gs 1 -1 sc 90.0 rot (1200) dup sw pop neg 0 rm col0 sh gr
814 /Times-Roman-iso ff 180.00 scf sf
815 4211 6663 m
816 gs 1 -1 sc 90.0 rot (0) dup sw pop neg 0 rm col0 sh gr
817 /Times-Roman-iso ff 180.00 scf sf
818 3964 6670 m
819 gs 1 -1 sc 90.0 rot (5) dup sw pop neg 0 rm col0 sh gr
820 /Times-Roman-iso ff 180.00 scf sf
821 3761 6655 m
822 gs 1 -1 sc 90.0 rot (10) dup sw pop neg 0 rm col0 sh gr
823 /Times-Roman-iso ff 180.00 scf sf
824 3499 6663 m
825 gs 1 -1 sc 90.0 rot (15) dup sw pop neg 0 rm col0 sh gr
826 /Times-Roman-iso ff 180.00 scf sf
827 3259 6670 m
828 gs 1 -1 sc 90.0 rot (20) dup sw pop neg 0 rm col0 sh gr
829 /Times-Roman-iso ff 180.00 scf sf
830 3019 6693 m
831 gs 1 -1 sc 90.0 rot (25) dup sw pop neg 0 rm col0 sh gr
832 % Polyline
833 n 1200 1200 m 2400 1200 l 2400 2400 l 1200 2400 l cp gs col0 s gr
834 % Polyline
835 n 1350 1350 m 2250 1350 l 2250 2250 l 1350 2250 l cp gs col4 s gr
836 % Polyline
837 n 1500 1500 m 2100 1500 l 2100 2100 l 1500 2100 l cp gs col2 s gr
838 % Polyline
839 n 1650 1650 m 1950 1650 l 1950 1950 l 1650 1950 l cp gs col1 s gr
840 % Polyline
841 n 1200 1200 m 2400 2400 l gs col0 s gr
842 % Polyline
843 n 1200 2400 m 2400 1200 l gs col6 s gr
844 $F2psEnd
845 rs
846 showpage
0 %!PS-Adobe-2.0
1 %%Title: testpage-a4.fig
2 %%Creator: fig2dev Version 3.2.3 Patchlevel
3 %%CreationDate: Tue Jul 11 01:57:38 2000
4 %%For: root@desktop.localdomain (root)
5 %%Orientation: Portrait
6 %%Pages: 1
7 %%BoundingBox: 0 0 595 842
8 %%BeginSetup
9 %%IncludeFeature: *PageSize A4
10 %%EndSetup
11 %%Magnification: 1.0000
12 %%EndComments
13 /$F2psDict 200 dict def
14 $F2psDict begin
15 $F2psDict /mtrx matrix put
16 /col-1 {0 setgray} bind def
17 /col0 {0.000 0.000 0.000 srgb} bind def
18 /col1 {0.000 0.000 1.000 srgb} bind def
19 /col2 {0.000 1.000 0.000 srgb} bind def
20 /col3 {0.000 1.000 1.000 srgb} bind def
21 /col4 {1.000 0.000 0.000 srgb} bind def
22 /col5 {1.000 0.000 1.000 srgb} bind def
23 /col6 {1.000 1.000 0.000 srgb} bind def
24 /col7 {1.000 1.000 1.000 srgb} bind def
25 /col8 {0.000 0.000 0.560 srgb} bind def
26 /col9 {0.000 0.000 0.690 srgb} bind def
27 /col10 {0.000 0.000 0.820 srgb} bind def
28 /col11 {0.530 0.810 1.000 srgb} bind def
29 /col12 {0.000 0.560 0.000 srgb} bind def
30 /col13 {0.000 0.690 0.000 srgb} bind def
31 /col14 {0.000 0.820 0.000 srgb} bind def
32 /col15 {0.000 0.560 0.560 srgb} bind def
33 /col16 {0.000 0.690 0.690 srgb} bind def
34 /col17 {0.000 0.820 0.820 srgb} bind def
35 /col18 {0.560 0.000 0.000 srgb} bind def
36 /col19 {0.690 0.000 0.000 srgb} bind def
37 /col20 {0.820 0.000 0.000 srgb} bind def
38 /col21 {0.560 0.000 0.560 srgb} bind def
39 /col22 {0.690 0.000 0.690 srgb} bind def
40 /col23 {0.820 0.000 0.820 srgb} bind def
41 /col24 {0.500 0.190 0.000 srgb} bind def
42 /col25 {0.630 0.250 0.000 srgb} bind def
43 /col26 {0.750 0.380 0.000 srgb} bind def
44 /col27 {1.000 0.500 0.500 srgb} bind def
45 /col28 {1.000 0.630 0.630 srgb} bind def
46 /col29 {1.000 0.750 0.750 srgb} bind def
47 /col30 {1.000 0.880 0.880 srgb} bind def
48 /col31 {1.000 0.840 0.000 srgb} bind def
49
50 end
51 save
52 newpath 0 842 moveto 0 0 lineto 595 0 lineto 595 842 lineto closepath clip newpath
53 0.0 841.5 translate
54 1 -1 scale
55
56 /cp {closepath} bind def
57 /ef {eofill} bind def
58 /gr {grestore} bind def
59 /gs {gsave} bind def
60 /sa {save} bind def
61 /rs {restore} bind def
62 /l {lineto} bind def
63 /m {moveto} bind def
64 /rm {rmoveto} bind def
65 /n {newpath} bind def
66 /s {stroke} bind def
67 /sh {show} bind def
68 /slc {setlinecap} bind def
69 /slj {setlinejoin} bind def
70 /slw {setlinewidth} bind def
71 /srgb {setrgbcolor} bind def
72 /rot {rotate} bind def
73 /sc {scale} bind def
74 /sd {setdash} bind def
75 /ff {findfont} bind def
76 /sf {setfont} bind def
77 /scf {scalefont} bind def
78 /sw {stringwidth} bind def
79 /tr {translate} bind def
80 /tnt {dup dup currentrgbcolor
81 4 -2 roll dup 1 exch sub 3 -1 roll mul add
82 4 -2 roll dup 1 exch sub 3 -1 roll mul add
83 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
84 bind def
85 /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
86 4 -2 roll mul srgb} bind def
87 /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
88 /$F2psEnd {$F2psEnteredState restore end} def
89
90 $F2psBegin
91 %%Page: 1 1
92 10 setmiterlimit
93 0.06299 0.06299 sc
94 %%Page: 1 1
95 /Times-Bold ff 375.00 scf sf
96 2385 3285 m
97 gs 1 -1 sc (To adjust the offsets in the) col0 sh gr
98 /Times-Bold ff 375.00 scf sf
99 1800 4725 m
100 gs 1 -1 sc (change xoff and yoff until this page is) col0 sh gr
101 /Times-Bold ff 375.00 scf sf
102 1800 5400 m
103 gs 1 -1 sc (printed correctly centered on the paper.) col0 sh gr
104 /Times-Bold ff 375.00 scf sf
105 1800 4005 m
106 gs 1 -1 sc (/etc/pnm2ppa.conf configuration file,) col0 sh gr
107 % Polyline
108 7.500 slw
109 n 2250 7200 m 2869 7200 l 2869 7500 l 2250 7500 l
110 cp gs col10 1.00 shd ef gr gs col-1 s gr
111 % Polyline
112 n 3488 7200 m 4106 7200 l 4106 7500 l 3488 7500 l
113 cp gs col6 1.00 shd ef gr gs col-1 s gr
114 % Polyline
115 n 4106 7200 m 4725 7200 l 4725 7500 l 4106 7500 l
116 cp gs col5 1.00 shd ef gr gs col-1 s gr
117 % Polyline
118 n 4725 7200 m 5344 7200 l 5344 7500 l 4725 7500 l
119 cp gs col26 1.00 shd ef gr gs col-1 s gr
120 % Polyline
121 n 5344 7200 m 5963 7200 l 5963 7500 l 5344 7500 l
122 cp gs col31 1.00 shd ef gr gs col-1 s gr
123 % Polyline
124 n 5963 7200 m 6581 7200 l 6581 7500 l 5963 7500 l
125 cp gs col3 1.00 shd ef gr gs col-1 s gr
126 % Polyline
127 n 2869 7200 m 3488 7200 l 3488 7500 l 2869 7500 l
128 cp gs col20 1.00 shd ef gr gs col-1 s gr
129 % Polyline
130 n 6581 7200 m 7200 7200 l 7200 7500 l 6581 7500 l
131 cp gs col2 1.00 shd ef gr gs col-1 s gr
132 /Helvetica-Bold ff 150.00 scf sf
133 5034 7800 m
134 gs 1 -1 sc (Brown) dup sw pop 2 div neg 0 rm col-1 sh gr
135 /Helvetica-Bold ff 150.00 scf sf
136 5653 7800 m
137 gs 1 -1 sc (Gold) dup sw pop 2 div neg 0 rm col-1 sh gr
138 /Helvetica-Bold ff 150.00 scf sf
139 6891 7800 m
140 gs 1 -1 sc (Green) dup sw pop 2 div neg 0 rm col-1 sh gr
141 /Helvetica-Bold ff 150.00 scf sf
142 3797 7800 m
143 gs 1 -1 sc (Yellow) dup sw pop 2 div neg 0 rm col-1 sh gr
144 /Helvetica-Bold ff 150.00 scf sf
145 3178 7800 m
146 gs 1 -1 sc (Red) dup sw pop 2 div neg 0 rm col-1 sh gr
147 /Helvetica-Bold ff 150.00 scf sf
148 2559 7800 m
149 gs 1 -1 sc (Blue) dup sw pop 2 div neg 0 rm col-1 sh gr
150 /Helvetica-Bold ff 150.00 scf sf
151 4416 7800 m
152 gs 1 -1 sc (Purple) dup sw pop 2 div neg 0 rm col-1 sh gr
153 /Helvetica-Bold ff 150.00 scf sf
154 6272 7800 m
155 gs 1 -1 sc (Cyan) dup sw pop 2 div neg 0 rm col-1 sh gr
156 % Polyline
157 15.000 slw
158 n 450 450 m 9000 450 l 9000 12915 l 450 12915 l
159 cp gs col-1 s gr
160 % Polyline
161 n 900 900 m 8550 900 l 8550 12465 l 900 12465 l
162 cp gs col-1 s gr
163 /Times-Roman ff 180.00 scf sf
164 4725 1095 m
165 gs 1 -1 sc (2cm) dup sw pop 2 div neg 0 rm col-1 sh gr
166 /Times-Roman ff 180.00 scf sf
167 4725 12825 m
168 gs 1 -1 sc (1cm) dup sw pop 2 div neg 0 rm col-1 sh gr
169 /Times-Roman ff 180.00 scf sf
170 4725 12345 m
171 gs 1 -1 sc (2cm) dup sw pop 2 div neg 0 rm col-1 sh gr
172 /Times-Roman ff 180.00 scf sf
173 1110 7485 m
174 gs 1 -1 sc (2cm) dup sw pop 2 div neg 0 rm col-1 sh gr
175 /Times-Roman ff 180.00 scf sf
176 675 7485 m
177 gs 1 -1 sc (1cm) dup sw pop 2 div neg 0 rm col-1 sh gr
178 /Times-Roman ff 180.00 scf sf
179 8310 7485 m
180 gs 1 -1 sc (2cm) dup sw pop 2 div neg 0 rm col-1 sh gr
181 /Times-Roman ff 180.00 scf sf
182 8820 7485 m
183 gs 1 -1 sc (1cm) dup sw pop 2 div neg 0 rm col-1 sh gr
184 /Helvetica-Bold ff 270.00 scf sf
185 4725 6420 m
186 gs 1 -1 sc (Here are some other colors; they) dup sw pop 2 div neg 0 rm col-1 sh gr
187 /Helvetica-Bold ff 270.00 scf sf
188 4725 6765 m
189 gs 1 -1 sc (will appear as greys on a B&W printer...) dup sw pop 2 div neg 0 rm col-1 sh gr
190 /Helvetica-Bold ff 270.00 scf sf
191 4725 9225 m
192 gs 1 -1 sc (are spaced at 1cm and 2cm) dup sw pop 2 div neg 0 rm col-1 sh gr
193 /Helvetica-Bold ff 270.00 scf sf
194 4725 8880 m
195 gs 1 -1 sc (The boxes bordering this page) dup sw pop 2 div neg 0 rm col-1 sh gr
196 /Helvetica-Bold ff 270.00 scf sf
197 4725 9600 m
198 gs 1 -1 sc (from the sides of the paper.) dup sw pop 2 div neg 0 rm col-1 sh gr
199 /Helvetica-Bold ff 270.00 scf sf
200 4725 10500 m
201 gs 1 -1 sc (It is not unusual for the 1cm bottom margin) dup sw pop 2 div neg 0 rm col-1 sh gr
202 /Helvetica-Bold ff 270.00 scf sf
203 4725 10845 m
204 gs 1 -1 sc (not to show. Many printers cannot) dup sw pop 2 div neg 0 rm col-1 sh gr
205 /Helvetica-Bold ff 270.00 scf sf
206 4725 11190 m
207 gs 1 -1 sc (print that close to the bottom of the page.) dup sw pop 2 div neg 0 rm col-1 sh gr
208 /Helvetica-Bold ff 270.00 scf sf
209 4725 2445 m
210 gs 1 -1 sc (PostScript Test Page \(A4\)) dup sw pop 2 div neg 0 rm col-1 sh gr
211 /Times-Roman ff 180.00 scf sf
212 4725 630 m
213 gs 1 -1 sc (1cm) dup sw pop 2 div neg 0 rm col-1 sh gr
214 $F2psEnd
215 rs
216 showpage
0 %!PS-Adobe-2.0
1 %%Title: testpage.fig
2 %%Creator: fig2dev Version 3.2.3 Patchlevel
3 %%CreationDate: Tue Jul 11 01:57:38 2000
4 %%For: root@desktop.localdomain (root)
5 %%Orientation: Portrait
6 %%Pages: 1
7 %%BoundingBox: 0 0 612 792
8 %%BeginSetup
9 %%IncludeFeature: *PageSize Letter
10 %%EndSetup
11 %%Magnification: 1.0000
12 %%EndComments
13 /$F2psDict 200 dict def
14 $F2psDict begin
15 $F2psDict /mtrx matrix put
16 /col-1 {0 setgray} bind def
17 /col0 {0.000 0.000 0.000 srgb} bind def
18 /col1 {0.000 0.000 1.000 srgb} bind def
19 /col2 {0.000 1.000 0.000 srgb} bind def
20 /col3 {0.000 1.000 1.000 srgb} bind def
21 /col4 {1.000 0.000 0.000 srgb} bind def
22 /col5 {1.000 0.000 1.000 srgb} bind def
23 /col6 {1.000 1.000 0.000 srgb} bind def
24 /col7 {1.000 1.000 1.000 srgb} bind def
25 /col8 {0.000 0.000 0.560 srgb} bind def
26 /col9 {0.000 0.000 0.690 srgb} bind def
27 /col10 {0.000 0.000 0.820 srgb} bind def
28 /col11 {0.530 0.810 1.000 srgb} bind def
29 /col12 {0.000 0.560 0.000 srgb} bind def
30 /col13 {0.000 0.690 0.000 srgb} bind def
31 /col14 {0.000 0.820 0.000 srgb} bind def
32 /col15 {0.000 0.560 0.560 srgb} bind def
33 /col16 {0.000 0.690 0.690 srgb} bind def
34 /col17 {0.000 0.820 0.820 srgb} bind def
35 /col18 {0.560 0.000 0.000 srgb} bind def
36 /col19 {0.690 0.000 0.000 srgb} bind def
37 /col20 {0.820 0.000 0.000 srgb} bind def
38 /col21 {0.560 0.000 0.560 srgb} bind def
39 /col22 {0.690 0.000 0.690 srgb} bind def
40 /col23 {0.820 0.000 0.820 srgb} bind def
41 /col24 {0.500 0.190 0.000 srgb} bind def
42 /col25 {0.630 0.250 0.000 srgb} bind def
43 /col26 {0.750 0.380 0.000 srgb} bind def
44 /col27 {1.000 0.500 0.500 srgb} bind def
45 /col28 {1.000 0.630 0.630 srgb} bind def
46 /col29 {1.000 0.750 0.750 srgb} bind def
47 /col30 {1.000 0.880 0.880 srgb} bind def
48 /col31 {1.000 0.840 0.000 srgb} bind def
49
50 end
51 save
52 newpath 0 792 moveto 0 0 lineto 612 0 lineto 612 792 lineto closepath clip newpath
53 0.0 792.0 translate
54 1 -1 scale
55
56 /cp {closepath} bind def
57 /ef {eofill} bind def
58 /gr {grestore} bind def
59 /gs {gsave} bind def
60 /sa {save} bind def
61 /rs {restore} bind def
62 /l {lineto} bind def
63 /m {moveto} bind def
64 /rm {rmoveto} bind def
65 /n {newpath} bind def
66 /s {stroke} bind def
67 /sh {show} bind def
68 /slc {setlinecap} bind def
69 /slj {setlinejoin} bind def
70 /slw {setlinewidth} bind def
71 /srgb {setrgbcolor} bind def
72 /rot {rotate} bind def
73 /sc {scale} bind def
74 /sd {setdash} bind def
75 /ff {findfont} bind def
76 /sf {setfont} bind def
77 /scf {scalefont} bind def
78 /sw {stringwidth} bind def
79 /tr {translate} bind def
80 /tnt {dup dup currentrgbcolor
81 4 -2 roll dup 1 exch sub 3 -1 roll mul add
82 4 -2 roll dup 1 exch sub 3 -1 roll mul add
83 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
84 bind def
85 /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
86 4 -2 roll mul srgb} bind def
87 /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
88 /$F2psEnd {$F2psEnteredState restore end} def
89
90 $F2psBegin
91 %%Page: 1 1
92 10 setmiterlimit
93 0.06000 0.06000 sc
94 %%Page: 1 1
95 /Times-Bold ff 300.00 scf sf
96 2175 3075 m
97 gs 1 -1 sc (To adjust the offsets in the configuration file) col0 sh gr
98 /Times-Bold ff 300.00 scf sf
99 2175 3390 m
100 gs 1 -1 sc (/etc/pnm2ppa.conf, change the values of xoff) col0 sh gr
101 /Times-Bold ff 300.00 scf sf
102 2175 3705 m
103 gs 1 -1 sc (and yoff until this page is printed correctly ) col0 sh gr
104 /Times-Bold ff 300.00 scf sf
105 2175 4020 m
106 gs 1 -1 sc (centered on the paper.) col0 sh gr
107 % Polyline
108 7.500 slw
109 n 2400 7200 m 3000 7200 l 3000 7500 l 2400 7500 l
110 cp gs col10 1.00 shd ef gr gs col-1 s gr
111 % Polyline
112 n 3600 7200 m 4200 7200 l 4200 7500 l 3600 7500 l
113 cp gs col6 1.00 shd ef gr gs col-1 s gr
114 % Polyline
115 n 4200 7200 m 4800 7200 l 4800 7500 l 4200 7500 l
116 cp gs col5 1.00 shd ef gr gs col-1 s gr
117 % Polyline
118 n 4800 7200 m 5400 7200 l 5400 7500 l 4800 7500 l
119 cp gs col26 1.00 shd ef gr gs col-1 s gr
120 % Polyline
121 n 5400 7200 m 6000 7200 l 6000 7500 l 5400 7500 l
122 cp gs col31 1.00 shd ef gr gs col-1 s gr
123 % Polyline
124 n 6000 7200 m 6600 7200 l 6600 7500 l 6000 7500 l
125 cp gs col3 1.00 shd ef gr gs col-1 s gr
126 % Polyline
127 n 3000 7200 m 3600 7200 l 3600 7500 l 3000 7500 l
128 cp gs col20 1.00 shd ef gr gs col-1 s gr
129 % Polyline
130 n 6600 7200 m 7200 7200 l 7200 7500 l 6600 7500 l
131 cp gs col2 1.00 shd ef gr gs col-1 s gr
132 /Helvetica-Bold ff 150.00 scf sf
133 5100 7800 m
134 gs 1 -1 sc (Brown) dup sw pop 2 div neg 0 rm col-1 sh gr
135 /Helvetica-Bold ff 150.00 scf sf
136 5700 7800 m
137 gs 1 -1 sc (Gold) dup sw pop 2 div neg 0 rm col-1 sh gr
138 /Helvetica-Bold ff 150.00 scf sf
139 6900 7800 m
140 gs 1 -1 sc (Green) dup sw pop 2 div neg 0 rm col-1 sh gr
141 /Helvetica-Bold ff 150.00 scf sf
142 3900 7800 m
143 gs 1 -1 sc (Yellow) dup sw pop 2 div neg 0 rm col-1 sh gr
144 /Helvetica-Bold ff 150.00 scf sf
145 3300 7800 m
146 gs 1 -1 sc (Red) dup sw pop 2 div neg 0 rm col-1 sh gr
147 /Helvetica-Bold ff 150.00 scf sf
148 2700 7800 m
149 gs 1 -1 sc (Blue) dup sw pop 2 div neg 0 rm col-1 sh gr
150 /Helvetica-Bold ff 150.00 scf sf
151 4500 7800 m
152 gs 1 -1 sc (Purple) dup sw pop 2 div neg 0 rm col-1 sh gr
153 /Helvetica-Bold ff 150.00 scf sf
154 6300 7800 m
155 gs 1 -1 sc (Cyan) dup sw pop 2 div neg 0 rm col-1 sh gr
156 /Helvetica-Bold ff 270.00 scf sf
157 4800 2100 m
158 gs 1 -1 sc (Postscript Test Page \(US Letter paper\)) dup sw pop 2 div neg 0 rm col-1 sh gr
159 % Polyline
160 15.000 slw
161 n 600 600 m 9600 600 l 9600 12600 l 600 12600 l
162 cp gs col-1 s gr
163 % Polyline
164 n 1200 1200 m 9000 1200 l 9000 12000 l 1200 12000 l
165 cp gs col-1 s gr
166 /Times-Roman ff 180.00 scf sf
167 4800 12375 m
168 gs 1 -1 sc (0.5") col-1 sh gr
169 /Times-Roman ff 180.00 scf sf
170 4725 900 m
171 gs 1 -1 sc (0.5") col-1 sh gr
172 /Times-Roman ff 180.00 scf sf
173 4800 11850 m
174 gs 1 -1 sc (1") col-1 sh gr
175 /Times-Roman ff 180.00 scf sf
176 4800 1500 m
177 gs 1 -1 sc (1") col-1 sh gr
178 /Times-Roman ff 180.00 scf sf
179 750 7500 m
180 gs 1 -1 sc (0.5") col-1 sh gr
181 /Times-Roman ff 180.00 scf sf
182 1350 7500 m
183 gs 1 -1 sc (1") col-1 sh gr
184 /Times-Roman ff 180.00 scf sf
185 8700 7500 m
186 gs 1 -1 sc (1") col-1 sh gr
187 /Times-Roman ff 180.00 scf sf
188 9225 7500 m
189 gs 1 -1 sc (0.5") col-1 sh gr
190 /Helvetica-Bold ff 270.00 scf sf
191 4800 6420 m
192 gs 1 -1 sc (Here are some other colors; they) dup sw pop 2 div neg 0 rm col-1 sh gr
193 /Helvetica-Bold ff 270.00 scf sf
194 4800 6765 m
195 gs 1 -1 sc (will appear as greys on a B&W printer...) dup sw pop 2 div neg 0 rm col-1 sh gr
196 /Helvetica-Bold ff 270.00 scf sf
197 4800 9225 m
198 gs 1 -1 sc (are spaced at 0.5" and 1") dup sw pop 2 div neg 0 rm col-1 sh gr
199 /Helvetica-Bold ff 270.00 scf sf
200 4800 8880 m
201 gs 1 -1 sc (The boxes bordering this page) dup sw pop 2 div neg 0 rm col-1 sh gr
202 /Helvetica-Bold ff 270.00 scf sf
203 4800 9600 m
204 gs 1 -1 sc (from the sides of the paper.) dup sw pop 2 div neg 0 rm col-1 sh gr
205 /Helvetica-Bold ff 270.00 scf sf
206 4800 10500 m
207 gs 1 -1 sc (It is not unusual for the 0.5" bottom margin) dup sw pop 2 div neg 0 rm col-1 sh gr
208 /Helvetica-Bold ff 270.00 scf sf
209 4800 10845 m
210 gs 1 -1 sc (not to show. Many printers cannot) dup sw pop 2 div neg 0 rm col-1 sh gr
211 /Helvetica-Bold ff 270.00 scf sf
212 4800 11190 m
213 gs 1 -1 sc (print that close to the bottom of the page.) dup sw pop 2 div neg 0 rm col-1 sh gr
214 $F2psEnd
215 rs
216 showpage
0 #FIG 3.2
1 Portrait
2 Center
3 Inches
4 A4
5 100.00
6 Single
7 -2
8 1200 2
9 6 2100 1125 5100 6075
10 6 3000 1200 3200 6000
11 6 3000 1200 3200 2000
12 6 3100 1250 3200 1350
13 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
14 3100 1250 3200 1250
15 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
16 3100 1300 3200 1300
17 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
18 3100 1350 3200 1350
19 -6
20 6 3100 1450 3200 1550
21 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
22 3100 1450 3200 1450
23 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
24 3100 1500 3200 1500
25 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
26 3100 1550 3200 1550
27 -6
28 6 3100 1650 3200 1750
29 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
30 3100 1650 3200 1650
31 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
32 3100 1700 3200 1700
33 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
34 3100 1750 3200 1750
35 -6
36 6 3100 1850 3200 1950
37 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
38 3100 1850 3200 1850
39 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
40 3100 1900 3200 1900
41 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
42 3100 1950 3200 1950
43 -6
44 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
45 3000 1200 3200 1200
46 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
47 3000 2000 3200 2000
48 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
49 3050 1400 3200 1400
50 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
51 3050 1600 3200 1600
52 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
53 3050 1800 3200 1800
54 -6
55 6 3000 2000 3200 2800
56 6 3100 2050 3200 2150
57 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
58 3100 2050 3200 2050
59 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
60 3100 2100 3200 2100
61 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
62 3100 2150 3200 2150
63 -6
64 6 3100 2250 3200 2350
65 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
66 3100 2250 3200 2250
67 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
68 3100 2300 3200 2300
69 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
70 3100 2350 3200 2350
71 -6
72 6 3100 2450 3200 2550
73 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
74 3100 2450 3200 2450
75 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
76 3100 2500 3200 2500
77 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
78 3100 2550 3200 2550
79 -6
80 6 3100 2650 3200 2750
81 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
82 3100 2650 3200 2650
83 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
84 3100 2700 3200 2700
85 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
86 3100 2750 3200 2750
87 -6
88 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
89 3000 2000 3200 2000
90 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
91 3000 2800 3200 2800
92 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
93 3050 2200 3200 2200
94 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
95 3050 2400 3200 2400
96 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
97 3050 2600 3200 2600
98 -6
99 6 3000 2800 3200 3600
100 6 3100 2850 3200 2950
101 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
102 3100 2850 3200 2850
103 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
104 3100 2900 3200 2900
105 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
106 3100 2950 3200 2950
107 -6
108 6 3100 3050 3200 3150
109 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
110 3100 3050 3200 3050
111 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
112 3100 3100 3200 3100
113 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
114 3100 3150 3200 3150
115 -6
116 6 3100 3250 3200 3350
117 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
118 3100 3250 3200 3250
119 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
120 3100 3300 3200 3300
121 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
122 3100 3350 3200 3350
123 -6
124 6 3100 3450 3200 3550
125 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
126 3100 3450 3200 3450
127 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
128 3100 3500 3200 3500
129 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
130 3100 3550 3200 3550
131 -6
132 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
133 3000 2800 3200 2800
134 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
135 3000 3600 3200 3600
136 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
137 3050 3000 3200 3000
138 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
139 3050 3200 3200 3200
140 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
141 3050 3400 3200 3400
142 -6
143 6 3000 3600 3200 4400
144 6 3100 3650 3200 3750
145 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
146 3100 3650 3200 3650
147 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
148 3100 3700 3200 3700
149 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
150 3100 3750 3200 3750
151 -6
152 6 3100 3850 3200 3950
153 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
154 3100 3850 3200 3850
155 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
156 3100 3900 3200 3900
157 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
158 3100 3950 3200 3950
159 -6
160 6 3100 4050 3200 4150
161 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
162 3100 4050 3200 4050
163 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
164 3100 4100 3200 4100
165 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
166 3100 4150 3200 4150
167 -6
168 6 3100 4250 3200 4350
169 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
170 3100 4250 3200 4250
171 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
172 3100 4300 3200 4300
173 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
174 3100 4350 3200 4350
175 -6
176 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
177 3000 3600 3200 3600
178 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
179 3000 4400 3200 4400
180 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
181 3050 3800 3200 3800
182 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
183 3050 4000 3200 4000
184 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
185 3050 4200 3200 4200
186 -6
187 6 3000 4400 3200 5200
188 6 3100 4450 3200 4550
189 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
190 3100 4450 3200 4450
191 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
192 3100 4500 3200 4500
193 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
194 3100 4550 3200 4550
195 -6
196 6 3100 4650 3200 4750
197 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
198 3100 4650 3200 4650
199 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
200 3100 4700 3200 4700
201 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
202 3100 4750 3200 4750
203 -6
204 6 3100 4850 3200 4950
205 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
206 3100 4850 3200 4850
207 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
208 3100 4900 3200 4900
209 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
210 3100 4950 3200 4950
211 -6
212 6 3100 5050 3200 5150
213 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
214 3100 5050 3200 5050
215 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
216 3100 5100 3200 5100
217 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
218 3100 5150 3200 5150
219 -6
220 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
221 3000 4400 3200 4400
222 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
223 3000 5200 3200 5200
224 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
225 3050 4600 3200 4600
226 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
227 3050 4800 3200 4800
228 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
229 3050 5000 3200 5000
230 -6
231 6 3000 5200 3200 6000
232 6 3100 5250 3200 5350
233 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
234 3100 5250 3200 5250
235 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
236 3100 5300 3200 5300
237 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
238 3100 5350 3200 5350
239 -6
240 6 3100 5450 3200 5550
241 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
242 3100 5450 3200 5450
243 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
244 3100 5500 3200 5500
245 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
246 3100 5550 3200 5550
247 -6
248 6 3100 5650 3200 5750
249 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
250 3100 5650 3200 5650
251 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
252 3100 5700 3200 5700
253 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
254 3100 5750 3200 5750
255 -6
256 6 3100 5850 3200 5950
257 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
258 3100 5850 3200 5850
259 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
260 3100 5900 3200 5900
261 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
262 3100 5950 3200 5950
263 -6
264 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
265 3000 5200 3200 5200
266 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
267 3000 6000 3200 6000
268 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
269 3050 5400 3200 5400
270 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
271 3050 5600 3200 5600
272 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
273 3050 5800 3200 5800
274 -6
275 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
276 3111 1200 3200 1200 3200 6000 3111 6000
277 -6
278 6 4800 2904 5046 4200
279 6 4948 2904 5046 4200
280 6 4948 3502 5021 3651
281 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
282 5021 3651 4948 3651
283 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
284 5021 3602 4948 3602
285 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
286 5021 3553 4948 3553
287 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
288 5021 3502 4948 3502
289 -6
290 6 4948 3252 5021 3402
291 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
292 5021 3402 4948 3402
293 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
294 5021 3353 4948 3353
295 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
296 5021 3304 4948 3304
297 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
298 5021 3252 4948 3252
299 -6
300 6 4948 3002 5021 3153
301 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
302 5021 3153 4948 3153
303 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
304 5021 3105 4948 3105
305 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
306 5021 3055 4948 3055
307 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
308 5021 3002 4948 3002
309 -6
310 6 4948 3749 5021 3902
311 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
312 5021 3902 4948 3902
313 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
314 5021 3849 4948 3849
315 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
316 5021 3798 4948 3798
317 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
318 5021 3749 4948 3749
319 -6
320 6 4948 4000 5021 4152
321 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
322 5021 4152 4948 4152
323 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
324 5021 4102 4948 4102
325 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
326 5021 4049 4948 4049
327 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
328 5021 4000 4948 4000
329 -6
330 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
331 5045 3951 4948 3951
332 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
333 5045 3702 4948 3702
334 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
335 5045 3453 4948 3453
336 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
337 5045 3202 4948 3202
338 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 4
339 5045 2950 4948 2950 4948 4200 5045 4200
340 -6
341 6 4800 2953 4898 4200
342 6 4800 3502 4898 3702
343 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
344 4824 3674 4894 3674
345 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
346 4824 3624 4894 3624
347 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
348 4824 3577 4894 3577
349 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
350 4824 3529 4894 3529
351 -6
352 6 4800 3253 4898 3453
353 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
354 4824 3432 4894 3432
355 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
356 4824 3385 4894 3385
357 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
358 4824 3338 4894 3338
359 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
360 4824 3288 4894 3288
361 -6
362 6 4800 3002 4898 3202
363 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
364 4824 3193 4894 3193
365 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
366 4824 3147 4894 3147
367 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
368 4824 3098 4894 3098
369 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
370 4824 3051 4894 3051
371 -6
372 6 4800 3751 4898 3951
373 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
374 4824 3913 4894 3913
375 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
376 4824 3863 4894 3863
377 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
378 4824 3815 4894 3815
379 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
380 4824 3766 4894 3766
381 -6
382 6 4800 4000 4898 4200
383 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
384 4824 4154 4894 4154
385 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
386 4824 4106 4894 4106
387 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
388 4824 4055 4894 4055
389 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
390 4824 4008 4894 4008
391 -6
392 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
393 4801 3960 4894 3960
394 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
395 4801 3721 4894 3721
396 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
397 4801 3482 4894 3482
398 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
399 4801 3242 4894 3242
400 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 4
401 4801 2998 4894 2998 4894 4200 4801 4200
402 -6
403 -6
404 2 1 0 1 1 7 100 0 -1 0.000 0 0 -1 0 0 2
405 2100 3600 2850 3600
406 2 1 0 1 14 7 100 0 -1 0.000 0 0 -1 0 0 2
407 3300 3600 4050 3600
408 4 2 0 100 0 0 12 0.0000 4 135 90 2925 3675 0\001
409 4 2 0 100 0 0 12 0.0000 4 135 375 2925 2925 -400\001
410 4 2 0 100 0 0 12 0.0000 4 135 375 2925 2100 -800\001
411 4 2 0 100 0 0 12 0.0000 4 135 465 2925 1275 -1200\001
412 4 2 0 100 0 0 12 0.0000 4 135 270 2925 4500 400\001
413 4 2 0 100 0 0 12 0.0000 4 135 270 2925 5325 800\001
414 4 2 0 100 0 0 12 0.0000 4 135 360 2925 6075 1200\001
415 4 2 0 100 0 0 12 0.0000 4 135 90 4737 4286 0\001
416 4 2 0 100 0 0 12 0.0000 4 135 90 4730 4039 5\001
417 4 2 0 100 0 0 12 0.0000 4 135 180 4745 3836 10\001
418 4 2 0 100 0 0 12 0.0000 4 135 180 4737 3574 15\001
419 4 2 0 100 0 0 12 0.0000 4 135 180 4730 3334 20\001
420 4 2 0 100 0 0 12 0.0000 4 135 180 4707 3094 25\001
421 -6
422 6 1050 6300 6000 9300
423 6 1125 8175 5925 8400
424 6 1125 8175 1950 8400
425 6 1125 8175 1275 8325
426 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
427 1175 8300 1175 8200
428 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
429 1225 8300 1225 8200
430 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
431 1275 8300 1275 8200
432 -6
433 6 1350 8175 1500 8325
434 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
435 1375 8300 1375 8200
436 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
437 1425 8300 1425 8200
438 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
439 1475 8300 1475 8200
440 -6
441 6 1575 8175 1725 8325
442 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
443 1575 8300 1575 8200
444 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
445 1625 8300 1625 8200
446 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
447 1675 8300 1675 8200
448 -6
449 6 1725 8175 1875 8325
450 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
451 1775 8300 1775 8200
452 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
453 1825 8300 1825 8200
454 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
455 1875 8300 1875 8200
456 -6
457 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
458 1125 8400 1125 8200
459 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
460 1925 8400 1925 8200
461 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
462 1325 8350 1325 8200
463 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
464 1525 8350 1525 8200
465 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
466 1725 8350 1725 8200
467 -6
468 6 1875 8175 2775 8400
469 6 1950 8175 2100 8325
470 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
471 1975 8300 1975 8200
472 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
473 2025 8300 2025 8200
474 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
475 2075 8300 2075 8200
476 -6
477 6 2175 8175 2325 8325
478 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
479 2175 8300 2175 8200
480 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
481 2225 8300 2225 8200
482 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
483 2275 8300 2275 8200
484 -6
485 6 2325 8175 2475 8325
486 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
487 2375 8300 2375 8200
488 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
489 2425 8300 2425 8200
490 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
491 2475 8300 2475 8200
492 -6
493 6 2550 8175 2700 8325
494 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
495 2575 8300 2575 8200
496 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
497 2625 8300 2625 8200
498 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
499 2675 8300 2675 8200
500 -6
501 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
502 1925 8400 1925 8200
503 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
504 2725 8400 2725 8200
505 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
506 2125 8350 2125 8200
507 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
508 2325 8350 2325 8200
509 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
510 2525 8350 2525 8200
511 -6
512 6 2700 8175 3525 8400
513 6 2775 8175 2925 8325
514 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
515 2775 8300 2775 8200
516 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
517 2825 8300 2825 8200
518 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
519 2875 8300 2875 8200
520 -6
521 6 2925 8175 3075 8325
522 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
523 2975 8300 2975 8200
524 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
525 3025 8300 3025 8200
526 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
527 3075 8300 3075 8200
528 -6
529 6 3150 8175 3300 8325
530 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
531 3175 8300 3175 8200
532 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
533 3225 8300 3225 8200
534 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
535 3275 8300 3275 8200
536 -6
537 6 3375 8175 3525 8325
538 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
539 3375 8300 3375 8200
540 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
541 3425 8300 3425 8200
542 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
543 3475 8300 3475 8200
544 -6
545 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
546 2725 8400 2725 8200
547 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
548 3525 8400 3525 8200
549 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
550 2925 8350 2925 8200
551 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
552 3125 8350 3125 8200
553 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
554 3325 8350 3325 8200
555 -6
556 6 3525 8175 4350 8400
557 6 3525 8175 3675 8325
558 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
559 3575 8300 3575 8200
560 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
561 3625 8300 3625 8200
562 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
563 3675 8300 3675 8200
564 -6
565 6 3750 8175 3900 8325
566 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
567 3775 8300 3775 8200
568 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
569 3825 8300 3825 8200
570 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
571 3875 8300 3875 8200
572 -6
573 6 3975 8175 4125 8325
574 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
575 3975 8300 3975 8200
576 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
577 4025 8300 4025 8200
578 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
579 4075 8300 4075 8200
580 -6
581 6 4125 8175 4275 8325
582 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
583 4175 8300 4175 8200
584 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
585 4225 8300 4225 8200
586 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
587 4275 8300 4275 8200
588 -6
589 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
590 3525 8400 3525 8200
591 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
592 4325 8400 4325 8200
593 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
594 3725 8350 3725 8200
595 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
596 3925 8350 3925 8200
597 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
598 4125 8350 4125 8200
599 -6
600 6 4275 8175 5175 8400
601 6 4350 8175 4500 8325
602 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
603 4375 8300 4375 8200
604 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
605 4425 8300 4425 8200
606 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
607 4475 8300 4475 8200
608 -6
609 6 4575 8175 4725 8325
610 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
611 4575 8300 4575 8200
612 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
613 4625 8300 4625 8200
614 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
615 4675 8300 4675 8200
616 -6
617 6 4725 8175 4875 8325
618 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
619 4775 8300 4775 8200
620 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
621 4825 8300 4825 8200
622 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
623 4875 8300 4875 8200
624 -6
625 6 4950 8175 5100 8325
626 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
627 4975 8300 4975 8200
628 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
629 5025 8300 5025 8200
630 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
631 5075 8300 5075 8200
632 -6
633 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
634 4325 8400 4325 8200
635 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
636 5125 8400 5125 8200
637 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
638 4525 8350 4525 8200
639 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
640 4725 8350 4725 8200
641 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
642 4925 8350 4925 8200
643 -6
644 6 5100 8175 5925 8400
645 6 5175 8175 5325 8325
646 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
647 5175 8300 5175 8200
648 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
649 5225 8300 5225 8200
650 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
651 5275 8300 5275 8200
652 -6
653 6 5325 8175 5475 8325
654 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
655 5375 8300 5375 8200
656 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
657 5425 8300 5425 8200
658 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
659 5475 8300 5475 8200
660 -6
661 6 5550 8175 5700 8325
662 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
663 5575 8300 5575 8200
664 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
665 5625 8300 5625 8200
666 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
667 5675 8300 5675 8200
668 -6
669 6 5775 8175 5925 8325
670 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
671 5775 8300 5775 8200
672 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
673 5825 8300 5825 8200
674 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
675 5875 8300 5875 8200
676 -6
677 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
678 5125 8400 5125 8200
679 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
680 5925 8400 5925 8200
681 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
682 5325 8350 5325 8200
683 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
684 5525 8350 5525 8200
685 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
686 5725 8350 5725 8200
687 -6
688 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
689 1125 8289 1125 8200 5925 8200 5925 8289
690 -6
691 6 2850 6300 4125 6600
692 6 2850 6300 4125 6525
693 6 3375 6375 3600 6525
694 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
695 3576 6379 3576 6452
696 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
697 3527 6379 3527 6452
698 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
699 3478 6379 3478 6452
700 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
701 3427 6379 3427 6452
702 -6
703 6 3150 6375 3375 6525
704 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
705 3327 6379 3327 6452
706 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
707 3278 6379 3278 6452
708 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
709 3229 6379 3229 6452
710 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
711 3177 6379 3177 6452
712 -6
713 6 2925 6375 3150 6525
714 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
715 3078 6379 3078 6452
716 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
717 3030 6379 3030 6452
718 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
719 2980 6379 2980 6452
720 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
721 2927 6379 2927 6452
722 -6
723 6 3600 6375 3900 6525
724 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
725 3827 6379 3827 6452
726 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
727 3774 6379 3774 6452
728 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
729 3723 6379 3723 6452
730 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
731 3674 6379 3674 6452
732 -6
733 6 3900 6375 4125 6525
734 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
735 4077 6379 4077 6452
736 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
737 4027 6379 4027 6452
738 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
739 3974 6379 3974 6452
740 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
741 3925 6379 3925 6452
742 -6
743 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
744 3876 6355 3876 6452
745 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
746 3627 6355 3627 6452
747 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
748 3378 6355 3378 6452
749 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 2
750 3127 6355 3127 6452
751 2 1 0 1 4 7 100 0 -1 0.000 0 0 7 0 0 4
752 2875 6355 2875 6452 4125 6452 4125 6355
753 -6
754 6 2850 6450 4125 6600
755 6 3450 6450 3600 6600
756 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
757 3599 6576 3599 6506
758 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
759 3549 6576 3549 6506
760 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
761 3502 6576 3502 6506
762 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
763 3454 6576 3454 6506
764 -6
765 6 3150 6450 3375 6600
766 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
767 3357 6576 3357 6506
768 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
769 3310 6576 3310 6506
770 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
771 3263 6576 3263 6506
772 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
773 3213 6576 3213 6506
774 -6
775 6 2925 6450 3150 6600
776 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
777 3118 6576 3118 6506
778 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
779 3072 6576 3072 6506
780 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
781 3023 6576 3023 6506
782 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
783 2976 6576 2976 6506
784 -6
785 6 3675 6450 3900 6600
786 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
787 3838 6576 3838 6506
788 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
789 3788 6576 3788 6506
790 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
791 3740 6576 3740 6506
792 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
793 3691 6576 3691 6506
794 -6
795 6 3900 6450 4125 6600
796 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
797 4079 6576 4079 6506
798 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
799 4031 6576 4031 6506
800 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
801 3980 6576 3980 6506
802 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
803 3933 6576 3933 6506
804 -6
805 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
806 3885 6599 3885 6506
807 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
808 3646 6599 3646 6506
809 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
810 3407 6599 3407 6506
811 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 2
812 3167 6599 3167 6506
813 2 1 0 1 0 7 100 0 -1 0.000 0 0 7 0 0 4
814 2923 6599 2923 6506 4125 6506 4125 6599
815 -6
816 -6
817 2 1 0 1 1 7 100 0 -1 0.000 0 0 -1 0 0 2
818 3525 9300 3525 8550
819 2 1 0 1 14 7 100 0 -1 0.000 0 0 -1 0 0 2
820 3525 8100 3525 7350
821 4 2 0 100 0 0 12 1.5708 4 135 90 3600 8475 0\001
822 4 2 0 100 0 0 12 1.5708 4 135 375 2850 8475 -400\001
823 4 2 0 100 0 0 12 1.5708 4 135 375 2025 8475 -800\001
824 4 2 0 100 0 0 12 1.5708 4 135 465 1200 8475 -1200\001
825 4 2 0 100 0 0 12 1.5708 4 135 270 4425 8475 400\001
826 4 2 0 100 0 0 12 1.5708 4 135 270 5250 8475 800\001
827 4 2 0 100 0 0 12 1.5708 4 135 360 6000 8475 1200\001
828 4 2 0 100 0 0 12 1.5708 4 135 90 4211 6663 0\001
829 4 2 0 100 0 0 12 1.5708 4 135 90 3964 6670 5\001
830 4 2 0 100 0 0 12 1.5708 4 135 180 3761 6655 10\001
831 4 2 0 100 0 0 12 1.5708 4 135 180 3499 6663 15\001
832 4 2 0 100 0 0 12 1.5708 4 135 180 3259 6670 20\001
833 4 2 0 100 0 0 12 1.5708 4 135 180 3019 6693 25\001
834 -6
835 2 2 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 5
836 1200 1200 2400 1200 2400 2400 1200 2400 1200 1200
837 2 2 0 1 4 7 100 0 -1 0.000 0 0 -1 0 0 5
838 1350 1350 2250 1350 2250 2250 1350 2250 1350 1350
839 2 2 0 1 2 7 100 0 -1 0.000 0 0 -1 0 0 5
840 1500 1500 2100 1500 2100 2100 1500 2100 1500 1500
841 2 2 0 1 1 7 100 0 -1 0.000 0 0 -1 0 0 5
842 1650 1650 1950 1650 1950 1950 1650 1950 1650 1650
843 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
844 1200 1200 2400 2400
845 2 1 0 1 6 7 100 0 -1 0.000 0 0 -1 0 0 2
846 1200 2400 2400 1200
0 #FIG 3.2
1 Portrait
2 Center
3 Metric
4 Letter
5 100.00
6 Single
7 -2
8 1200 2
9 6 2250 7200 7200 8100
10 2 2 0 1 -1 10 0 0 20 0.000 0 0 -1 0 0 5
11 2250 7200 2869 7200 2869 7500 2250 7500 2250 7200
12 2 2 0 1 -1 6 0 0 20 0.000 0 0 -1 0 0 5
13 3488 7200 4106 7200 4106 7500 3488 7500 3488 7200
14 2 2 0 1 -1 5 0 0 20 0.000 0 0 -1 0 0 5
15 4106 7200 4725 7200 4725 7500 4106 7500 4106 7200
16 2 2 0 1 -1 26 0 0 20 0.000 0 0 -1 0 0 5
17 4725 7200 5344 7200 5344 7500 4725 7500 4725 7200
18 2 2 0 1 -1 31 0 0 20 0.000 0 0 -1 0 0 5
19 5344 7200 5963 7200 5963 7500 5344 7500 5344 7200
20 2 2 0 1 -1 3 0 0 20 0.000 0 0 -1 0 0 5
21 5963 7200 6581 7200 6581 7500 5963 7500 5963 7200
22 2 2 0 1 -1 20 0 0 20 0.000 0 0 -1 0 0 5
23 2869 7200 3488 7200 3488 7500 2869 7500 2869 7200
24 2 2 0 1 -1 2 0 0 20 0.000 0 0 -1 0 0 5
25 6581 7200 7200 7200 7200 7500 6581 7500 6581 7200
26 4 1 -1 0 0 18 10 0.0000 4 120 465 5034 7800 Brown\001
27 4 1 -1 0 0 18 10 0.0000 4 120 345 5653 7800 Gold\001
28 4 1 -1 0 0 18 10 0.0000 4 120 450 6891 7800 Green\001
29 4 1 -1 0 0 18 10 0.0000 4 120 525 3797 7800 Yellow\001
30 4 1 -1 0 0 18 10 0.0000 4 120 285 3178 7800 Red\001
31 4 1 -1 0 0 18 10 0.0000 4 120 330 2559 7800 Blue\001
32 4 1 -1 0 0 18 10 0.0000 4 150 480 4416 7800 Purple\001
33 4 1 -1 0 0 18 10 0.0000 4 150 390 6272 7800 Cyan\001
34 -6
35 2 2 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
36 450 450 9000 450 9000 12915 450 12915 450 450
37 2 2 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
38 900 900 8550 900 8550 12465 900 12465 900 900
39 4 1 -1 0 0 0 12 0.0000 4 135 315 4725 1095 2cm\001
40 4 1 -1 0 0 0 12 0.0000 4 135 315 4725 12825 1cm\001
41 4 1 -1 0 0 0 12 0.0000 4 135 315 4725 12345 2cm\001
42 4 1 -1 0 0 0 12 0.0000 4 135 315 1110 7485 2cm\001
43 4 1 -1 0 0 0 12 0.0000 4 135 315 675 7485 1cm\001
44 4 1 -1 0 0 0 12 0.0000 4 135 315 8310 7485 2cm\001
45 4 1 -1 0 0 0 12 0.0000 4 135 315 8820 7485 1cm\001
46 4 1 -1 0 0 18 18 0.0000 4 270 4335 4725 6420 Here are some other colors; they\001
47 4 1 -1 0 0 18 18 0.0000 4 270 5175 4725 6765 will appear as greys on a B&W printer...\001
48 4 1 -1 0 0 18 18 0.0000 4 270 3555 4725 9225 are spaced at 1cm and 2cm\001
49 4 1 -1 0 0 18 18 0.0000 4 270 4095 4725 8880 The boxes bordering this page\001
50 4 1 -1 0 0 18 18 0.0000 4 270 3690 4725 9600 from the sides of the paper.\001
51 4 1 -1 0 0 18 18 0.0000 4 270 5640 4725 10500 It is not unusual for the 1cm bottom margin\001
52 4 1 -1 0 0 18 18 0.0000 4 270 4470 4725 10845 not to show. Many printers cannot\001
53 4 1 -1 0 0 18 18 0.0000 4 270 5520 4725 11190 print that close to the bottom of the page.\001
54 4 1 -1 0 0 18 18 0.0000 4 270 3405 4725 2445 PostScript Test Page (A4)\001
55 4 1 -1 0 0 0 12 0.0000 4 135 315 4725 630 1cm\001
56 4 0 0 50 0 2 25 0.0000 4 330 4200 2385 3285 To adjust the offsets in the\001
57 4 0 0 50 0 2 25 0.0000 4 330 5895 1800 4725 change xoff and yoff until this page is\001
58 4 0 0 50 0 2 25 0.0000 4 330 6345 1800 5400 printed correctly centered on the paper.\001
59 4 0 0 50 0 2 25 0.0000 4 330 5880 1800 4005 /etc/pnm2ppa.conf configuration file,\001
0 #FIG 3.2
1 Portrait
2 Center
3 Inches
4 Letter
5 100.00
6 Single
7 -2
8 1200 2
9 6 2400 7200 7200 8100
10 2 2 0 1 -1 10 0 0 20 0.000 0 0 -1 0 0 5
11 2400 7200 3000 7200 3000 7500 2400 7500 2400 7200
12 2 2 0 1 -1 6 0 0 20 0.000 0 0 -1 0 0 5
13 3600 7200 4200 7200 4200 7500 3600 7500 3600 7200
14 2 2 0 1 -1 5 0 0 20 0.000 0 0 -1 0 0 5
15 4200 7200 4800 7200 4800 7500 4200 7500 4200 7200
16 2 2 0 1 -1 26 0 0 20 0.000 0 0 -1 0 0 5
17 4800 7200 5400 7200 5400 7500 4800 7500 4800 7200
18 2 2 0 1 -1 31 0 0 20 0.000 0 0 -1 0 0 5
19 5400 7200 6000 7200 6000 7500 5400 7500 5400 7200
20 2 2 0 1 -1 3 0 0 20 0.000 0 0 -1 0 0 5
21 6000 7200 6600 7200 6600 7500 6000 7500 6000 7200
22 2 2 0 1 -1 20 0 0 20 0.000 0 0 -1 0 0 5
23 3000 7200 3600 7200 3600 7500 3000 7500 3000 7200
24 2 2 0 1 -1 2 0 0 20 0.000 0 0 -1 0 0 5
25 6600 7200 7200 7200 7200 7500 6600 7500 6600 7200
26 4 1 -1 0 0 18 10 0.0000 4 120 465 5100 7800 Brown\001
27 4 1 -1 0 0 18 10 0.0000 4 120 345 5700 7800 Gold\001
28 4 1 -1 0 0 18 10 0.0000 4 120 450 6900 7800 Green\001
29 4 1 -1 0 0 18 10 0.0000 4 120 525 3900 7800 Yellow\001
30 4 1 -1 0 0 18 10 0.0000 4 120 285 3300 7800 Red\001
31 4 1 -1 0 0 18 10 0.0000 4 120 330 2700 7800 Blue\001
32 4 1 -1 0 0 18 10 0.0000 4 150 480 4500 7800 Purple\001
33 4 1 -1 0 0 18 10 0.0000 4 150 390 6300 7800 Cyan\001
34 -6
35 6 2175 1875 7425 2175
36 4 1 -1 0 0 18 18 0.0000 4 270 5115 4800 2100 Postscript Test Page (US Letter paper)\001
37 -6
38 2 2 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
39 600 600 9600 600 9600 12600 600 12600 600 600
40 2 2 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
41 1200 1200 9000 1200 9000 12000 1200 12000 1200 1200
42 4 0 -1 0 0 0 12 0.0000 4 135 300 4800 12375 0.5"\001
43 4 0 -1 0 0 0 12 0.0000 4 135 300 4725 900 0.5"\001
44 4 0 -1 0 0 0 12 0.0000 4 135 165 4800 11850 1"\001
45 4 0 -1 0 0 0 12 0.0000 4 135 165 4800 1500 1"\001
46 4 0 -1 0 0 0 12 0.0000 4 135 300 750 7500 0.5"\001
47 4 0 -1 0 0 0 12 0.0000 4 135 165 1350 7500 1"\001
48 4 0 -1 0 0 0 12 0.0000 4 135 165 8700 7500 1"\001
49 4 0 -1 0 0 0 12 0.0000 4 135 300 9225 7500 0.5"\001
50 4 1 -1 0 0 18 18 0.0000 4 270 4335 4800 6420 Here are some other colors; they\001
51 4 1 -1 0 0 18 18 0.0000 4 270 5175 4800 6765 will appear as greys on a B&W printer...\001
52 4 1 -1 0 0 18 18 0.0000 4 270 3270 4800 9225 are spaced at 0.5" and 1"\001
53 4 1 -1 0 0 18 18 0.0000 4 270 4095 4800 8880 The boxes bordering this page\001
54 4 1 -1 0 0 18 18 0.0000 4 270 3690 4800 9600 from the sides of the paper.\001
55 4 1 -1 0 0 18 18 0.0000 4 270 5610 4800 10500 It is not unusual for the 0.5" bottom margin\001
56 4 1 -1 0 0 18 18 0.0000 4 270 4470 4800 10845 not to show. Many printers cannot\001
57 4 1 -1 0 0 18 18 0.0000 4 270 5520 4800 11190 print that close to the bottom of the page.\001
58 4 0 0 50 0 2 20 0.0000 4 255 5355 2175 3075 To adjust the offsets in the configuration file\001
59 4 0 0 50 0 2 20 0.0000 4 255 5340 2175 3390 /etc/pnm2ppa.conf, change the values of xoff\001
60 4 0 0 50 0 2 20 0.0000 4 255 5220 2175 3705 and yoff until this page is printed correctly \001
61 4 0 0 50 0 2 20 0.0000 4 255 2685 2175 4020 centered on the paper.\001
0 /***************************************************************************
1 text-cs.h - contains the czech strings
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Andrew van der Stock
5 email : ajv@greebo.net
6 translator : Ivo Panacek <ivop@regionet.cz>
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 /* messages from cutswath.c */
19
20 /* 00 */ "nemohu alokovat dal¹í pamì»\n",
21
22 /* 01 */ "nemohu pøeèíst velikost horního okraje\n",
23
24 /* 02 */ "nemohu pøeèíst velikost spodního okraje\n",
25
26 /* 03 */ "nemohu pøeèíst dal¹í øádku\n",
27
28 /* 04 */ "nemohu alokovat pamì» pro ppa\n",
29
30 /* 05 */ "chyba pøi volání", //followed by function name
31
32 /* 06 */ "neznámá návratová hodnota pøepínaèe\n",
33
34 // from ppa,c
35
36 /* 07 */ "zkracuji data pro trysky na 6 øádek, (pùvodnì ", // followed by number
37
38 // messages from image.c
39
40 /* 08 */ "Nemohu vytvoøit gamma.ppm soubor. Zkontrolujte práva\n",
41
42 /* 09 */ "Pøedèasnì ukonèený vstup - narazil jsem na EOF pøi ètení obrázku:", //followed by format
43
44 /* 10 */ "Fatální chyba - nemohu èíst obrázek\n",
45
46 /* 11 */ "Fatální chyba - vstupní obrázek obsahuje pixl s hodnotou > 255\n",
47
48 /* 12 */ "Fatální chyba! Nemohu alokovat pamì» pro buffer!\n",
49
50 /* 13 */ "Vstupní obrázek nemá podporovaný PNM formát\n",
51
52 /* 14 */ // (removed)
53
54 /* 15 */ "Tiskárna nemù¾e tisknout na papír velikosti ", //followed by size
55
56 /* 16 */ "maximální hodnota PNM pixlu musí být 255, ale je: ", //followed by value
57
58 // messages from ppa.c and pnm2ppa.c
59
60 /* 17 */ "Neznámá verze tiskárny\n",
61
62 /* 18 */ "Nemohu alokovat prostor pro ulo¾ení komprimovaných dat\n",
63
64 /* 19 */ "Zaèínám zpracovávat tiskovou úlohu\n",
65
66 /* 20 */ "Tisknu stránku ", //followed by page number
67
68 /* 21 */ "Konec zpracování stránky ", //followed by page number
69
70 /* 22 */ "®ádné stránky nebyly vyti¹tìny!\n",
71
72 /* 23 */ "Tisková úloha dopadla úspì¹nì.\n",
73
74 /* 24 */ "Upovídaný výpis na konzoli\n",
75
76 /* 25 */ "Prosím, nastavte si tiskárnu v souboru /etc/pnm2ppa.conf\n",
77
78 /* 26 */ "nemohu otevøít konfiguraèního soubor\n",
79
80 /* 27 */ "neznámá velikost papíru\n",
81
82 /* 28 */ "neznámý parametr", // not followed by \n
83
84 /* 29 */ "na øádce", // followed by line number
85
86 /* 30 */ "chyba pøi ètení konfiguraèního souboru", // not followed by \n
87
88 /* 31 */ "Fatální chyba: neznámý argument\n" ,
89
90 /* 32 */ "Nemohu otevøít výstupní PPA soubor\n",
91
92 /* 33 */ "Nemohu otevøít vstupní PPA soubor\n",
93
94 /* 34 */ "verze a datum pøekladu:", //followed by version number and date
95
96 /* 35 */ "Color correction curve (Gamma) file exists, but is corrupt.\n",
97
98 /* 36 */ "POSSIBLE BUFFER OVERFLOW ATTACK!!: length of a path specified as an option exceeds", //followed by maximum allowed size
99
100 "FATAL: ©patné chybové hlá¹ení\n"
101
0 /***************************************************************************
1 text-en.h - contains the english strings
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Andrew van der Stock
5 email : ajv@greebo.net
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 /* messages from cutswath.c */
18
19 /* 00 */ "could not malloc data storage\n",
20
21 /* 01 */ "could not read top margin\n",
22
23 /* 02 */ "could not clear bottom margin\n",
24
25 /* 03 */ "could not read next line\n",
26
27 /* 04 */ "could not malloc ppa storage\n",
28
29 /* 05 */ "error calling", //followed by function name
30
31 /* 06 */ "unknown return code in switch\n",
32
33 // from ppa,c
34
35 /* 07 */ "truncating nozzle data to 6 rows, (was ", // followed by number
36
37 // messages from image.c
38
39 /* 08 */ "Could not create gamma.ppm file. Check permissions\n",
40
41 /* 09 */ "Truncated input - EOF while reading image:", //followed by format
42
43 /* 10 */ "Fatal error - failed to read input image\n",
44
45 /* 11 */ "Fatal error - input image has pixel with value > 255\n",
46
47 /* 12 */ "Fatal error! Unable to allocate buffer memory!\n",
48
49 /* 13 */ "Input image is not a supported PNM format\n",
50
51 /* 14 */ // (removed)
52
53 /* 15 */ "Printer cannot print on paper size ", //followed by size
54
55 /* 16 */ "maximum PNM pixel value must be 255, but is: ", //followed by value
56
57 // messages from ppa.c and pnm2ppa.c
58
59 /* 17 */ "Unknown Printer version\n",
60
61 /* 18 */ " Could not malloc storage for compressed data\n",
62
63 /* 19 */ "Starting print job\n",
64
65 /* 20 */ "Printing page ", //followed by page number
66
67 /* 21 */ "Finished rendering page ", //followed by page number
68
69 /* 22 */ "No pages printed!\n",
70
71 /* 23 */ "Print job completed successfully.\n",
72
73 /* 24 */ "Verbose logging to console\n",
74
75 /* 25 */ "Please configure your printer in /etc/pnm2ppa.conf\n",
76
77 /* 26 */ "couldn't open config file \n",
78
79 /* 27 */ "unknown paper size\n",
80
81 /* 28 */ "unrecognized parameter", //not followed by \n
82
83 /* 29 */ "at line", // followed by line number
84
85 /* 30 */ "error parsing config file", // not followed by \n
86
87 /* 31 */ "Fatal: unknown argument\n" ,
88
89 /* 32 */ "Could not open PPA output file\n",
90
91 /* 33 */ "Could not open PNM input file\n",
92
93 /* 34 */ "version and build date:", //followed by version number and date
94
95 /* 35 */ "Color correction curve (Gamma) file exists, but is corrupt.\n",
96
97 /* 36 */ "POSSIBLE BUFFER OVERFLOW ATTACK!!: length of a path specified as an option exceeds", //followed by maximum allowed size
98
99
100 "FATAL: Bad error message\n"
101
102
103
104
105
106
0 /***************************************************************************
1 text-es.h - contains the Spanish strings - Contiene las cadenas es español
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Andrew van der Stock
5 email : ajv@greebo.net
6
7 Translated by Javier Sedano (jsedano@it.uc3m.es), Wed Apr 12 11:10:14 CEST 2000,
8 Spanish.
9 Traducido por Javier Sedano (jsedano@it.uc3m.es), Wed Apr 12 11:10:14 CEST 2000,
10 al español.
11 ***************************************************************************/
12
13 /***************************************************************************
14 * *
15 * This program is free software; you can redistribute it and/or modify *
16 * it under the terms of the GNU General Public License as published by *
17 * the Free Software Foundation; either version 2 of the License, or *
18 * (at your option) any later version. *
19 * *
20 * Este programa es software libre; puedes redistribuirlo y/o *
21 * modificarlo bajo los terminos de la GNU General Public License *
22 * (Licencia Publica General GNU) tal y como es publicada por la Free *
23 * Software Fundation (Fundacion de Software Libre); la version 2 de la *
24 * Licencia, o (a tu eleccion) cualquier version anterior. *
25 ***************************************************************************/
26
27 /* messages from cutswath.c */
28
29 /* 00 */ "no pude reservar memoria para almacen de datos\n",
30
31 /* 01 */ "no pude leer el margen superior\n",
32
33 /* 02 */ "no pude limpiar el margen inferior\n",
34
35 /* 03 */ "no pude leer la siguiente linea\n",
36
37 /* 04 */ "no pude reservar memoria para almacenar el ppa\n",
38
39 /* 05 */ "error invocando", //followed by function name
40
41 /* 06 */ "codigo devuelto por switch desconocido\n",
42
43 // from ppa,c
44
45 /* 07 */ "truncando datos de las boquillas a 6 filas, (era ", // followed by number
46
47 // messages from image.c
48
49 /* 08 */ "No pude crear el archivo gamma.ppm . Comprueba los permisos\n",
50
51 /* 09 */ "Entrada truncada - EOF mientras leia la imagen:", //followed by format
52
53 /* 10 */ "Error fatal - imposible leer imagen de entrada\n",
54
55 /* 11 */ "Error fatal - la imagen de entrada tiene un pixel que vale mas de 255\n",
56
57 /* 12 */ "Error fatal! Imposible reservar buffer de memoria!\n",
58
59 /* 13 */ "La imagen de entrada no es uno de los formatos PNM soportados\n",
60
61 /* 14 */ // removed
62
63 /* 15 */ "La impresora no puede imprimir en tamaño de papel ", //followed by size
64
65 /* 16 */ "el maximo calor para un pixel PNM debe ser 255, pero es: ", //followed by value
66
67 // messages from ppa.c and pnm2ppa.c
68
69 /* 17 */ "Version de impresora desconocida\n",
70
71 /* 18 */ "No pude reservar memoria para los datos comprimidos C\n",
72
73 /* 19 */ "Comenzando trabajo de impresion\n",
74
75 /* 20 */ "Imprimiendo pagina ", //followed by page number
76
77 /* 21 */ "Terminado renderizado de la pagina ", //followed by page number
78
79 /* 22 */ "No imprimi ninguna pagina!\n",
80
81 /* 23 */ "Trabajo de impresion completado con exito.\n",
82
83 /* 24 */ "Registrando salida en la consola\n",
84
85 /* 25 */ "Por favor, configura tu impresora en /etc/pnm2ppa.conf\n",
86
87 /* 26 */ "no pude abrir el archivo de configuracion\n",
88
89 /* 27 */ "tamaño de papel desconocido\n",
90
91 /* 28 */ "parametro desconocido", //not followed by \n
92
93 /* 29 */ "en la linea", // followed by line number
94
95 /* 30 */ "error procesando el archivo de configuracionco", // not followed by \n
96
97 /* 31 */ "Critico: argumento desconocido\n" ,
98
99 /* 32 */ "No pude abrir el archivo de salida PPA\n",
100
101 /* 33 */ "No pude abrir el archivo de entrada PNM\n",
102
103 /* 34 */ "version y fecha de compilacion:", //followed by version number and date
104
105 /* 35 */ "El archivo de correcion de color (gamma) existe, pero esta corrupto.\n",
106
107 /* 36 */ "POSSIBLE BUFFER OVERFLOW ATTACK!!: length of a path specified as an option exceeds", //followed by maximum allowed size
108 "CRITICO: Mensaje de error incorrecto\n"
0 /***************************************************************************
1 text-fr.h - contains the french strings
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Andrew van der Stock
5 email : ajv@greebo.net
6 translator : b.alix@free.fr
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 /* messages de cutswath.c */
19
20 /* 00 */ "ne peut allouer de mémoire pour les données\n",
21
22 /* 01 */ "ne peut lire la marge supérieure\n",
23
24 /* 02 */ "ne peut effacer la marge inférieure\n",
25
26 /* 03 */ "ne peut lire la ligne suivante\n",
27
28 /* 04 */ "ne peut allouer de mémoire pour ppa\n",
29
30 /* 05 */ "erreur lors de l'appel à", //suivi du nom de la fonction
31
32 /* 06 */ "code retour inconnu lors du switch\n",
33
34 // from ppa,c
35
36 /* 07 */ "troncature des données buses à 6 lignes, (initiallement ", //suivi du nombre
37
38 // messages de image.c
39
40 /* 08 */ "ne peut créer le fichier gamma.ppm . Vérifiez les permissions\n",
41
42 /* 09 */ "Entrée tronquée - EOF pendant la lecture de l'image:", //suivi du format
43
44 /* 10 */ "Erreur fatale - impossible de lire l'image en entrée\n",
45
46 /* 11 */ "Erreur fatale - l'image en entrée a un pixel d'une valeur > 255\n",
47
48 /* 12 */ "Erreur fatale! Impossible d'allouer un buffer mémoire!\n",
49
50 /* 13 */ "L'image en entrée n'est pas à un format PNM supporté\n",
51
52 /* 14 */ // removed
53
54 /* 15 */ "L'imprimante ne peut imprimer sur cette taille de papier ", //suivi de la taille
55
56 /* 16 */ "la valeur maximale d'un pixel PNM devrait être 255, mais est : ", //suivi de la valeur
57
58 // messages de ppa.c et pnm2ppa.c
59
60 /* 17 */ "Version d'imprimante inconnue\n",
61
62 /* 18 */ " Ne peut allouer de mémoire pour les données compressées\n",
63
64 /* 19 */ "Début de la tâche d'impression\n",
65
66 /* 20 */ "Impression de la page ", //suivi du numéro de page
67
68 /* 21 */ "Fin du rendu de la page ", //suivi du numéro de page
69
70 /* 22 */ "Aucune page imprimée!\n",
71
72 /* 23 */ "Tâche d'impression terminée avec succès.\n",
73
74 /* 24 */ "messages affichés sur la console\n",
75
76 /* 25 */ "Veuillez configurer votre imprimante dans /etc/pnm2ppa.conf\n",
77
78 /* 26 */ "ne peut ouvrir le fichier\n",
79
80 /* 27 */ "taille de papier inconnue\n",
81
82 /* 28 */ "paramètre non reconnu", //non suivi de \n
83
84 /* 29 */ "à la ligne", // suivi du numéro de ligne
85
86 /* 30 */ "erreur de traitement du fichier de configuration", //non suivi de \n
87
88 /* 31 */ "Fatal: argument inconnu\n" ,
89
90 /* 32 */ "Ne peut ouvrir le fichier PPA en sortie\n",
91
92 /* 33 */ "Ne peut ouvrir le fichier PNM en entrée\n",
93
94 /* 34 */ "version et date de création:", //suivi du numéro de version et de sa date
95
96 /* 35 */ "Color correction curve (Gamma) file exists, but is corrupt.\n",
97
98 /* 36 */ "POSSIBLE BUFFER OVERFLOW ATTACK!!: length of a path specified as an option exceeds", //followed by maximum allowed size
99
100 "FATAL: mauvais message d'erreur\n"
101
0 /***************************************************************************
1 text-it.h - contains the Italian strings
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Andrew van der Stock
5 email : ajv@greebo.net
6
7 Translated to Italian by Riccardo Murri <murri@phc.unipi.it>, Fri Aug 11 18:34:09 CEST 2000
8 Tradotto in Italiano da Riccardo Murri <murri@phc.unipi.it>, Fri Aug 11 18:34:09 CEST 2000
9
10 ***************************************************************************/
11
12 /***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 ***************************************************************************/
20
21 /* messages from cutswath.c */
22
23 /* 00 */ "impossibile allocare memoria per i dati\n",
24
25 /* 01 */ "impossibile leggere il margine superiore\n",
26
27 /* 02 */ "impossibile espellere il margine inferiore\n", // FIXME: che vuol dire "clear bottom margin"?
28
29 /* 03 */ "impossibile leggere la riga successiva\n",
30
31 /* 04 */ "impossibile allocare memoria per il PPA\n",
32
33 /* 05 */ "errore invocando la funzione", //followed by function name
34
35 /* 06 */ "codice di ritorno dello scambio sconosciuto\n", // FIXME: "switch" = "scambio"??
36
37
38 // from ppa.c
39
40 /* 07 */ "troncati i dati del beccuccio a 6 righe, (erano ", // followed by number // FIXME: nozzle data??
41
42 // messages from image.c
43
44 /* 08 */ "impossibile creare il file gamma.ppm. Controllare i permessi.\n",
45
46 /* 09 */ "Input troncato - File terminato durante la lettura dell'immagine:", //followed by format
47
48 /* 10 */ "Errore critico - impossibile leggere l'immagine in ingresso\n",
49
50 /* 11 */ "Errore critico - l'immagine in ingresso ha pixel con valore > 255\n",
51
52 /* 12 */ "Errore critico! Impossibile allocare memoria per il buffer!\n", // FIXME: "memoria tampone"?
53
54 /* 13 */ "L'immagine in ingresso non è in un formato PNM riconosciuto\n",
55
56 /* 14 */ // removed
57
58 /* 15 */ "La stampante non può stampare su carta in formato ", //followed by size
59
60 /* 16 */ "indice colore errato: il massimo è 255, il file contiene ", //followed by value
61
62 // messages from ppa.c and pnm2ppa.c
63
64 /* 17 */ "Versione della stampante sconosciuta\n",
65
66 /* 18 */ "Impossibile allocare memoria per i dati compressi\n",
67
68 /* 19 */ "Comincia il lavoro di stampa\n",
69
70 /* 20 */ "Stampa in corso, pagina ", //followed by page number
71
72 /* 21 */ "Composta la pagina ", //followed by page number
73
74 /* 22 */ "Nessuna pagina stampata!\n",
75
76 /* 23 */ "Stampa completata correttamente.\n",
77
78 /* 24 */ "Informazioni dettagliate in console\n",
79
80 /* 25 */ "Configurare la stampante in /etc/pnm2ppa.conf\n",
81
82 /* 26 */ "impossibile aprire il file di configurazione\n",
83
84 /* 27 */ "formato della carta sconosciuto\",
85
86 /* 28 */ "parametro non riconosciuto", //not followed by /n
87
88 /* 29 */ "alla linea", // followed by line number
89
90 /* 30 */ "errore nel file di configurazione", // not followed by \n
91
92 /* 31 */ "Errore critico: argomento sconosciuto\n" ,
93
94 /* 32 */ "Impossibile aprire il file di uscita PPA\n",
95
96 /* 33 */ "Impossibile aprire il file di ingresso PNM\n",
97
98 /* 34 */ "versione e data di compilazione:", //followed by version number and date
99
100 /* 35 */ "Color correction curve (Gamma) file exists, but is corrupt.\n",
101
102 /* 36 */ "POSSIBLE BUFFER OVERFLOW ATTACK!!: length of a path specified as an option exceeds", //followed by maximum allowed size
103 "ERRORE CRITICO: messaggio di errore impossibile (bug nel programma)\n"
104
0 /***************************************************************************
1 text-nl.h - contains the Dutch strings
2 -------------------
3 begin : Thu Jan 13 2000
4 copyright : (C) 2000 by Jimmy Tak
5 email : fltak@studenten.net
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 /* messages from cutswath.c */
18
19 /* could not malloc data storage */
20 /* 00 */ "er kon geen geheugen toegewezen worden voor de opslag van gegevens\n",
21
22 /* could not read top margin */
23 /* 01 */ "de bovenste marge kon niet gelezen worden\n",
24
25 /* could not clear bottom margin */
26 /* 02 */ "de onderste marge kon niet leeggemaakt worden\n",
27
28 /* could not read next line */
29 /* 03 */ "de volgende regel kon niet gelezen worden\n",
30
31 /* could not malloc ppa storage */
32 /* 04 */ "er kon geen geheugen toewijzen worden voor de ppa opslag\n",
33
34 /* error calling */
35 /* 05 */ "fout tijdens het aanroepen van ", //followed by function name
36
37 /* unknown return code in switch */
38 /* 06 */ "onbekende return code in switch\n",
39
40 // from ppa,c
41
42 /* truncating nozzle data to 6 rows, (was */
43 /* 07 */ "spuitgat gegevens worden afgekapt tot 6 rijen, (het waren ", // followed by number
44
45 // messages from image.c
46
47 /* Could not create gamma file. Check permissions */
48 /* 08 */ "gamma.ppm bestand kon niet worden gemaakt. Controleer de toegangsrechten\n",
49
50 /* Truncated input - EOF while reading image: */
51 /* 09 */ "Afgekapte invoer - EOF tijdens het lezen van de afbeelding: ", //followed by format
52
53 /* Fatal error - failed to read input image */
54 /* 10 */ "Fatale fout - invoer afbeelding kon niet gelezen worden\n",
55
56 /* Fatal error - input image has pixel with value > 255 */
57 /* 11 */ "Fatale fout - invoer afbeelding heeft een pixel met een waarde groter dan 255\n",
58
59 /* Fatal error! Unable to allocate buffer memory! */
60 /* 12 */ "Fatale fout! Kan geen buffer geheugen toewijzen!\n",
61
62 /* Input image is not a supported PNM format */
63 /* 13 */ "Invoer afbeelding is niet van een door PNM ondersteunde indeling\n",
64
65 /* Unknown PNM magic */
66 /* 14 */ //removed
67
68
69 /* Printer cannot print on paper size */
70 /* 15 */ "De printer kan niet afdrukken op de papiergrootte ", //followed by size
71
72 /* maximum PNM pixel value must be 255, but is: */
73 /* 16 */ "maximale PNM pixel waarde moet 255 zijn, maar het is: ", //followed by value
74
75 // messages from ppa.c and pnm2ppa.c
76
77 /* Unknown Printer version */
78 /* 17 */ "Onbekende printer versie\n",
79
80 /* Could not malloc storage for compressed data */
81 /* 18 */ "Er kon geen geheugen toegewezen voor de opslag van gecomprimeerde gegevens\n",
82
83 /* Starting print job */
84 /* 19 */ "Afdruk opdracht wordt gestart\n",
85
86 /* Printing page */
87 /* 20 */ "Bezig met afdrukken van pagina ", //followed by page number
88
89 /* Finished rendering page */
90 /* 21 */ "Klaar met afbeelden van pagina ", //followed by page number
91
92 /* No pages printed! */
93 /* 22 */ "Geen pagina's afgedrukt!\n",
94
95 /* Print job completed successfully. */
96 /* 23 */ "Afdruk opdracht is succesvol afgerond.\n",
97
98 /* Verbose logging to console */
99 /* 24 */ "Uitgebreide logweergave in de console\n",
100
101 /* Please configure your printer in /etc/pnm2ppa.conf */
102 /* 25 */ "Configureer aub uw printer in /etc/pnm2ppa.conf\n",
103
104 /* couldn't open config file */
105 /* 26 */ "configuratie bestand kon niet geopend worden\n",
106
107 /* unknown paper size */
108 /* 27 */ "onbekende papiergrootte\n",
109
110 /* unrecognized parameter */
111 /* 28 */ "onbekende parameter", //not followed by \n
112
113 /* at line */
114 /* 29 */ "in rij ", // followed by line number
115
116 /* error parsing config file */
117 /* 30 */ "fout bij het interpreteren van het configuratie bestand", // not followed by \n
118
119 /* Fatal: unknown argument */
120 /* 31 */ "Fataal: onbekend argument\n",
121
122 /* Could not open PPA output file */
123 /* 32 */ "PPA uitvoer bestand kon niet geopend worden\n",
124
125 /* Could not open PNM input file */
126 /* 33 */ "PNM invoer bestand kon niet geopend worden\n",
127
128 /* version and build date: */
129 /* 34 */ "versie en compileer datum: ", //followed by version number and date
130
131 /* 35 */ "Color correction curve (Gamma) file exists, but is corrupt.\n",
132
133
134 /* 36 */ "POSSIBLE BUFFER OVERFLOW ATTACK!!: length of a path specified as an option exceeds", //followed by maximum allowed size
135
136 /* FATAL: Bad error message */
137
138 "FATAAL: Slechte foutmelding\n"
0 #!/bin/sh
1 # script for testing installation of a PPA printer, v0.5 20000908
2 # (C) 2000 The pnm2ppa project
3
4 # Requires Linux 2.2.x kernels with parport autoprobe support.
5 # assumes all parallel ports are in the range 0-7
6 # (as linux/include/parport.h sets PARPORT_MAX=8)
7
8 MODPROBE="/sbin/modprobe"
9
10 echo "*** Script for testing installation of PPA printers on Linux "
11 echo " (requires 2.2.x kernel or later)"
12 supported="710 720 820 1000"
13
14 if [ "$($MODPROBE -l parport_probe.o )" = "" ] ; then
15 echo "*** kernel module parport_probe.o not found:"
16 echo "*** IEEE-1284 autodetection not supported by this Linux kernel"
17 exit 1
18 fi
19
20 if ! $($MODPROBE -r ) ; then
21 echo "*** Error: cannot load/unload kernel module(s) "
22 echo " You must run this script as root "
23 exit 1
24 fi
25
26 # (re)probe the parport:
27 $MODPROBE -r lp
28 # unload the lowlevel parport driver
29 #(probably only ARCH=pc is OK for PPA printers?)
30 for ARCH in amiga arc atari ax mfc3 pc ; do
31 $MODPROBE -r parport_$ARCH
32 done
33 $MODPROBE lp
34
35 if [ -e /proc/parport ] ; then
36 found=0
37 found_ppa=0
38 ppa_printer=""
39 for n in 0 1 2 3 4 5 6 7 ; do
40 if [ -e /proc/parport/$n/autoprobe ] ; then
41 found=1
42 echo " "
43 echo "Printer found at parallel port $n (usually /dev/lp$n )"
44 echo "IEEE-1284 autoprobe reports:"
45 cat /proc/parport/$n/autoprobe
46 report=$(cat /proc/parport/$n/autoprobe)
47 for printer in $supported ; do
48 if $(echo $report |grep -e "DESKJET $printer" >/dev/null) ; then
49 found_ppa=1
50 text=" type=$printer, port=$n;"
51 ppa_printer=$ppa_printer$text
52 fi
53 done
54 fi
55 done
56 echo " "
57 if [ "$found_ppa" = 0 ] ; then
58 echo "No supported PPA printers attached to parallel port(s) were found"
59 echo "(Make sure the printer's power cable is connected!!)"
60 else
61 echo "Supported PPA printers found on parallel ports:"
62 echo $ppa_printer
63 echo "printers on parallel port <n> are by default accessed by printing to /dev/lp<n>"
64 echo "(unless this was explictly changed when loading the parport module)"
65 fi
66 else
67 echo "*** Error: /proc/parport does not exist:"
68 echo "*** Cannot autoprobe IEEE-1284 parallel port devices."
69 echo "(This requires 2.2.x kernels with IEEE-1284 autoprobe support)"
70 echo "A IEEE-1284 bidirectional parallel port cable is also required"
71 echo "*** Possible causes of error:"
72 echo " 1. You are running an older Linux kernel (2.0.x or earlier)"
73 echo " -- this does NOT mean that you cannot make your PPA printer"
74 echo " work; however, this test script will not work."
75 echo " 2. Check that the printer is properly connected to a parallel"
76 echo " port, with a bidirectional IEEE-1284 cable, and is switched"
77 echo " on. (If your printer works under MS Windows(tm), you have "
78 echo " the correct cable.)"
79 echo " 3. If \"lsmod\" shows that the lp, parport and parport_probe"
80 echo " modules are loaded, but not the architecture-dependent "
81 echo " module parport_pc, you may need to add a line "
82 echo " alias parport_lowlevel parport_pc "
83 echo " to your /etc/conf.modules file (needed for RedHat 6.1)."
84 echo " "
85 echo " (modules for other architectures exist, e.g., parport_ax for "
86 echo " Sun Ultra/AX, but it is not clear whether PPA printers "
87 echo " will work on such hardware (let us know if you try...))"
88 exit 0
89 fi
90
91
92
93
94
95
96
97
0 #!/bin/sh
1 # test_ppa v 1.03
2 # designed for Red Hat Linux systems
3 BINDIR=/usr/bin
4 CONFIG_DIR=/etc
5
6 echo "*** Test/Calibration page printing utility for HP DeskJet PPA printers"
7 echo " Give PPA printer model ( 710 | 712 | 720 | 722 | 820 | 1000 ):"
8
9 read response
10 printer=""
11
12 if $(echo $response | grep -e "710" > /dev/null ) ; then printer=710
13 elif $(echo $response | grep -e "712" > /dev/null ) ; then printer=710
14 elif $(echo $response | grep -e "720" > /dev/null ) ; then printer=720
15 elif $(echo $response | grep -e "722" > /dev/null ) ; then printer=720
16 elif $(echo $response | grep -e "820" > /dev/null ) ; then printer=820
17 elif $(echo $response | grep -e "1000" > /dev/null ) ; then printer=1000
18 fi
19
20 if [ "$printer" = "" ] ; then
21 echo "*** Error: printer model $response is not a valid PPA printer"
22 exit 0
23 fi
24
25 echo " Give desired paper size ( letter | legal | a4 ):"
26 read response
27 paper=""
28
29 case $response in letter | Letter | us | US )
30 paper="letter"
31 page="/usr/lib/rhs/rhs-printfilters/testpage.ps"
32 ;;
33 esac
34
35 case $response in legal | Legal )
36 paper="legal"
37 page="/usr/lib/rhs/rhs-printfilters/testpage.ps"
38 ;;
39 esac
40
41 case $response in a4 | A4 )
42 paper="a4"
43 page="/usr/lib/rhs/rhs-printfilters/testpage-a4.ps"
44 ;;
45 esac
46
47 if [ "$paper" = "" ] ; then
48 echo "*** Error: $response is not a valid paper size"
49 exit 0
50 fi
51
52 echo " Give desired printer port /dev/lpn, n = (0 | 1 | 2):"
53 read response
54
55 port="INVALID PORT"
56 case $response in 0 | 1 | 2 )
57 port="/dev/lp$response"
58 ;;
59 esac
60 case $response in "/dev/lp0" | "/dev/lp1" | "/dev/lp2" )
61 port=$response
62 ;;
63 esac
64
65 if ! [ -e "$port" ] ; then
66 echo "*** Error: printer port $port does not exist"
67 exit 0
68 fi
69
70
71 GSDEVICE=ppmraw
72 DRIVER=pnm2ppa
73 CALIB=calibrate_ppa
74 CFG=$pnm2ppa_conf
75 OPTS="--verbose"
76
77
78 color=""
79 if [ "$DRIVER" = "pnm2ppa" ] ; then
80 echo " *** pnm2ppa can print in color or black-and-white"
81 echo " test in color (1) or black-and-white (2)? [1 | 2] (1):"
82 read response
83 if [ "$response" = "2" ] ; then
84 color="--bw"
85 fi
86 fi
87
88
89 if ! [ -f $BINDIR/$DRIVER ] ; then
90 echo "*** Error: $BINDIR/$DRIVER was not found"
91 echo " is it correctly installed?"
92 exit 0
93 fi
94
95 if ! $(eval "which $DRIVER | grep -e $BINDIR/$DRIVER >/dev/null 2>&1 " ) ; then
96 echo "*** WARNING: the PPA driver $DRIVER found in your path "
97 echo " is not $BINDIR/$DRIVER; \"which $DRIVER\" reports:"
98 which $DRIVER
99 echo " move or delete this other copy of $DRIVER (exit) "
100 exit 0
101 fi
102
103 CFG=$CONFIG_DIR/${DRIVER}.conf
104 if [ -f $CFG ] ; then
105 echo " *** Configuration file $CFG will be used "
106 cfg="-f $CFG"
107 else
108 echo " *** No configuration file $CFG found"
109 cfg=""
110 fi
111
112 if [ -f $page ] ; then
113 echo " *** Do you wish to print a test page ? [Y | N] (N):"
114 read response
115 case $response in y | Y | yes | Yes )
116 eval "cat $page | gs -q \
117 -sDEVICE=$GSDEVICE -dNOPAUSE -r600 -sPAPERSIZE=$paper \
118 -sOutputFile=- -| $BINDIR/$DRIVER $OPTS -v $printer $cfg $color -s $paper \
119 - - > $port"
120 ;;
121 esac
122 fi
123
124 echo " *** Do you wish to print the offset calibration page ? [Y | N] (N):"
125 read response
126 case $response in y | Y | yes | Yes )
127 if ! [ -f $BINDIR/$CALIB ] ; then
128 echo "*** Error: $BINDIR/$CALIB was not found"
129 echo " is it correctly installed?"
130 exit 0
131 fi
132
133 if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
134 echo "*** WARNING: the calibration program $CALIB found in your path "
135 echo " is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
136 which $CALIB
137 echo " move or delete this other copy of $CALIB (exit) "
138 exit 0
139 fi
140
141 echo " see the file CALIBRATION.txt for details of its use"
142 echo " "
143 eval "$CALIB -s $paper --center | $BINDIR/$DRIVER $OPTS -v $printer $cfg --bw \
144 - - > $port"
145 ;;
146 esac
147
148
149 echo " *** Do you wish to print the alignment calibration page ? [Y | N] (N):"
150 read response
151 case $response in y | Y | yes | Yes )
152 if ! [ -f $BINDIR/$CALIB ] ; then
153 echo "*** Error: $BINDIR/$CALIB was not found"
154 echo " is it correctly installed?"
155 exit 0
156 fi
157
158 if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
159 echo "*** WARNING: the calibration program $CALIB found in your path "
160 echo " is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
161 which $CALIB
162 echo " move or delete this other copy of $CALIB (exit) "
163 exit 0
164 fi
165
166 echo " see the file CALIBRATION.txt for details of its use"
167 eval "$CALIB -s $paper --align | $BINDIR/$DRIVER $OPTS -v $printer $cfg --fd \
168 - - > $port"
169 ;;
170 esac
171
172
173 echo " *** Do you wish to print the alignment test page ? [Y | N] (N):"
174 read response
175 case $response in y | Y | yes | Yes )
176 if ! [ -f $BINDIR/$CALIB ] ; then
177 echo "*** Error: $BINDIR/$CALIB was not found"
178 echo " is it correctly installed?"
179 exit 0
180 fi
181
182 if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
183 echo "*** WARNING: the calibration program $CALIB found in your path "
184 echo " is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
185 which $CALIB
186 echo " move or delete this other copy of $CALIB (exit) "
187 exit 0
188 fi
189
190 echo " see the file CALIBRATION.txt for details of its use"
191 eval "$CALIB -s $paper --test | $BINDIR/$DRIVER $OPTS -v $printer $cfg --fd \
192 - - > $port"
193 ;;
194 esac
195
196
197 echo " *** Do you wish to print a color-ink head-cleaning page ? [Y | N] (N):"
198 read response
199 case $response in y | Y | yes | Yes )
200 if ! [ -f $BINDIR/$CALIB ] ; then
201 echo "*** Error: $BINDIR/$CALIB was not found"
202 echo " is it correctly installed?"
203 exit 0
204 fi
205
206 if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
207 echo "*** WARNING: the calibration program $CALIB found in your path "
208 echo " is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
209 which $CALIB
210 echo " move or delete this other copy of $CALIB (exit) "
211 exit 0
212 fi
213
214 echo " see the file CALIBRATION.txt for details of its use"
215 eval "$CALIB -s $paper --clean | $BINDIR/$DRIVER $OPTS -v $printer $cfg -p \
216 - - > $port"
217 ;;
218 esac
219
220
221
222 echo " *** Do you wish to print a black-ink head-cleaning page ? [Y | N] (N):"
223 read response
224 case $response in y | Y | yes | Yes )
225 if ! [ -f $BINDIR/$CALIB ] ; then
226 echo "*** Error: $BINDIR/$CALIB was not found"
227 echo " is it correctly installed?"
228 exit 0
229 fi
230
231 if ! $(eval "which $CALIB | grep -e $BINDIR/$CALIB >/dev/null" ) ; then
232 echo "*** WARNING: the calibration program $CALIB found in your path "
233 echo " is not $BINDIR/$CALIB; \"which $CALIB\" reports:"
234 which $CALIB
235 echo " move or delete this other copy of $CALIB (exit) "
236 exit 0
237 fi
238
239 echo " see the file CALIBRATION.txt for details of its use"
240 eval "$CALIB -s $paper --clean | $BINDIR/$DRIVER $OPTS -v $printer $cfg --bw \
241 - - > $port"
242 ;;
243 esac