Skip to content

Commit 6368275

Browse files
committed
Add ReducedResolution mode (-R) for HP LaserJet P1005-1009
Unlike other XQX-based models, HP LaserJet P1005-1009 can't print in real 600x600 DPI mode, requiring special 600x400 mode, in which the rendering is performed in 1200x600 resolution, but the XQX_START_PAGE header tells the printer to use 600x400 printing resolution. LP: #897809
1 parent 88ecb64 commit 6368275

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

foo2xqx-wrapper.in

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Normal Options:
7171
257=16k197x273, 263=16k184x260, 264=16k195x270
7272
-n copies Number of copies [$COPIES]
7373
-r <xres>x<yres> Set device resolution in pixels/inch [$RES]
74+
-R Enable special reduced resolution mode for draft printing
75+
on HP LaserJet P1005, P1006, P1007, P1008, P1009
7476
-s source Source code to send to printer [$SOURCE]
7577
1=upper, 2=lower, 4=manual, 7=auto
7678
Code numbers may vary with printer model.
@@ -176,6 +178,7 @@ MEDIA=1
176178
COPIES=1
177179
PAPER=1
178180
RES=1200x600
181+
REDUCEDRESOLUTION=
179182
SOURCE=7
180183
NUP=
181184
CLIP_UL=
@@ -199,7 +202,7 @@ case `$GSBIN --version` in
199202
QUALITY=1
200203
;;
201204
esac
202-
while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tT:ABS:D:G:I:PX:Vh?" opt
205+
while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:Rs:tT:ABS:D:G:I:PX:Vh?" opt
203206
do
204207
case $opt in
205208
b) GSBIN="$OPTARG";;
@@ -211,6 +214,7 @@ do
211214
p) PAPER="$OPTARG";;
212215
q) QUALITY="$OPTARG";;
213216
r) RES="$OPTARG";;
217+
R) REDUCEDRESOLUTION=-R;;
214218
s) SOURCE="$OPTARG";;
215219
t) SAVETONER="-t";;
216220
T) DENSITY="$OPTARG";;
@@ -661,7 +665,7 @@ foo2zjs-pstops $PSTOPS_OPTS | \
661665
$PREFILTER \
662666
| ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \
663667
-sOutputFile="|cat 1>&3" $GAMMAFILE -_ >/dev/null) 3>&1 \
664-
| foo2xqx -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
668+
| foo2xqx -r$RES $REDUCEDRESOLUTION -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
665669
$COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER -T$DENSITY \
666670
-J "$LPJOB" -U "$USER" \
667671
$BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG
@@ -673,7 +677,7 @@ if [ -x /usr/bin/logger ]; then
673677
logger -t "$BASENAME" -p lpr.info -- \
674678
"$GSBIN $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS $GAMMAFILE"
675679
logger -t "$BASENAME" -p lpr.info -- \
676-
"foo2xqx -r$RES -g$DIM -p$PAPER -m$MEDIA \
680+
"foo2xqx -r$RES $REDUCEDRESOLUTION -g$DIM -p$PAPER -m$MEDIA \
677681
-n$COPIES -d$DUPLEX -s$SOURCE $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG \
678682
$SAVETONER -T$DENSITY $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD"
679683
fi

foo2xqx.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ int BlackClears = 0;
9595
int AllIsBlack = 0;
9696
int OutputStartPlane = 1;
9797
int ExtraPad = 16;
98+
int ReducedResolution = 0;
9899

99100
int LogicalOffsetX = 0;
100101
int LogicalOffsetY = 0;
@@ -174,6 +175,8 @@ usage(void)
174175
" 257=16k197x273, 263=16k184x260, 264=16k195x270\n"
175176
"-n copies Number of copies [%d]\n"
176177
"-r <xres>x<yres> Set device resolution in pixels/inch [%dx%d]\n"
178+
"-R Enable special reduced resolution mode for draft printing\n"
179+
" on HP LaserJet P1005, P1006, P1007, P1008, P1009\n"
177180
"-s source Source code to send to printer [%d]\n"
178181
" 1=upper 2=lower 4=manual 7=auto\n"
179182
" Code numbers may vary with printer model\n"
@@ -1360,7 +1363,7 @@ main(int argc, char *argv[])
13601363
int i, j;
13611364

13621365
while ( (c = getopt(argc, argv,
1363-
"cd:g:n:m:p:r:s:tT:u:l:L:ABPJ:S:U:X:D:V?h")) != EOF)
1366+
"cd:g:n:m:p:r:Rs:tT:u:l:L:ABPJ:S:U:X:D:V?h")) != EOF)
13641367
switch (c)
13651368
{
13661369
case 'c': Mode = MODE_COLOR; break;
@@ -1383,6 +1386,7 @@ main(int argc, char *argv[])
13831386
case 'r': if (parse_xy(optarg, &ResX, &ResY))
13841387
error(1, "Illegal format '%s' for -r\n", optarg);
13851388
break;
1389+
case 'R': ReducedResolution = 1; break;
13861390
case 's': SourceCode = atoi(optarg); break;
13871391
case 't': SaveToner = 1; break;
13881392
case 'T': PrintDensity = atoi(optarg);
@@ -1434,6 +1438,13 @@ main(int argc, char *argv[])
14341438

14351439
Bpp = ResX / 600;
14361440
ResX = 600;
1441+
1442+
if (ReducedResolution)
1443+
{
1444+
Bpp = 2;
1445+
ResY = 400;
1446+
}
1447+
14371448
if (SaveToner)
14381449
{
14391450
SaveToner = 0;

0 commit comments

Comments
 (0)