[PATCH 1/2] 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
---
foo2xqx-wrapper.in | 10 +++++++---
foo2xqx.c | 13 ++++++++++++-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/foo2xqx-wrapper.in b/foo2xqx-wrapper.in
index d79471d..8c61de4 100755
--- a/foo2xqx-wrapper.in
+++ b/foo2xqx-wrapper.in
@@ -71,6 +71,8 @@ Normal Options:
257=16k197x273, 263=16k184x260, 264=16k195x270
-n copies Number of copies [$COPIES]
-r <xres>x<yres> Set device resolution in pixels/inch [$RES]
+-R Enable special reduced resolution mode for draft printing
+ on HP LaserJet P1005, P1006, P1007, P1008, P1009
-s source Source code to send to printer [$SOURCE]
1=upper, 2=lower, 4=manual, 7=auto
Code numbers may vary with printer model.
@@ -176,6 +178,7 @@ MEDIA=1
COPIES=1
PAPER=1
RES=1200x600
+REDUCEDRESOLUTION=
SOURCE=7
NUP=
CLIP_UL=
@@ -199,7 +202,7 @@ case `$GSBIN --version` in
QUALITY=1
;;
esac
-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
+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
do
case $opt in
b) GSBIN="$OPTARG";;
@@ -211,6 +214,7 @@ do
p) PAPER="$OPTARG";;
q) QUALITY="$OPTARG";;
r) RES="$OPTARG";;
+ R) REDUCEDRESOLUTION=-R;;
s) SOURCE="$OPTARG";;
t) SAVETONER="-t";;
T) DENSITY="$OPTARG";;
@@ -661,7 +665,7 @@ foo2zjs-pstops $PSTOPS_OPTS | \
$PREFILTER \
| ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \
-sOutputFile="|cat 1>&3" $GAMMAFILE -_ >/dev/null) 3>&1 \
-| foo2xqx -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
+| foo2xqx -r$RES $REDUCEDRESOLUTION -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
$COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER -T$DENSITY \
-J "$LPJOB" -U "$USER" \
$BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG
@@ -673,7 +677,7 @@ if [ -x /usr/bin/logger ]; then
logger -t "$BASENAME" -p lpr.info -- \
"$GSBIN $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS $GAMMAFILE"
logger -t "$BASENAME" -p lpr.info -- \
- "foo2xqx -r$RES -g$DIM -p$PAPER -m$MEDIA \
+ "foo2xqx -r$RES $REDUCEDRESOLUTION -g$DIM -p$PAPER -m$MEDIA \
-n$COPIES -d$DUPLEX -s$SOURCE $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG \
$SAVETONER -T$DENSITY $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD"
fi
diff --git a/foo2xqx.c b/foo2xqx.c
index ab61791..68dfb3e 100644
--- a/foo2xqx.c
+++ b/foo2xqx.c
@@ -95,6 +95,7 @@ int BlackClears = 0;
int AllIsBlack = 0;
int OutputStartPlane = 1;
int ExtraPad = 16;
+int ReducedResolution = 0;
int LogicalOffsetX = 0;
int LogicalOffsetY = 0;
@@ -174,6 +175,8 @@ usage(void)
" 257=16k197x273, 263=16k184x260, 264=16k195x270\n"
"-n copies Number of copies [%d]\n"
"-r <xres>x<yres> Set device resolution in pixels/inch [%dx%d]\n"
+"-R Enable special reduced resolution mode for draft printing\n"
+" on HP LaserJet P1005, P1006, P1007, P1008, P1009\n"
"-s source Source code to send to printer [%d]\n"
" 1=upper 2=lower 4=manual 7=auto\n"
" Code numbers may vary with printer model\n"
@@ -1360,7 +1363,7 @@ main(int argc, char *argv[])
int i, j;
while ( (c = getopt(argc, argv,
- "cd:g:n:m:p:r:s:tT:u:l:L:ABPJ:S:U:X:D:V?h")) != EOF)
+ "cd:g:n:m:p:r:Rs:tT:u:l:L:ABPJ:S:U:X:D:V?h")) != EOF)
switch (c)
{
case 'c': Mode = MODE_COLOR; break;
@@ -1383,6 +1386,7 @@ main(int argc, char *argv[])
case 'r': if (parse_xy(optarg, &ResX, &ResY))
error(1, "Illegal format '%s' for -r\n", optarg);
break;
+ case 'R': ReducedResolution = 1; break;
case 's': SourceCode = atoi(optarg); break;
case 't': SaveToner = 1; break;
case 'T': PrintDensity = atoi(optarg);
@@ -1434,6 +1438,13 @@ main(int argc, char *argv[])
Bpp = ResX / 600;
ResX = 600;
+
+ if (ReducedResolution)
+ {
+ Bpp = 2;
+ ResY = 400;
+ }
+
if (SaveToner)
{
SaveToner = 0;
--
2.49.0
Reply to: