~ubuntu-branches/ubuntu/natty/foo2zjs/natty

« back to all changes in this revision

Viewing changes to foo2xqx-wrapper.in

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2010-07-28 22:47:45 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100728224745-5gplbymqfr8588w7
Tags: 20100728-0ubuntu1
* New upstream release
   o Snapshot from Jul 28, 2010.
* debian/patches/91-wrapper-scripts-custom-pagesize-via-command-line.dpatch:
  Removed, fixed upstream.
* debian/patches/30-udev-rules.dpatch,
  debian/patches/60-getweb.in.dpatch: Updated to work with new foo2zjs
  source.
* debian/patches/60-getweb.in.dpatch, debian/patches/80-getweb.in.dpatch:
  merged 80-getweb.in.dpatch into 60-getweb.in.dpatch.
* debian/rules: Added "CUPS_SERVERBIN=..." to the "make install" command
  line.
* debian/foo2zjs.postinst: Migrate driver name "foo2zjs" to "foo2zjs-z1"
  and "foo2zjs-z2".

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#*
19
19
#* Authors: Rick Richardson <rick.richardson@comcast.net>
20
20
 
21
 
VERSION='$Id: foo2xqx-wrapper.in,v 1.29 2009/05/11 17:35:55 rick Exp $'
 
21
VERSION='$Id: foo2xqx-wrapper.in,v 1.35 2010/07/24 15:59:47 rick Exp $'
22
22
 
23
23
#
24
24
# Printer Notes:
25
25
#
26
 
# HP LaserJet M1005     - Same as 2200 DL, plus needs -P
 
26
# HP LaserJet P1005     - 
 
27
# HP LaserJet P1006     - 
 
28
# HP LaserJet P1007     - 
 
29
# HP LaserJet P1008     - 
 
30
# HP LaserJet P1505     - 
 
31
# HP LaserJet P1505n    - 
 
32
# HP LaserJet P2014     - 
 
33
# HP LaserJet P2014n    - 
 
34
# HP LaserJet M1005 MFP - 
 
35
# HP LaserJet M1120 MFP - 
27
36
#
28
37
 
29
38
PROGNAME="$0"
58
67
-p paper          Paper code [$PAPER]
59
68
                    1=letter, 5=legal, 7=executive, 9=A4, 11=A5, 13=B5
60
69
                    20=env#10, 27=envDL 28=envC5 34=envB5 37=envMonarch
 
70
                    257=16k197x273, 263=16k184x260, 264=16k195x270
61
71
-n copies         Number of copies [$COPIES]
62
72
-r <xres>x<yres>  Set device resolution in pixels/inch [$RES]
63
73
-s source         Source code to send to printer [$SOURCE]
64
74
                    1=upper, 2=lower, 4=manual, 7=auto
65
75
                    Code numbers may vary with printer model.
66
76
-t                Draft mode.  Every other pixel is white.
 
77
-T density        Print density (1-5) [$DENSITY]
67
78
-2/-3/-4/-6/-8/-10/-12/-14/-15/-16/-18
68
79
                  Print with N-up (requires psutils)
69
80
-o orient         For N-up: -op is portrait, -ol is landscape, -os is seascape.
139
150
#
140
151
# N.B. := operator used here, when :- would be better, because "ash"
141
152
# doesn't have :-
142
 
if gs.foo -v >/dev/null 2>&1; then
 
153
if eval gs.foo -v >/dev/null 2>&1; then
143
154
        GSBIN=${GSBIN:-gs.foo}
144
155
else
145
156
        GSBIN=${GSBIN:-gs}
177
188
GSOPTS=
178
189
EXTRAPAD=
179
190
SAVETONER=
 
191
DENSITY=3       #Medium
180
192
NUP_ORIENT=
181
193
GSDEV=-sDEVICE=pbmraw
182
194
# What mode to use if the user wants us to pick the "best" mode
185
197
    QUALITY=1
186
198
    ;;
187
199
esac
188
 
while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tABS:D:G:I:PX:Vh?" opt
 
200
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
189
201
do
190
202
        case $opt in
191
203
        b)      GSBIN="$OPTARG";;
199
211
        r)      RES="$OPTARG";;
200
212
        s)      SOURCE="$OPTARG";;
201
213
        t)      SAVETONER="-t";;
 
214
        T)      DENSITY="$OPTARG";;
202
215
        l)      CLIP_LR="-l $OPTARG";;
203
216
        u)      CLIP_UL="-u $OPTARG";;
204
217
        L)      CLIP_LOG="-L $OPTARG";;
310
323
esac
311
324
 
312
325
#
 
326
#       Validate Print Density
 
327
#
 
328
case "$DENSITY" in
 
329
1|2|3|4|5)      ;;
 
330
*)              error "Illegal print density (-T) $DENSITY";;
 
331
esac
 
332
 
 
333
#
313
334
#       Figure out the paper dimensions in pixels/inch, and set the
314
335
#       default clipping region.  Unfortunately, this is a trouble
315
336
#       area for ZjStream printers.  Various versions of ZjS print
348
369
}
349
370
 
350
371
case "$PAPER" in
 
372
Custom*x*)
 
373
                # Command line only
 
374
                XDIM=`echo "$PAPER" | sed -e "s/Custom.//" -e "s/x.*//" `
 
375
                YDIM=`echo "$PAPER" | sed -e "s/.*x//" `
 
376
                if [ "$XDIM" = "" -o "$YDIM" = "" ]; then
 
377
                    error "Custom page size '$PAPER' != 1-99999"
 
378
                fi
 
379
                if [ "$XDIM" -eq 0 -o "$YDIM" -eq 0 ]; then
 
380
                    error "Custom page size '$PAPER' != 1-99999"
 
381
                fi
 
382
                XDIM=`dc -e "$XDIM 1200* 72/p"`
 
383
                YDIM=`dc -e "$YDIM 600* 72/p"`
 
384
                PAPER=359;        paper=letter;
 
385
                set_clipping 2 84     2 84
 
386
                ;;
351
387
Custom*)
 
388
                # PS job
352
389
                #%%BeginFeature: *CustomPageSize True
353
390
                #216
354
391
                #360
420
457
37|envMonarch)  PAPER=37;       paper=envMonarch;XDIM="4650";  YDIM="4500"
421
458
                set_clipping 174 78     173 78
422
459
                ;;
 
460
257|16k197x273) PAPER=257;      paper=executive;XDIM="9306";  YDIM="6448"
 
461
                set_clipping 173 84     173 84
 
462
                ;;
 
463
263|16k184x260) PAPER=263;      paper=executive;XDIM="8692";  YDIM="6142"
 
464
                set_clipping 122 87     122 87
 
465
                ;;
 
466
264|16k195x270) PAPER=264;      paper=executive;XDIM="9212";  YDIM="6378"
 
467
                set_clipping 126 87     126 87
 
468
                ;;
423
469
*)              error "Unimplemented paper code $PAPER";;
424
470
esac
425
471
PAPERSIZE="-sPAPERSIZE=$paper";
609
655
| ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \
610
656
    -sOutputFile="|cat 1>&3" $GAMMAFILE -_ >/dev/null) 3>&1 \
611
657
| foo2xqx -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
612
 
            $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER \
 
658
            $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER -T$DENSITY \
613
659
            -J "$LPJOB" -U "$USER" \
614
660
            $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG
615
661
 
622
668
    logger -t "$BASENAME" -p lpr.info -- \
623
669
        "foo2xqx -r$RES -g$DIM -p$PAPER -m$MEDIA \
624
670
-n$COPIES -d$DUPLEX -s$SOURCE $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG \
625
 
$SAVETONER $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD"
 
671
$SAVETONER -T$DENSITY $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD"
626
672
fi
627
673
 
628
674
#