1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 60_pxl-cups-driver-pdf.dpatch by <till.kamppeter@gmail.com>
4
## All lines beginning with `## DP:' are a description of the patch.
8
diff -urNad ghostscript-8.63.dfsg.1~/cups/pstopxl.in ghostscript-8.63.dfsg.1/cups/pstopxl.in
9
--- ghostscript-8.63.dfsg.1~/cups/pstopxl.in 2007-12-05 01:08:50.000000000 +0100
10
+++ ghostscript-8.63.dfsg.1/cups/pstopxl.in 2008-11-26 11:21:02.000000000 +0100
14
-# "$Id: pstopxl.in,v 1.1.2.2 2004/06/29 13:15:10 mike Exp $"
15
+# "$Id: pstopxl.in 9239 2008-11-24 19:15:04Z till $"
17
# CUPS PCL XL/PCL 6 filter script for Ghostscript.
23
+# Apply PPD settings.
29
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)Resolution=([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\2}"/p')"
30
+if test -e "$PPD"; then
31
+ eval "$(sed -nre 's/^\*DefaultResolution:\s+([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\1}"/p' "$PPD")"
33
+echo "DEBUG: Resolution: $resolution" >&2
34
+if test -n "$resolution"; then
35
+ ppd_opts="${ppd_opts:+$ppd_opts }-r$resolution"
39
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(media|PageSize)=(\S+).*/pagesize="${pagesize:-\3}"/p')"
40
+if test -e "$PPD"; then
41
+ eval "$(sed -nre 's/^\*DefaultPageSize:\s+(\S+).*/pagesize="${pagesize:-\1}"/p' "$PPD")"
43
+echo "DEBUG: Page size: $pagesize" >&2
46
+if test -n "$pagesize" && test -e "$PPD"; then
47
+ eval "$(sed -nre 's|^\*PaperDimension\s+'"$pagesize"'/[^:]+:\s+"(\S+)\s+(\S+)".*|width="\1"; height="\2"|p' "$PPD")"
49
+echo "DEBUG: Width: $width, height: $height" >&2
50
+if test -n "$width"; then
51
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEWIDTHPOINTS=$width"
53
+if test -n "$height"; then
54
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEHEIGHTPOINTS=$height"
61
+if test -n "$pagesize" && test -e "$PPD"; then
62
+ eval "$(sed -nre 's|^\*ImageableArea\s+'"$pagesize"'/[^:]+:\s+"(\S+)\s+(\S+)\s+(\S+)\s+(\S+)".*|bl_x="\1"; bl_y="\2"; tr_x="\3"; tr_y="\4"|p' "$PPD")"
64
+echo "DEBUG: Absolute margins: $bl_x, $bl_y, $tr_x, $tr_y" >&2
69
+if test -n "$width" && test -n "$height" && \
70
+ test -n "$bl_x" && test -n "$bl_y" && \
71
+ test -n "$tr_x" && test -n "$tr_y"; then
74
+ margin_r="$(printf "scale=8; (%s)-(%s)\n" "$width" "$tr_x" | bc)"
75
+ margin_t="$(printf "scale=8; (%s)-(%s)\n" "$height" "$tr_y" | bc)"
77
+echo "DEBUG: Relative margins: $margin_l, $margin_b, $margin_r, $margin_t" >&2
78
+if test -n "$margin_l" && test -n "$margin_b" && \
79
+ test -n "$margin_r" && test -n "$margin_t"; then
80
+ ps_code="${ps_code:+$ps_code }<</.HWMargins[$margin_l $margin_b $margin_r $margin_t] /Margins[0 0]>>setpagedevice"
84
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(InputSlot)=(\S+).*/inputslot="${inputslot:-\3}"/p')"
85
+if test -e "$PPD"; then
86
+ eval "$(sed -nre 's/^\*DefaultInputSlot:\s+(\S+).*/inputslot="${inputslot:-\1}"/p' "$PPD")"
88
+echo "DEBUG: InputSlot: $inputslot" >&2
90
+if test -n "$inputslot" && test -e "$PPD"; then
91
+ eval "$(sed -nre 's|^\*InputSlot\s+'"$inputslot"'/[^:]+:\s+"\s*<\s*<\s*/MediaPosition\s*([0-9]+)\s*>\s*>\s*setpagedevice\s*".*|inputslot_val="\1"|p' "$PPD")"
93
+echo "DEBUG: Value for MediaPosition: $inputslot_val" >&2
94
+if test -n "$inputslot_val"; then
95
+ ppd_opts="${ppd_opts:+$ppd_opts }-dMediaPosition=$inputslot_val"
99
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(ColorModel)=(\S+).*/colormodel="${colormodel:-\3}"/p')"
100
+if test -e "$PPD"; then
101
+ eval "$(sed -nre 's/^\*DefaultColorModel:\s+(\S+).*/colormodel="${colormodel:-\1}"/p' "$PPD")"
103
+echo "DEBUG: ColorModel: $colormodel" >&2
105
+if test -n "$colormodel" && test -e "$PPD"; then
106
+ eval "$(sed -nre 's|^\*ColorModel\s+'"$colormodel"'/[^:]+:\s+"\s*<\s*<\s*/BitsPerPixel\s*([0-9]*)\s*>\s*>\s*setpagedevice\s*".*|colormodel_val="\1"|p' "$PPD")"
108
+echo "DEBUG: Value for BitsPerPixel: $colormodel_val" >&2
109
+if test -n "$colormodel_val"; then
110
+ ppd_opts="${ppd_opts:+$ppd_opts }-dBitsPerPixel=$colormodel_val"
114
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(Duplex)=(\S+).*/duplex="${duplex:-\3}"/p')"
115
+if test -e "$PPD"; then
116
+ eval "$(sed -nre 's/^\*DefaultDuplex:\s+(\S+).*/duplex="${duplex:-\1}"/p' "$PPD")"
118
+echo "DEBUG: Duplex: $duplex" >&2
121
+if test -n "$duplex" && test -e "$PPD"; then
122
+ eval "$(sed -nre 's|^\*Duplex\s+'"$duplex"'/[^:]+:\s+"\s*<\s*<\s*/Duplex\s*(\S*)\s*(/Tumble\s*(\S*)\s*)?>\s*>\s*setpagedevice\s*".*|duplex_val="\1"; tumble_val="\3"|p' "$PPD")"
124
+echo "DEBUG: Value for Duplex: $duplex_val; Value for Tumble: $tumble_val" >&2
125
+if test -n "$duplex_val"; then
126
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDuplex=$duplex_val"
128
+if test -n "$tumble_val"; then
129
+ ppd_opts="${ppd_opts:+$ppd_opts }-dTumble=$tumble_val"
133
+echo "DEBUG: PPD options: $ppd_opts" >&2
134
+echo "DEBUG: PostScript code from options: $ps_code" >&2
136
# Options we use with Ghostscript...
137
-gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH"
138
-gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=$device -sstdout=%stderr"
139
+gsopts="-dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH"
140
+gsopts="$gsopts -sDEVICE=$device -sstdout=%stderr"
142
# See if we have a filename on the command-line...
143
-if test -z "$6"; then
147
+if [ -n "$6" ]; then
151
+# We read the data into a temporary file as Ghostscript needs this to be
152
+# able to also work with PDF input
154
+trap 'rm -f $tempfiles' 0 1 2 13 15
156
+ifile=$(mktemp -t pstopxl.XXXXXX)
157
+tempfiles="$tempfiles $ifile"
161
echo INFO: Starting GPL Ghostscript `$bindir/@GS@ --version`... 1>&2
162
-echo DEBUG: Running $bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" "$ifile" 1>&2
163
+echo DEBUG: Running $bindir/@GS@ $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile" 1>&2
165
# Now run Ghostscript...
166
-exec $bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" "$ifile"
167
+$bindir/@GS@ $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile"
170
-# End of "$Id: pstopxl.in,v 1.1.2.2 2004/06/29 13:15:10 mike Exp $".
171
+# End of "$Id: pstopxl.in 9239 2008-11-24 19:15:04Z till $".
173
diff -urNad ghostscript-8.63.dfsg.1~/cups/pxlcolor.ppd ghostscript-8.63.dfsg.1/cups/pxlcolor.ppd
174
--- ghostscript-8.63.dfsg.1~/cups/pxlcolor.ppd 2007-09-08 19:05:59.000000000 +0200
175
+++ ghostscript-8.63.dfsg.1/cups/pxlcolor.ppd 2008-11-26 11:20:54.000000000 +0100
179
-*% "$Id: pxlcolor.ppd,v 1.1.2.1 2003/07/20 22:54:45 mike Exp $"
180
+*% "$Id: pxlcolor.ppd 9239 2008-11-24 19:15:04Z till $"
182
*% Sample color PCL XL/PCL 6 driver PPD file for the Common UNIX
183
*% Printing System (CUPS).
185
*Product: "(GPL Ghostscript)"
187
*cupsManualCopies: False
188
-*cupsFilter: "application/vnd.cups-postscript 0 pstopxl"
189
+*cupsFilter: "application/vnd.cups-postscript 100 pstopxl"
190
+*cupsFilter: "application/vnd.cups-pdf 0 pstopxl"
191
*ModelName: "HP Color LaserJet Series PCL 6"
192
*ShortNickName: "HP Color LaserJet Series PCL 6"
193
*NickName: "HP Color LaserJet Series PCL 6 CUPS"
195
*UIConstraints: *PageSize A5 *InputSlot Envelope
196
*UIConstraints: *PageSize B5 *InputSlot Envelope
197
*UIConstraints: *Duplex *OptionDuplex False
198
+*UIConstraints: *InputSlot Envelope *PageSize Executive
199
+*UIConstraints: *InputSlot Envelope *PageSize Letter
200
+*UIConstraints: *InputSlot Envelope *PageSize Legal
201
+*UIConstraints: *InputSlot Envelope *PageSize Tabloid
202
+*UIConstraints: *InputSlot Envelope *PageSize A3
203
+*UIConstraints: *InputSlot Envelope *PageSize A4
204
+*UIConstraints: *InputSlot Envelope *PageSize A5
205
+*UIConstraints: *InputSlot Envelope *PageSize B5
206
+*UIConstraints: *OptionDuplex False *Duplex
208
*OpenUI *PageSize/Media Size: PickOne
209
*OrderDependency: 10 AnySetup *PageSize
210
@@ -143,10 +153,11 @@
212
*OpenUI *Resolution/Output Resolution: PickOne
213
*OrderDependency: 20 AnySetup *Resolution
214
-*DefaultResolution: 300dpi
215
+*DefaultResolution: 600dpi
216
*Resolution 150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice"
217
*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice"
218
*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]>>setpagedevice"
219
+*Resolution 1200dpi/1200 DPI: "<</HWResolution[1200 1200]>>setpagedevice"
220
*CloseUI: *Resolution
222
*OpenUI *Duplex/Double-Sided Printing: PickOne
224
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
225
*Font ZapfDingbats: Special "(001.004S)" Standard ROM
227
-*% End of "$Id: pxlcolor.ppd,v 1.1.2.1 2003/07/20 22:54:45 mike Exp $".
228
+*% End of "$Id: pxlcolor.ppd 9239 2008-11-24 19:15:04Z till $".
230
diff -urNad ghostscript-8.63.dfsg.1~/cups/pxlmono.ppd ghostscript-8.63.dfsg.1/cups/pxlmono.ppd
231
--- ghostscript-8.63.dfsg.1~/cups/pxlmono.ppd 2007-09-08 19:05:59.000000000 +0200
232
+++ ghostscript-8.63.dfsg.1/cups/pxlmono.ppd 2008-11-26 11:20:54.000000000 +0100
236
-*% "$Id: pxlmono.ppd,v 1.1.2.1 2003/07/20 22:54:45 mike Exp $"
237
+*% "$Id: pxlmono.ppd 9239 2008-11-24 19:15:04Z till $"
239
*% Sample monochrome PCL XL/PCL 6 driver PPD file for the Common UNIX
240
*% Printing System (CUPS).
242
*Product: "(GPL Ghostscript)"
244
*cupsManualCopies: False
245
-*cupsFilter: "application/vnd.cups-postscript 0 pstopxl"
246
+*cupsFilter: "application/vnd.cups-postscript 100 pstopxl"
247
+*cupsFilter: "application/vnd.cups-pdf 0 pstopxl"
248
*ModelName: "HP LaserJet Series PCL 6"
249
*ShortNickName: "HP LaserJet Series PCL 6"
250
*NickName: "HP LaserJet Series PCL 6 CUPS"
252
*UIConstraints: *PageSize A5 *InputSlot Envelope
253
*UIConstraints: *PageSize B5 *InputSlot Envelope
254
*UIConstraints: *Duplex *OptionDuplex False
255
+*UIConstraints: *InputSlot Envelope *PageSize Executive
256
+*UIConstraints: *InputSlot Envelope *PageSize Letter
257
+*UIConstraints: *InputSlot Envelope *PageSize Legal
258
+*UIConstraints: *InputSlot Envelope *PageSize Tabloid
259
+*UIConstraints: *InputSlot Envelope *PageSize A3
260
+*UIConstraints: *InputSlot Envelope *PageSize A4
261
+*UIConstraints: *InputSlot Envelope *PageSize A5
262
+*UIConstraints: *InputSlot Envelope *PageSize B5
263
+*UIConstraints: *OptionDuplex False *Duplex
265
*OpenUI *PageSize/Media Size: PickOne
266
*OrderDependency: 10 AnySetup *PageSize
268
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
269
*Font ZapfDingbats: Special "(001.004S)" Standard ROM
271
-*% End of "$Id: pxlmono.ppd,v 1.1.2.1 2003/07/20 22:54:45 mike Exp $".
272
+*% End of "$Id: pxlmono.ppd 9239 2008-11-24 19:15:04Z till $".