summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2013-03-04 10:42:25 +0100
committerDidier Raboud <odyx@debian.org>2013-03-04 10:42:25 +0100
commitc872b72f9ca69dc5852d849468af4c0f1d013f2c (patch)
tree7f8217bcd9d87db9a80ae022989dcae774822900
parentea5b4b01ae1bffe2906831518f5c75532a236373 (diff)
Imported Upstream version 20130303
-rw-r--r--ChangeLog17
-rw-r--r--INSTALL2
-rw-r--r--INSTALL.in2
-rw-r--r--Makefile88
-rw-r--r--PPD/Dell-1355.ppd433
-rw-r--r--PPD/Fuji_Xerox-DocuPrint_CM205.ppd433
-rw-r--r--PPD/Xerox-WorkCentre_6015.ppd433
-rw-r--r--foo2hbpl2-wrapper.1in239
-rwxr-xr-xfoo2hbpl2-wrapper.in724
-rw-r--r--foo2hbpl2.1in203
-rw-r--r--foo2hbpl2.c1693
-rw-r--r--foomatic-db/driver/foo2hbpl2.xml19
-rw-r--r--foomatic-db/opt/foo2hbpl2-ColorMode.xml38
-rw-r--r--foomatic-db/opt/foo2hbpl2-ICM.xml70
-rw-r--r--foomatic-db/opt/foo2hbpl2-MediaType.xml82
-rw-r--r--foomatic-db/opt/foo2hbpl2-PageSize.xml80
-rw-r--r--foomatic-db/opt/foo2xxx-Copies.xml4
-rw-r--r--foomatic-db/opt/foo2xxx-Halftone.xml4
-rw-r--r--foomatic-db/opt/foo2xxx-Nup.xml4
-rw-r--r--foomatic-db/opt/foo2xxx-NupOrient.xml4
-rw-r--r--foomatic-db/opt/foo2xxx-Quality.xml4
-rw-r--r--foomatic-db/printer/Dell-1355.xml71
-rw-r--r--foomatic-db/printer/Fuji_Xerox-DocuPrint_CM205.xml71
-rw-r--r--foomatic-db/printer/Xerox-WorkCentre_6015.xml71
-rw-r--r--hbpl.h256
-rw-r--r--hbpldecode.1in5
-rw-r--r--hbpldecode.c396
-rw-r--r--printer-profile.1in1
-rwxr-xr-xprinter-profile.sh14
29 files changed, 5289 insertions, 172 deletions
diff --git a/ChangeLog b/ChangeLog
index 48d2151..42f614d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-03-03 Rick Richardson <rick.richardson@comcast.net>
+ * printer-profile: add dell 1355.
+ * foo2hbpl2: merge in changes from Peter Korf <peter@niendo.de>
+ * hbpldecode: swap yellow and cyan
+ * New Printers: Fuji Xerox DocuPrint CP205
+ * hbpldecode: implement -d option
+
+2013-03-02 Rick Richardson <rick.richardson@comcast.net>
+ * foo2hbpl2 et al: Added manual pages.
+ * foo2hbpl2 et al: added new page sizes for envelopes
+
+2013-03-01 Rick Richardson <rick.richardson@comcast.net>
+ * foo2hbpl2, foo2hbpl2-wrapper, foomatic and PPD stuff: Added
+ * New Printers: Dell 1355 and Xerox WorkCentre 6015
+ - pre-alpha quality !!!!!!
+ * merge in changes from Peter Korf <peter@niendo.de>
+
2013-02-20 Rick Richardson <rick.richardson@comcast.net>
* install-hotplug: Fedora 18 changed "/usr/lib/udev/udevd"
to "/usr/lib/systemd/systemd-udevd".
diff --git a/INSTALL b/INSTALL
index 8e5f82b..57c9bda 100644
--- a/INSTALL
+++ b/INSTALL
@@ -157,7 +157,7 @@ Create printers (command line using CUPS)
# lpadmin -p hp1020 -v usb://HP/LaserJet%201020 -E \
-P /usr/share/cups/model/HP-LaserJet_1020.ppd.gz
Set the default:
- # ldadmin -p NAME -d
+ # lpadmin -d NAME
Create at least one queue for monochrome, and another queue
for color printing. Create the queues, then edit them and
diff --git a/INSTALL.in b/INSTALL.in
index 0b5be64..d036079 100644
--- a/INSTALL.in
+++ b/INSTALL.in
@@ -129,7 +129,7 @@ Create printers (command line using CUPS)
# lpadmin -p hp1020 -v usb://HP/LaserJet%201020 -E \
-P /usr/share/cups/model/HP-LaserJet_1020.ppd.gz
Set the default:
- # ldadmin -p NAME -d
+ # lpadmin -d NAME
Create at least one queue for monochrome, and another queue
for color printing. Create the queues, then edit them and
diff --git a/Makefile b/Makefile
index db7f83b..cf6321b 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,7 @@ SHARELAVA=$(PREFIX)/share/foo2lava
SHAREQPDL=$(PREFIX)/share/foo2qpdl
SHARESLX=$(PREFIX)/share/foo2slx
SHAREHC=$(PREFIX)/share/foo2hiperc
+SHAREHBPL=$(PREFIX)/share/foo2hbpl
MANDIR=$(PREFIX)/share/man
DOCDIR=$(PREFIX)/share/doc/foo2zjs/
INSTALL=install
@@ -145,6 +146,9 @@ FILES = \
foo2slx.1in \
foo2hiperc.c \
foo2hiperc.1in \
+ hbpl.h \
+ foo2hbpl2.c \
+ foo2hbpl2.1in \
cups.h \
xqx.h \
xqxdecode.c \
@@ -177,6 +181,8 @@ FILES = \
foo2slx-wrapper.1in \
foo2hiperc-wrapper.in \
foo2hiperc-wrapper.1in \
+ foo2hbpl2-wrapper.in \
+ foo2hbpl2-wrapper.1in \
gamma.ps \
gamma-lookup.ps \
align.ps \
@@ -250,8 +256,8 @@ PROGS+= foo2lava lavadecode foo2qpdl qpdldecode opldecode
PROGS+= foo2oak oakdecode
PROGS+= foo2slx slxdecode
PROGS+= foo2hiperc hipercdecode
+PROGS+= foo2hbpl2 hbpldecode
PROGS+= gipddecode
-PROGS+= hbpldecode
ifneq ($(CUPS_SERVERBIN),)
ifneq ($(CUPS_DEVEL),)
ifneq ($(CUPS_GOODAPI),)
@@ -261,7 +267,7 @@ ifneq ($(CUPS_SERVERBIN),)
endif
SHELLS= foo2zjs-wrapper foo2oak-wrapper foo2hp2600-wrapper \
foo2xqx-wrapper foo2lava-wrapper foo2qpdl-wrapper \
- foo2slx-wrapper foo2hiperc-wrapper
+ foo2slx-wrapper foo2hiperc-wrapper foo2hbpl2-wrapper
SHELLS+= foo2zjs-pstops
SHELLS+= printer-profile
MANPAGES= foo2zjs-wrapper.1 foo2zjs.1 zjsdecode.1
@@ -272,8 +278,8 @@ MANPAGES+= foo2lava-wrapper.1 foo2lava.1 lavadecode.1 opldecode.1
MANPAGES+= foo2qpdl-wrapper.1 foo2qpdl.1 qpdldecode.1
MANPAGES+= foo2slx-wrapper.1 foo2slx.1 slxdecode.1
MANPAGES+= foo2hiperc-wrapper.1 foo2hiperc.1 hipercdecode.1
+MANPAGES+= foo2hbpl2-wrapper.1 foo2hbpl2.1 hbpldecode.1
MANPAGES+= gipddecode.1
-MANPAGES+= hbpldecode.1
MANPAGES+= foo2zjs-pstops.1 arm2hpdl.1 usb_printerid.1
MANPAGES+= printer-profile.1
LIBJBG = jbig.o jbig_ar.o
@@ -299,7 +305,7 @@ GSOPTS= -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=letter -r$(GXR)x$(GYR)
JBGOPTS=-m 16 -d 0 -p 92 # Equivalent options for pbmtojbg
.SUFFIXES: .ps .pbm .pgm .pgm2 .ppm .ppm2 .zjs .cmyk .pksm .zc .zm .jbg \
- .cups .cupm .1 .1in .fig .gif .xqx .lava .qpdl .slx .hc
+ .cups .cupm .1 .1in .fig .gif .xqx .lava .qpdl .slx .hc .hbpl
.fig.gif:
fig2dev -L gif $*.fig | giftrans -t "#ffffff" -o $*.gif
@@ -364,6 +370,9 @@ JBGOPTS=-m 16 -d 0 -p 92 # Equivalent options for pbmtojbg
.pbm.hc:
./foo2hiperc < $*.pbm > $*.hc
+.pbm.hbpl:
+ ./foo2hbpl2 < $*.pbm > $*.hbpl
+
#
# The usual build rules
#
@@ -465,6 +474,9 @@ foo2slx: foo2slx.o $(LIBJBG)
foo2hiperc: foo2hiperc.o $(LIBJBG)
$(CC) $(CFLAGS) -o $@ foo2hiperc.o $(LIBJBG)
+foo2hbpl2: foo2hbpl2.o $(LIBJBG)
+ $(CC) $(CFLAGS) -o $@ foo2hbpl2.o $(LIBJBG)
+
foo2zjs-wrapper: foo2zjs-wrapper.in Makefile
[ ! -f $@ ] || chmod +w $@
@@ -514,6 +526,12 @@ foo2hiperc-wrapper: foo2hiperc-wrapper.in Makefile
-e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
chmod 555 $@
+foo2hbpl2-wrapper: foo2hbpl2-wrapper.in Makefile
+ [ ! -f $@ ] || chmod +w $@
+ sed < $@.in > $@ \
+ -e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
+ chmod 555 $@
+
foo2zjs-wrapper9: foo2zjs-wrapper9.in Makefile
[ ! -f $@ ] || chmod +w $@
sed < $@.in > $@ \
@@ -807,6 +825,13 @@ install-extra:
$(INSTALL) -c -m 644 $$i $(SHAREHC)/icm/; \
fi; \
done
+ # foo2hbpl ICM files (if any)
+ $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREHBPL)/icm/
+ for i in hbpl*.icm; do \
+ if [ -f $$i ]; then \
+ $(INSTALL) -c -m 644 $$i $(SHAREHBPL)/icm/; \
+ fi; \
+ done
MODEL=$(DESTDIR)/usr/share/cups/model
LOCALMODEL=$(DESTDIR)/usr/local/share/cups/model
@@ -836,6 +861,7 @@ install-ppd:
find $(PPD) -name '*foo2qpdl*' | xargs rm -rf; \
find $(PPD) -name '*foo2slx*' | xargs rm -rf; \
find $(PPD) -name '*foo2hiperc*' | xargs rm -rf; \
+ find $(PPD) -name '*foo2hbpl*' | xargs rm -rf; \
[ -d $(PPD)/foo2zjs ] || mkdir $(PPD)/foo2zjs; \
cd PPD; \
for ppd in *.ppd; do \
@@ -1068,8 +1094,8 @@ uninstall:
-rm -f $(MANDIR)/man1/foo2xqx*.1 $(MANDIR)/man1/xqxdecode.1
-rm -f $(MANDIR)/man1/opldecode.1 $(MANDIR)/man1/rodecode.1
-rm -f $(MANDIR)/man1/foo2hiperc*.1 $(MANDIR)/man1/hipercdecode.1
+ -rm -f $(MANDIR)/man1/foo2hbpl*.1 $(MANDIR)/man1/hbpldecode.1
-rm -f $(MANDIR)/man1/gipddecode.1
- -rm -f $(MANDIR)/man1/hbpldecode.1
-rm -f $(MANDIR)/man1/arm2hpdl.1 $(MANDIR)/man1/usb_printerid.1
-rm -f $(MANDIR)/man1/foo2zjs-icc2ps.1
-rm -rf /usr/share/foo2zjs/
@@ -1080,6 +1106,7 @@ uninstall:
-rm -rf /usr/share/foo2qpdl/
-rm -rf /usr/share/foo2slx/
-rm -rf /usr/share/foo2hiperc/
+ -rm -rf /usr/share/foo2hbpl/
-rm -f /usr/bin/arm2hpdl
-rm -f /usr/bin/foo2zjs-wrapper /usr/bin/foo2zjs /usr/bin/zjsdecode
-rm -f /usr/bin/foo2oak-wrapper /usr/bin/foo2oak /usr/bin/oakdecode
@@ -1089,6 +1116,7 @@ uninstall:
-rm -f /usr/bin/foo2qpdl-wrapper /usr/bin/foo2qpdl /usr/bin/qpdldecode
-rm -f /usr/bin/foo2slx-wrapper /usr/bin/foo2slx /usr/bin/slxdecode
-rm -f /usr/bin/foo2hiperc-wrapper /usr/bin/foo2hiperc
+ -rm -f /usr/bin/foo2hbpl2-wrapper /usr/bin/foo2hbpl2
-rm -f /usr/bin/hipercdecode
-rm -f /usr/bin/gipddecode
-rm -f /usr/bin/hbpldecode
@@ -1122,10 +1150,11 @@ clean:
-rm -f foo2qpdl.o qpdldecode.o
-rm -f foo2slx.o slxdecode.o
-rm -f foo2hiperc.o hipercdecode.o
- -rm -f opldecode.o gipddecode.o hbpldecode.o
+ -rm -f foo2hbpl2.o hbpldecode.o
+ -rm -f opldecode.o gipddecode.o
-rm -f command2foo2lava-pjl.o
-rm -f foo2oak.html foo2zjs.html foo2hp.html foo2xqx.html foo2lava.html
- -rm -f foo2slx.html foo2qpdl.html foo2hiperc.html
+ -rm -f foo2slx.html foo2qpdl.html foo2hiperc.html foo2hbpl.html
-rm -f index.html
-rm -f arch*.gif
-rm -f sihp*.dl
@@ -1142,16 +1171,17 @@ clean:
#
# Header dependencies
#
-zjsdecode.o: zjs.h jbig.h
-foo2zjs.o: zjs.h jbig.h
-foo2oak.o: oak.h jbig.h
+zjsdecode.o: jbig.h zjs.h
+foo2zjs.o: jbig.h zjs.h
+foo2oak.o: jbig.h oak.h
jbig.o: jbig.h
-foo2hp.o: zjs.h jbig.h cups.h
-foo2xqx.o: xqx.h jbig.h
+foo2hp.o: jbig.h zjs.h cups.h
+foo2xqx.o: jbig.h xqx.h
foo2lava.o: jbig.h
foo2qpdl.o: jbig.h qpdl.h
-foo2slx.o: slx.h jbig.h
+foo2slx.o: jbig.h slx.h
foo2hiperc.o: jbig.h hiperc.h
+foo2hbpl2.o: jbig.h hbpl.h
hipercdecode.o: hiperc.h jbig.h
hbpldecode.o: jbig.h
lavadecode.o: jbig.h
@@ -1356,6 +1386,8 @@ ppd:
*C3530*) driver=foo2hiperc;; \
*C5[12568][05]0*) driver=foo2hiperc;; \
*CLP*|*CLX*|*6110*) driver=foo2qpdl;; \
+ *6015*|*1355*) driver=foo2hbpl2;; \
+ *CM205*) driver=foo2hbpl2;; \
*) driver=foo2zjs;; \
esac; \
echo $$driver - $$printer; \
@@ -1417,24 +1449,26 @@ install-man: man
$(INSTALL) -c -m 644 oakdecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2hp.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2hp2600-wrapper.1 $(MANDIR)/man1/
- $(INSTALL) -c -m 644 xqxdecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2xqx.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2xqx-wrapper.1 $(MANDIR)/man1/
- $(INSTALL) -c -m 644 lavadecode.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 xqxdecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2lava.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2lava-wrapper.1 $(MANDIR)/man1/
- $(INSTALL) -c -m 644 qpdldecode.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 lavadecode.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 opldecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2qpdl.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2qpdl-wrapper.1 $(MANDIR)/man1/
- $(INSTALL) -c -m 644 opldecode.1 $(MANDIR)/man1/
- $(INSTALL) -c -m 644 slxdecode.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 qpdldecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2slx.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2slx-wrapper.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 slxdecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2hiperc.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2hiperc-wrapper.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 hipercdecode.1 $(MANDIR)/man1/
- $(INSTALL) -c -m 644 gipddecode.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 foo2hbpl2.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 foo2hbpl2-wrapper.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 hbpldecode.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 gipddecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2zjs-pstops.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 arm2hpdl.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 usb_printerid.1 $(MANDIR)/man1/
@@ -1547,11 +1581,12 @@ URLLAVA=http://foo2lava.rkkda.com
URLQPDL=http://foo2qpdl.rkkda.com
URLSLX=http://foo2slx.rkkda.com
URLHC=http://foo2hiperc.rkkda.com
+URLHBPL=http://foo2hbpl.rkkda.com
FTPSITE=~/.ncftp-website
foo2zjs.html foo2oak.html foo2hp.html \
foo2xqx.html foo2lava.html foo2qpdl.html \
- foo2slx.html foo2hiperc.html: thermometer.gif FRC
+ foo2slx.html foo2hiperc.html foo2hbpl.html: thermometer.gif FRC
rm -f $@
HERE=`basename $$PWD`; \
TZ=`date | cut -c 21-24`; \
@@ -1568,6 +1603,7 @@ foo2zjs.html foo2oak.html foo2hp.html \
-e "s@\$${URLQPDL}@$(URLQPDL)@g" \
-e "s@\$${URLSLX}@$(URLSLX)@g" \
-e "s@\$${URLHC}@$(URLHC)@g" \
+ -e "s@\$${URLHBPL}@$(URLHBPL)@g" \
-e "s@\$${PRODUCT}@$$PRODUCT@g" \
-e "s/\$${MODindex}/$$MODindex $$TZ/" \
-e "s/\$${MODtarball}/$$MODtarball $$TZ/"
@@ -1584,7 +1620,7 @@ webt: tar manual.pdf webindex
webworld: web webpics
webindex: INSTALL zjsindex oakindex hpindex xqxindex lavaindex \
- qpdlindex oakindex slxindex hcindex
+ qpdlindex oakindex slxindex hcindex hbplindex
webpics: redhat suse ubuntu mandriva fedora
@@ -1596,7 +1632,7 @@ zjsindex: foo2zjs.html archzjs.gif thermometer.gif webphotos
ncftpput -m -f $(FTPSITE) foo2zjs \
index.html style.css archzjs.gif thermometer.gif \
images/flags.png INSTALL INSTALL.osx images/zjsfavicon.png \
- printer-photos/printers.jpg;
+ tablesort.js printer-photos/printers.jpg;
oakindex: foo2oak.html archoak.gif thermometer.gif webphotos
ln -sf foo2oak.html index.html
@@ -1647,6 +1683,13 @@ hcindex: foo2hiperc.html archhiperc.gif thermometer.gif webphotos
images/flags.png INSTALL images/hipercfavicon.png \
printer-photos/printers.jpg;
+hbplindex: foo2hbpl.html archhbpl.gif thermometer.gif webphotos
+ ln -sf foo2hbpl.html index.html
+ ncftpput -m -f $(FTPSITE) foo2hbpl \
+ index.html style.css archhbpl.gif thermometer.gif \
+ images/flags.png INSTALL images/hbplfavicon.png \
+ printer-photos/printers.jpg;
+
foo2zjs.html: warning.html contribute.html resources.html unsupported.html
foo2hp.html: warning.html contribute.html resources.html unsupported.html
foo2xqx.html: warning.html contribute.html resources.html unsupported.html
@@ -1655,6 +1698,7 @@ foo2qpdl.html: warning.html contribute.html resources.html unsupported.html
foo2slx.html: warning.html contribute.html resources.html unsupported.html
foo2hiperc.html: warning.html contribute.html resources.html unsupported.html
foo2oak.html: warning.html contribute.html resources.html unsupported.html
+foo2hbpl.html: warning.html contribute.html resources.html unsupported.html
# RedHat
redhat: FRC
diff --git a/PPD/Dell-1355.ppd b/PPD/Dell-1355.ppd
new file mode 100644
index 0000000..44a2e1f
--- /dev/null
+++ b/PPD/Dell-1355.ppd
@@ -0,0 +1,433 @@
+*PPD-Adobe: "4.3"
+*%
+*% For information on using this, and to obtain the required backend
+*% script, consult http://www.openprinting.org/
+*%
+*% This file is published under the GNU General Public License
+*%
+*% PPD-O-MATIC (3.0.0 or newer) generated this PPD file. It is for use with
+*% all programs and environments which use PPD files for dealing with
+*% printer capability information. The printer must be configured with the
+*% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This
+*% file and "foomatic-rip" work together to support PPD-controlled printer
+*% driver option access with arbitrary free software printer drivers and
+*% printing spoolers.
+*%
+*% To save this file on your disk, wait until the download has completed
+*% (the animation of the browser logo must stop) and then use the
+*% "Save as..." command in the "File" menu of your browser or in the
+*% pop-up manu when you click on this document with the right mouse button.
+*% DO NOT cut and paste this file into an editor with your mouse. This can
+*% introduce additional line breaks which lead to unexpected results.
+*%
+*% You may save this file as 'Dell-1355-foo2hbpl2.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "FOO2HBPL.PPD"
+*Manufacturer: "Dell"
+*Product: "(1355)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
+*%pprRIP: foomatic-rip other
+*ModelName: "Dell 1355"
+*ShortNickName: "Dell 1355 foo2hbpl2"
+*NickName: "Dell 1355 Foomatic/foo2hbpl2 (recommended)"
+*PSVersion: "(3010.000) 550"
+*PSVersion: "(3010.000) 651"
+*PSVersion: "(3010.000) 652"
+*PSVersion: "(3010.000) 653"
+*PSVersion: "(3010.000) 704"
+*PSVersion: "(3010.000) 705"
+*PSVersion: "(3010.000) 800"
+*LanguageLevel: "3"
+*ColorDevice: True
+*DefaultColorSpace: RGB
+*FileSystem: False
+*Throughput: "1"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "DRV:Dfoo2hbpl2,R1,M0,TF;"
+
+*driverName foo2hbpl2/foo2hbpl2: ""
+*driverType F/Filter: ""
+*driverUrl: "http://foo2hbpl2.rkkda.com/"
+*driverObsolete: False
+
+
+
+
+*HWMargins: 9 12.00 9 12
+*VariablePaperSize: True
+*MaxMediaWidth: 100000
+*MaxMediaHeight: 100000
+*NonUIOrderDependency: 135 AnySetup *CustomPageSize
+*CustomPageSize True: "pop pop pop pop pop
+%% FoomaticRIPOptionSetting: PageSize=Custom"
+*End
+*FoomaticRIPOptionSetting PageSize=Custom: "-pCustom.%0x%1 "
+*ParamCustomPageSize Width: 1 points 36 100000
+*ParamCustomPageSize Height: 2 points 36 100000
+*ParamCustomPageSize Orientation: 3 int 0 0
+*ParamCustomPageSize WidthOffset: 4 points 0 0
+*ParamCustomPageSize HeightOffset: 5 points 0 0
+
+*FoomaticIDs: Dell-1355 foo2hbpl2
+*FoomaticRIPCommandLine: "foo2hbpl2-wrapper %A"
+
+*OpenGroup: General/General
+
+*OpenUI *Quality/Printing Quality: PickOne
+*FoomaticRIPOption Quality: enum CmdLine A
+*OrderDependency: 110 AnySetup *Quality
+*DefaultQuality: normal
+*Quality draft/Draft: "%% FoomaticRIPOptionSetting: Quality=draft"
+*FoomaticRIPOptionSetting Quality=draft: " -t "
+*Quality normal/Normal: "%% FoomaticRIPOptionSetting: Quality=normal"
+*FoomaticRIPOptionSetting Quality=normal: " "
+*CloseUI: *Quality
+
+*OpenUI *ColorMode/Color Mode: PickOne
+*FoomaticRIPOption ColorMode: enum CmdLine A
+*OrderDependency: 120 AnySetup *ColorMode
+*DefaultColorMode: Monochrome
+*ColorMode Color/Color: "%% FoomaticRIPOptionSetting: ColorMode=Color"
+*FoomaticRIPOptionSetting ColorMode=Color: "-c "
+*ColorMode Monochrome/Monochrome: "%% FoomaticRIPOptionSetting: ColorMode=Monochrome"
+*FoomaticRIPOptionSetting ColorMode=Monochrome: " "
+*CloseUI: *ColorMode
+
+*OpenUI *PageSize/Page Size: PickOne
+*FoomaticRIPOption PageSize: enum CmdLine A
+*OrderDependency: 135 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*FoomaticRIPOptionSetting PageSize=Letter: "-p4 "
+*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*FoomaticRIPOptionSetting PageSize=A4: "-p1 "
+*PageSize B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*FoomaticRIPOptionSetting PageSize=B5jis: "-p2 "
+*PageSize Env10/Env #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
+*FoomaticRIPOptionSetting PageSize=Env10: "-p9 "
+*PageSize EnvC5/Env C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
+*FoomaticRIPOptionSetting PageSize=EnvC5: "-p11 "
+*PageSize EnvDL/Env DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
+*FoomaticRIPOptionSetting PageSize=EnvDL: "-p12 "
+*PageSize EnvMonarch/Env Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
+*FoomaticRIPOptionSetting PageSize=EnvMonarch: "-p10 "
+*PageSize Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*FoomaticRIPOptionSetting PageSize=Executive: "-p5 "
+*PageSize FanfoldGermanLegal/Fanfold German Legal: "%% FoomaticRIPOptionSetting: PageSize=FanfoldGermanLegal"
+*FoomaticRIPOptionSetting PageSize=FanfoldGermanLegal: "-p6 "
+*PageSize Folio/Folio: "%% FoomaticRIPOptionSetting: PageSize=Folio"
+*FoomaticRIPOptionSetting PageSize=Folio: "-p6 "
+*PageSize Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*FoomaticRIPOptionSetting PageSize=Legal: "-p7 "
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 135 AnySetup *PageRegion
+*DefaultPageRegion: ev/foo2hbpl2-PageSize-0
+*PageRegion Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*PageRegion B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*PageRegion Env10/Env #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
+*PageRegion EnvC5/Env C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
+*PageRegion EnvDL/Env DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
+*PageRegion EnvMonarch/Env Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
+*PageRegion Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*PageRegion FanfoldGermanLegal/Fanfold German Legal: "%% FoomaticRIPOptionSetting: PageSize=FanfoldGermanLegal"
+*PageRegion Folio/Folio: "%% FoomaticRIPOptionSetting: PageSize=Folio"
+*PageRegion Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: ev/foo2hbpl2-PageSize-0
+*ImageableArea Letter/Letter: "9 12.00 603 780.00"
+*ImageableArea A4/A4: "9 12.00 586 830.00"
+*ImageableArea B5jis/B5 (JIS): "9 12.00 509 715.00"
+*ImageableArea Env10/Env #10: "9 12.00 288 672.00"
+*ImageableArea EnvC5/Env C5: "9 12.00 450 637.00"
+*ImageableArea EnvDL/Env DL: "9 12.00 302 611.00"
+*ImageableArea EnvMonarch/Env Monarch: "9 12.00 270 528.00"
+*ImageableArea Executive/Executive: "9 12.00 513 744.00"
+*ImageableArea FanfoldGermanLegal/Fanfold German Legal: "9 12.00 603 996.00"
+*ImageableArea Folio/Folio: "9 12.00 603 924.00"
+*ImageableArea Legal/Legal: "9 12.00 603 996.00"
+
+*DefaultPaperDimension: ev/foo2hbpl2-PageSize-0
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension B5jis/B5 (JIS): "518 727"
+*PaperDimension Env10/Env #10: "297 684"
+*PaperDimension EnvC5/Env C5: "459 649"
+*PaperDimension EnvDL/Env DL: "311 623"
+*PaperDimension EnvMonarch/Env Monarch: "279 540"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension FanfoldGermanLegal/Fanfold German Legal: "612 1008"
+*PaperDimension Folio/Folio: "612 936"
+*PaperDimension Legal/Legal: "612 1008"
+
+*OpenUI *MediaType/Media Type: PickOne
+*FoomaticRIPOption MediaType: enum CmdLine A
+*OrderDependency: 150 AnySetup *MediaType
+*DefaultMediaType: plain
+*MediaType plain/Plain Paper: "%% FoomaticRIPOptionSetting: MediaType=plain"
+*FoomaticRIPOptionSetting MediaType=plain: "-m1 "
+*MediaType plain2/Plain Paper Side 2: "%% FoomaticRIPOptionSetting: MediaType=plain2"
+*FoomaticRIPOptionSetting MediaType=plain2: "-m8 "
+*MediaType bond/Bond: "%% FoomaticRIPOptionSetting: MediaType=bond"
+*FoomaticRIPOptionSetting MediaType=bond: "-m2 "
+*MediaType bond2/Bond Side 2: "%% FoomaticRIPOptionSetting: MediaType=bond2"
+*FoomaticRIPOptionSetting MediaType=bond2: "-m9 "
+*MediaType envelope/Envelope: "%% FoomaticRIPOptionSetting: MediaType=envelope"
+*FoomaticRIPOptionSetting MediaType=envelope: "-m6 "
+*MediaType labels/Labels: "%% FoomaticRIPOptionSetting: MediaType=labels"
+*FoomaticRIPOptionSetting MediaType=labels: "-m5 "
+*MediaType lwcard/Light Weight Card: "%% FoomaticRIPOptionSetting: MediaType=lwcard"
+*FoomaticRIPOptionSetting MediaType=lwcard: "-m3 "
+*MediaType lwcard2/Light Weight Card Side 2: "%% FoomaticRIPOptionSetting: MediaType=lwcard2"
+*FoomaticRIPOptionSetting MediaType=lwcard2: "-m10 "
+*MediaType lwgcard/Light Weight Glossy Card: "%% FoomaticRIPOptionSetting: MediaType=lwgcard"
+*FoomaticRIPOptionSetting MediaType=lwgcard: "-m4 "
+*MediaType lwgcard2/Light Weight Glossy Card Side 2: "%% FoomaticRIPOptionSetting: MediaType=lwgcard2"
+*FoomaticRIPOptionSetting MediaType=lwgcard2: "-m11 "
+*MediaType recycled/Recycled Paper: "%% FoomaticRIPOptionSetting: MediaType=recycled"
+*FoomaticRIPOptionSetting MediaType=recycled: "-m7 "
+*MediaType recycled2/Recycled Paper Side 2: "%% FoomaticRIPOptionSetting: MediaType=recycled2"
+*FoomaticRIPOptionSetting MediaType=recycled2: "-m12 "
+*CloseUI: *MediaType
+
+*OpenUI *Copies/Copies: PickOne
+*FoomaticRIPOption Copies: int CmdLine A
+*FoomaticRIPOptionPrototype Copies: "-n%s "
+*FoomaticRIPOptionRange Copies: 1 100
+*OrderDependency: 220 AnySetup *Copies
+*DefaultCopies: 1
+*FoomaticRIPDefaultCopies: 1
+*Copies 1/1: "%% FoomaticRIPOptionSetting: Copies=1"
+*Copies 2/2: "%% FoomaticRIPOptionSetting: Copies=2"
+*Copies 3/3: "%% FoomaticRIPOptionSetting: Copies=3"
+*Copies 4/4: "%% FoomaticRIPOptionSetting: Copies=4"
+*Copies 5/5: "%% FoomaticRIPOptionSetting: Copies=5"
+*Copies 6/6: "%% FoomaticRIPOptionSetting: Copies=6"
+*Copies 7/7: "%% FoomaticRIPOptionSetting: Copies=7"
+*Copies 8/8: "%% FoomaticRIPOptionSetting: Copies=8"
+*Copies 9/9: "%% FoomaticRIPOptionSetting: Copies=9"
+*Copies 10/10: "%% FoomaticRIPOptionSetting: Copies=10"
+*Copies 11/11: "%% FoomaticRIPOptionSetting: Copies=11"
+*Copies 12/12: "%% FoomaticRIPOptionSetting: Copies=12"
+*Copies 13/13: "%% FoomaticRIPOptionSetting: Copies=13"
+*Copies 14/14: "%% FoomaticRIPOptionSetting: Copies=14"
+*Copies 15/15: "%% FoomaticRIPOptionSetting: Copies=15"
+*Copies 16/16: "%% FoomaticRIPOptionSetting: Copies=16"
+*Copies 17/17: "%% FoomaticRIPOptionSetting: Copies=17"
+*Copies 18/18: "%% FoomaticRIPOptionSetting: Copies=18"
+*Copies 19/19: "%% FoomaticRIPOptionSetting: Copies=19"
+*Copies 20/20: "%% FoomaticRIPOptionSetting: Copies=20"
+*Copies 21/21: "%% FoomaticRIPOptionSetting: Copies=21"
+*Copies 22/22: "%% FoomaticRIPOptionSetting: Copies=22"
+*Copies 23/23: "%% FoomaticRIPOptionSetting: Copies=23"
+*Copies 24/24: "%% FoomaticRIPOptionSetting: Copies=24"
+*Copies 25/25: "%% FoomaticRIPOptionSetting: Copies=25"
+*Copies 26/26: "%% FoomaticRIPOptionSetting: Copies=26"
+*Copies 27/27: "%% FoomaticRIPOptionSetting: Copies=27"
+*Copies 28/28: "%% FoomaticRIPOptionSetting: Copies=28"
+*Copies 29/29: "%% FoomaticRIPOptionSetting: Copies=29"
+*Copies 30/30: "%% FoomaticRIPOptionSetting: Copies=30"
+*Copies 31/31: "%% FoomaticRIPOptionSetting: Copies=31"
+*Copies 32/32: "%% FoomaticRIPOptionSetting: Copies=32"
+*Copies 33/33: "%% FoomaticRIPOptionSetting: Copies=33"
+*Copies 34/34: "%% FoomaticRIPOptionSetting: Copies=34"
+*Copies 35/35: "%% FoomaticRIPOptionSetting: Copies=35"
+*Copies 36/36: "%% FoomaticRIPOptionSetting: Copies=36"
+*Copies 37/37: "%% FoomaticRIPOptionSetting: Copies=37"
+*Copies 38/38: "%% FoomaticRIPOptionSetting: Copies=38"
+*Copies 39/39: "%% FoomaticRIPOptionSetting: Copies=39"
+*Copies 40/40: "%% FoomaticRIPOptionSetting: Copies=40"
+*Copies 41/41: "%% FoomaticRIPOptionSetting: Copies=41"
+*Copies 42/42: "%% FoomaticRIPOptionSetting: Copies=42"
+*Copies 43/43: "%% FoomaticRIPOptionSetting: Copies=43"
+*Copies 44/44: "%% FoomaticRIPOptionSetting: Copies=44"
+*Copies 45/45: "%% FoomaticRIPOptionSetting: Copies=45"
+*Copies 46/46: "%% FoomaticRIPOptionSetting: Copies=46"
+*Copies 47/47: "%% FoomaticRIPOptionSetting: Copies=47"
+*Copies 48/48: "%% FoomaticRIPOptionSetting: Copies=48"
+*Copies 49/49: "%% FoomaticRIPOptionSetting: Copies=49"
+*Copies 50/50: "%% FoomaticRIPOptionSetting: Copies=50"
+*Copies 51/51: "%% FoomaticRIPOptionSetting: Copies=51"
+*Copies 52/52: "%% FoomaticRIPOptionSetting: Copies=52"
+*Copies 53/53: "%% FoomaticRIPOptionSetting: Copies=53"
+*Copies 54/54: "%% FoomaticRIPOptionSetting: Copies=54"
+*Copies 55/55: "%% FoomaticRIPOptionSetting: Copies=55"
+*Copies 56/56: "%% FoomaticRIPOptionSetting: Copies=56"
+*Copies 57/57: "%% FoomaticRIPOptionSetting: Copies=57"
+*Copies 58/58: "%% FoomaticRIPOptionSetting: Copies=58"
+*Copies 59/59: "%% FoomaticRIPOptionSetting: Copies=59"
+*Copies 60/60: "%% FoomaticRIPOptionSetting: Copies=60"
+*Copies 61/61: "%% FoomaticRIPOptionSetting: Copies=61"
+*Copies 62/62: "%% FoomaticRIPOptionSetting: Copies=62"
+*Copies 63/63: "%% FoomaticRIPOptionSetting: Copies=63"
+*Copies 64/64: "%% FoomaticRIPOptionSetting: Copies=64"
+*Copies 65/65: "%% FoomaticRIPOptionSetting: Copies=65"
+*Copies 66/66: "%% FoomaticRIPOptionSetting: Copies=66"
+*Copies 67/67: "%% FoomaticRIPOptionSetting: Copies=67"
+*Copies 68/68: "%% FoomaticRIPOptionSetting: Copies=68"
+*Copies 69/69: "%% FoomaticRIPOptionSetting: Copies=69"
+*Copies 70/70: "%% FoomaticRIPOptionSetting: Copies=70"
+*Copies 71/71: "%% FoomaticRIPOptionSetting: Copies=71"
+*Copies 72/72: "%% FoomaticRIPOptionSetting: Copies=72"
+*Copies 73/73: "%% FoomaticRIPOptionSetting: Copies=73"
+*Copies 74/74: "%% FoomaticRIPOptionSetting: Copies=74"
+*Copies 75/75: "%% FoomaticRIPOptionSetting: Copies=75"
+*Copies 76/76: "%% FoomaticRIPOptionSetting: Copies=76"
+*Copies 77/77: "%% FoomaticRIPOptionSetting: Copies=77"
+*Copies 78/78: "%% FoomaticRIPOptionSetting: Copies=78"
+*Copies 79/79: "%% FoomaticRIPOptionSetting: Copies=79"
+*Copies 80/80: "%% FoomaticRIPOptionSetting: Copies=80"
+*Copies 81/81: "%% FoomaticRIPOptionSetting: Copies=81"
+*Copies 82/82: "%% FoomaticRIPOptionSetting: Copies=82"
+*Copies 83/83: "%% FoomaticRIPOptionSetting: Copies=83"
+*Copies 84/84: "%% FoomaticRIPOptionSetting: Copies=84"
+*Copies 85/85: "%% FoomaticRIPOptionSetting: Copies=85"
+*Copies 86/86: "%% FoomaticRIPOptionSetting: Copies=86"
+*Copies 87/87: "%% FoomaticRIPOptionSetting: Copies=87"
+*Copies 88/88: "%% FoomaticRIPOptionSetting: Copies=88"
+*Copies 89/89: "%% FoomaticRIPOptionSetting: Copies=89"
+*Copies 90/90: "%% FoomaticRIPOptionSetting: Copies=90"
+*Copies 91/91: "%% FoomaticRIPOptionSetting: Copies=91"
+*Copies 92/92: "%% FoomaticRIPOptionSetting: Copies=92"
+*Copies 93/93: "%% FoomaticRIPOptionSetting: Copies=93"
+*Copies 94/94: "%% FoomaticRIPOptionSetting: Copies=94"
+*Copies 95/95: "%% FoomaticRIPOptionSetting: Copies=95"
+*Copies 96/96: "%% FoomaticRIPOptionSetting: Copies=96"
+*Copies 97/97: "%% FoomaticRIPOptionSetting: Copies=97"
+*Copies 98/98: "%% FoomaticRIPOptionSetting: Copies=98"
+*Copies 99/99: "%% FoomaticRIPOptionSetting: Copies=99"
+*Copies 100/100: "%% FoomaticRIPOptionSetting: Copies=100"
+*CloseUI: *Copies
+
+*CloseGroup: General
+
+*OpenGroup: Adjustment/Adjustment
+
+*OpenUI *halftone/Halftone Algorithm: PickOne
+*FoomaticRIPOption halftone: enum CmdLine A
+*OrderDependency: 110 AnySetup *halftone
+*Defaulthalftone: default
+*halftone default/Default: "%% FoomaticRIPOptionSetting: halftone=default"
+*FoomaticRIPOptionSetting halftone=default: " "
+*halftone as/Accurate Screens (better): "%% FoomaticRIPOptionSetting: halftone=as"
+*FoomaticRIPOptionSetting halftone=as: " -qas "
+*halftone standard/Standard: "%% FoomaticRIPOptionSetting: halftone=standard"
+*FoomaticRIPOptionSetting halftone=standard: " -q1 "
+*halftone wts/Well Tempered Screens (best): "%% FoomaticRIPOptionSetting: halftone=wts"
+*FoomaticRIPOptionSetting halftone=wts: " -qwts "
+*CloseUI: *halftone
+
+*OpenUI *ICM/ICM Color Profile: PickOne
+*FoomaticRIPOption ICM: enum CmdLine A
+*OrderDependency: 300 AnySetup *ICM
+*DefaultICM: none
+*ICM none/No ICM color correction: "%% FoomaticRIPOptionSetting: ICM=none"
+*FoomaticRIPOptionSetting ICM=none: "-C10 -Gnone.icm "
+*ICM testing/File testing.icm: "%% FoomaticRIPOptionSetting: ICM=testing"
+*FoomaticRIPOptionSetting ICM=testing: "-C10 -Gtesting.icm "
+*ICM testing2/File testing2.icm: "%% FoomaticRIPOptionSetting: ICM=testing2"
+*FoomaticRIPOptionSetting ICM=testing2: "-C10 -Gtesting2.icm "
+*ICM testing3/File testing3.icm: "%% FoomaticRIPOptionSetting: ICM=testing3"
+*FoomaticRIPOptionSetting ICM=testing3: "-C10 -Gtesting3.icm "
+*CloseUI: *ICM
+
+*CloseGroup: Adjustment
+
+*OpenGroup: Miscellaneous/Miscellaneous
+
+*OpenUI *NupOrient/N-up Orientation: PickOne
+*FoomaticRIPOption NupOrient: enum CmdLine A
+*OrderDependency: 200 AnySetup *NupOrient
+*DefaultNupOrient: port
+*NupOrient land/Landscape: "%% FoomaticRIPOptionSetting: NupOrient=land"
+*FoomaticRIPOptionSetting NupOrient=land: "-ol "
+*NupOrient port/Portrait: "%% FoomaticRIPOptionSetting: NupOrient=port"
+*FoomaticRIPOptionSetting NupOrient=port: " "
+*NupOrient sea/Seascape: "%% FoomaticRIPOptionSetting: NupOrient=sea"
+*FoomaticRIPOptionSetting NupOrient=sea: "-os "
+*CloseUI: *NupOrient
+
+*OpenUI *NupPages/N-up Printing: PickOne
+*FoomaticRIPOption NupPages: enum CmdLine A
+*OrderDependency: 200 AnySetup *NupPages
+*DefaultNupPages: 1up
+*NupPages 1up/1-up: "%% FoomaticRIPOptionSetting: NupPages=1up"
+*FoomaticRIPOptionSetting NupPages=1up: " "
+*NupPages 2up/2-up: "%% FoomaticRIPOptionSetting: NupPages=2up"
+*FoomaticRIPOptionSetting NupPages=2up: "-2 "
+*NupPages 3up/3-up: "%% FoomaticRIPOptionSetting: NupPages=3up"
+*FoomaticRIPOptionSetting NupPages=3up: "-3 "
+*NupPages 4up/4-up: "%% FoomaticRIPOptionSetting: NupPages=4up"
+*FoomaticRIPOptionSetting NupPages=4up: "-4 "
+*NupPages 6up/6-up: "%% FoomaticRIPOptionSetting: NupPages=6up"
+*FoomaticRIPOptionSetting NupPages=6up: "-6 "
+*NupPages 8up/8-up: "%% FoomaticRIPOptionSetting: NupPages=8up"
+*FoomaticRIPOptionSetting NupPages=8up: "-8 "
+*NupPages 10up/10-up: "%% FoomaticRIPOptionSetting: NupPages=10up"
+*FoomaticRIPOptionSetting NupPages=10up: "-10 "
+*NupPages 12up/12-up: "%% FoomaticRIPOptionSetting: NupPages=12up"
+*FoomaticRIPOptionSetting NupPages=12up: "-12 "
+*NupPages 14up/14-up: "%% FoomaticRIPOptionSetting: NupPages=14up"
+*FoomaticRIPOptionSetting NupPages=14up: "-14 "
+*NupPages 15up/15-up: "%% FoomaticRIPOptionSetting: NupPages=15up"
+*FoomaticRIPOptionSetting NupPages=15up: "-15 "
+*NupPages 16up/16-up: "%% FoomaticRIPOptionSetting: NupPages=16up"
+*FoomaticRIPOptionSetting NupPages=16up: "-16 "
+*NupPages 18up/18-up: "%% FoomaticRIPOptionSetting: NupPages=18up"
+*FoomaticRIPOptionSetting NupPages=18up: "-18 "
+*CloseUI: *NupPages
+
+*CloseGroup: Miscellaneous
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
diff --git a/PPD/Fuji_Xerox-DocuPrint_CM205.ppd b/PPD/Fuji_Xerox-DocuPrint_CM205.ppd
new file mode 100644
index 0000000..b4471a4
--- /dev/null
+++ b/PPD/Fuji_Xerox-DocuPrint_CM205.ppd
@@ -0,0 +1,433 @@
+*PPD-Adobe: "4.3"
+*%
+*% For information on using this, and to obtain the required backend
+*% script, consult http://www.openprinting.org/
+*%
+*% This file is published under the GNU General Public License
+*%
+*% PPD-O-MATIC (3.0.0 or newer) generated this PPD file. It is for use with
+*% all programs and environments which use PPD files for dealing with
+*% printer capability information. The printer must be configured with the
+*% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This
+*% file and "foomatic-rip" work together to support PPD-controlled printer
+*% driver option access with arbitrary free software printer drivers and
+*% printing spoolers.
+*%
+*% To save this file on your disk, wait until the download has completed
+*% (the animation of the browser logo must stop) and then use the
+*% "Save as..." command in the "File" menu of your browser or in the
+*% pop-up manu when you click on this document with the right mouse button.
+*% DO NOT cut and paste this file into an editor with your mouse. This can
+*% introduce additional line breaks which lead to unexpected results.
+*%
+*% You may save this file as 'Fuji_Xerox-DocuPrint_CM205-foo2hbpl2.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "FOO2HBPL.PPD"
+*Manufacturer: "Fuji Xerox"
+*Product: "(DocuPrint CM205)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
+*%pprRIP: foomatic-rip other
+*ModelName: "Fuji Xerox DocuPrint CM205"
+*ShortNickName: "Fuji Xerox D.P. CM205 foo2hbpl2"
+*NickName: "Fuji Xerox DocuPrint CM205 Foomatic/foo2hbpl2 (recommended)"
+*PSVersion: "(3010.000) 550"
+*PSVersion: "(3010.000) 651"
+*PSVersion: "(3010.000) 652"
+*PSVersion: "(3010.000) 653"
+*PSVersion: "(3010.000) 704"
+*PSVersion: "(3010.000) 705"
+*PSVersion: "(3010.000) 800"
+*LanguageLevel: "3"
+*ColorDevice: True
+*DefaultColorSpace: RGB
+*FileSystem: False
+*Throughput: "1"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "DRV:Dfoo2hbpl2,R1,M0,TF;"
+
+*driverName foo2hbpl2/foo2hbpl2: ""
+*driverType F/Filter: ""
+*driverUrl: "http://foo2hbpl2.rkkda.com/"
+*driverObsolete: False
+
+
+
+
+*HWMargins: 9 12.00 9 12
+*VariablePaperSize: True
+*MaxMediaWidth: 100000
+*MaxMediaHeight: 100000
+*NonUIOrderDependency: 135 AnySetup *CustomPageSize
+*CustomPageSize True: "pop pop pop pop pop
+%% FoomaticRIPOptionSetting: PageSize=Custom"
+*End
+*FoomaticRIPOptionSetting PageSize=Custom: "-pCustom.%0x%1 "
+*ParamCustomPageSize Width: 1 points 36 100000
+*ParamCustomPageSize Height: 2 points 36 100000
+*ParamCustomPageSize Orientation: 3 int 0 0
+*ParamCustomPageSize WidthOffset: 4 points 0 0
+*ParamCustomPageSize HeightOffset: 5 points 0 0
+
+*FoomaticIDs: Fuji_Xerox-DocuPrint_CM205 foo2hbpl2
+*FoomaticRIPCommandLine: "foo2hbpl2-wrapper %A"
+
+*OpenGroup: General/General
+
+*OpenUI *Quality/Printing Quality: PickOne
+*FoomaticRIPOption Quality: enum CmdLine A
+*OrderDependency: 110 AnySetup *Quality
+*DefaultQuality: normal
+*Quality draft/Draft: "%% FoomaticRIPOptionSetting: Quality=draft"
+*FoomaticRIPOptionSetting Quality=draft: " -t "
+*Quality normal/Normal: "%% FoomaticRIPOptionSetting: Quality=normal"
+*FoomaticRIPOptionSetting Quality=normal: " "
+*CloseUI: *Quality
+
+*OpenUI *ColorMode/Color Mode: PickOne
+*FoomaticRIPOption ColorMode: enum CmdLine A
+*OrderDependency: 120 AnySetup *ColorMode
+*DefaultColorMode: Monochrome
+*ColorMode Color/Color: "%% FoomaticRIPOptionSetting: ColorMode=Color"
+*FoomaticRIPOptionSetting ColorMode=Color: "-c "
+*ColorMode Monochrome/Monochrome: "%% FoomaticRIPOptionSetting: ColorMode=Monochrome"
+*FoomaticRIPOptionSetting ColorMode=Monochrome: " "
+*CloseUI: *ColorMode
+
+*OpenUI *PageSize/Page Size: PickOne
+*FoomaticRIPOption PageSize: enum CmdLine A
+*OrderDependency: 135 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*FoomaticRIPOptionSetting PageSize=Letter: "-p4 "
+*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*FoomaticRIPOptionSetting PageSize=A4: "-p1 "
+*PageSize B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*FoomaticRIPOptionSetting PageSize=B5jis: "-p2 "
+*PageSize Env10/Env #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
+*FoomaticRIPOptionSetting PageSize=Env10: "-p9 "
+*PageSize EnvC5/Env C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
+*FoomaticRIPOptionSetting PageSize=EnvC5: "-p11 "
+*PageSize EnvDL/Env DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
+*FoomaticRIPOptionSetting PageSize=EnvDL: "-p12 "
+*PageSize EnvMonarch/Env Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
+*FoomaticRIPOptionSetting PageSize=EnvMonarch: "-p10 "
+*PageSize Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*FoomaticRIPOptionSetting PageSize=Executive: "-p5 "
+*PageSize FanfoldGermanLegal/Fanfold German Legal: "%% FoomaticRIPOptionSetting: PageSize=FanfoldGermanLegal"
+*FoomaticRIPOptionSetting PageSize=FanfoldGermanLegal: "-p6 "
+*PageSize Folio/Folio: "%% FoomaticRIPOptionSetting: PageSize=Folio"
+*FoomaticRIPOptionSetting PageSize=Folio: "-p6 "
+*PageSize Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*FoomaticRIPOptionSetting PageSize=Legal: "-p7 "
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 135 AnySetup *PageRegion
+*DefaultPageRegion: ev/foo2hbpl2-PageSize-0
+*PageRegion Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*PageRegion B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*PageRegion Env10/Env #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
+*PageRegion EnvC5/Env C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
+*PageRegion EnvDL/Env DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
+*PageRegion EnvMonarch/Env Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
+*PageRegion Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*PageRegion FanfoldGermanLegal/Fanfold German Legal: "%% FoomaticRIPOptionSetting: PageSize=FanfoldGermanLegal"
+*PageRegion Folio/Folio: "%% FoomaticRIPOptionSetting: PageSize=Folio"
+*PageRegion Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: ev/foo2hbpl2-PageSize-0
+*ImageableArea Letter/Letter: "9 12.00 603 780.00"
+*ImageableArea A4/A4: "9 12.00 586 830.00"
+*ImageableArea B5jis/B5 (JIS): "9 12.00 509 715.00"
+*ImageableArea Env10/Env #10: "9 12.00 288 672.00"
+*ImageableArea EnvC5/Env C5: "9 12.00 450 637.00"
+*ImageableArea EnvDL/Env DL: "9 12.00 302 611.00"
+*ImageableArea EnvMonarch/Env Monarch: "9 12.00 270 528.00"
+*ImageableArea Executive/Executive: "9 12.00 513 744.00"
+*ImageableArea FanfoldGermanLegal/Fanfold German Legal: "9 12.00 603 996.00"
+*ImageableArea Folio/Folio: "9 12.00 603 924.00"
+*ImageableArea Legal/Legal: "9 12.00 603 996.00"
+
+*DefaultPaperDimension: ev/foo2hbpl2-PageSize-0
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension B5jis/B5 (JIS): "518 727"
+*PaperDimension Env10/Env #10: "297 684"
+*PaperDimension EnvC5/Env C5: "459 649"
+*PaperDimension EnvDL/Env DL: "311 623"
+*PaperDimension EnvMonarch/Env Monarch: "279 540"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension FanfoldGermanLegal/Fanfold German Legal: "612 1008"
+*PaperDimension Folio/Folio: "612 936"
+*PaperDimension Legal/Legal: "612 1008"
+
+*OpenUI *MediaType/Media Type: PickOne
+*FoomaticRIPOption MediaType: enum CmdLine A
+*OrderDependency: 150 AnySetup *MediaType
+*DefaultMediaType: plain
+*MediaType plain/Plain Paper: "%% FoomaticRIPOptionSetting: MediaType=plain"
+*FoomaticRIPOptionSetting MediaType=plain: "-m1 "
+*MediaType plain2/Plain Paper Side 2: "%% FoomaticRIPOptionSetting: MediaType=plain2"
+*FoomaticRIPOptionSetting MediaType=plain2: "-m8 "
+*MediaType bond/Bond: "%% FoomaticRIPOptionSetting: MediaType=bond"
+*FoomaticRIPOptionSetting MediaType=bond: "-m2 "
+*MediaType bond2/Bond Side 2: "%% FoomaticRIPOptionSetting: MediaType=bond2"
+*FoomaticRIPOptionSetting MediaType=bond2: "-m9 "
+*MediaType envelope/Envelope: "%% FoomaticRIPOptionSetting: MediaType=envelope"
+*FoomaticRIPOptionSetting MediaType=envelope: "-m6 "
+*MediaType labels/Labels: "%% FoomaticRIPOptionSetting: MediaType=labels"
+*FoomaticRIPOptionSetting MediaType=labels: "-m5 "
+*MediaType lwcard/Light Weight Card: "%% FoomaticRIPOptionSetting: MediaType=lwcard"
+*FoomaticRIPOptionSetting MediaType=lwcard: "-m3 "
+*MediaType lwcard2/Light Weight Card Side 2: "%% FoomaticRIPOptionSetting: MediaType=lwcard2"
+*FoomaticRIPOptionSetting MediaType=lwcard2: "-m10 "
+*MediaType lwgcard/Light Weight Glossy Card: "%% FoomaticRIPOptionSetting: MediaType=lwgcard"
+*FoomaticRIPOptionSetting MediaType=lwgcard: "-m4 "
+*MediaType lwgcard2/Light Weight Glossy Card Side 2: "%% FoomaticRIPOptionSetting: MediaType=lwgcard2"
+*FoomaticRIPOptionSetting MediaType=lwgcard2: "-m11 "
+*MediaType recycled/Recycled Paper: "%% FoomaticRIPOptionSetting: MediaType=recycled"
+*FoomaticRIPOptionSetting MediaType=recycled: "-m7 "
+*MediaType recycled2/Recycled Paper Side 2: "%% FoomaticRIPOptionSetting: MediaType=recycled2"
+*FoomaticRIPOptionSetting MediaType=recycled2: "-m12 "
+*CloseUI: *MediaType
+
+*OpenUI *Copies/Copies: PickOne
+*FoomaticRIPOption Copies: int CmdLine A
+*FoomaticRIPOptionPrototype Copies: "-n%s "
+*FoomaticRIPOptionRange Copies: 1 100
+*OrderDependency: 220 AnySetup *Copies
+*DefaultCopies: 1
+*FoomaticRIPDefaultCopies: 1
+*Copies 1/1: "%% FoomaticRIPOptionSetting: Copies=1"
+*Copies 2/2: "%% FoomaticRIPOptionSetting: Copies=2"
+*Copies 3/3: "%% FoomaticRIPOptionSetting: Copies=3"
+*Copies 4/4: "%% FoomaticRIPOptionSetting: Copies=4"
+*Copies 5/5: "%% FoomaticRIPOptionSetting: Copies=5"
+*Copies 6/6: "%% FoomaticRIPOptionSetting: Copies=6"
+*Copies 7/7: "%% FoomaticRIPOptionSetting: Copies=7"
+*Copies 8/8: "%% FoomaticRIPOptionSetting: Copies=8"
+*Copies 9/9: "%% FoomaticRIPOptionSetting: Copies=9"
+*Copies 10/10: "%% FoomaticRIPOptionSetting: Copies=10"
+*Copies 11/11: "%% FoomaticRIPOptionSetting: Copies=11"
+*Copies 12/12: "%% FoomaticRIPOptionSetting: Copies=12"
+*Copies 13/13: "%% FoomaticRIPOptionSetting: Copies=13"
+*Copies 14/14: "%% FoomaticRIPOptionSetting: Copies=14"
+*Copies 15/15: "%% FoomaticRIPOptionSetting: Copies=15"
+*Copies 16/16: "%% FoomaticRIPOptionSetting: Copies=16"
+*Copies 17/17: "%% FoomaticRIPOptionSetting: Copies=17"
+*Copies 18/18: "%% FoomaticRIPOptionSetting: Copies=18"
+*Copies 19/19: "%% FoomaticRIPOptionSetting: Copies=19"
+*Copies 20/20: "%% FoomaticRIPOptionSetting: Copies=20"
+*Copies 21/21: "%% FoomaticRIPOptionSetting: Copies=21"
+*Copies 22/22: "%% FoomaticRIPOptionSetting: Copies=22"
+*Copies 23/23: "%% FoomaticRIPOptionSetting: Copies=23"
+*Copies 24/24: "%% FoomaticRIPOptionSetting: Copies=24"
+*Copies 25/25: "%% FoomaticRIPOptionSetting: Copies=25"
+*Copies 26/26: "%% FoomaticRIPOptionSetting: Copies=26"
+*Copies 27/27: "%% FoomaticRIPOptionSetting: Copies=27"
+*Copies 28/28: "%% FoomaticRIPOptionSetting: Copies=28"
+*Copies 29/29: "%% FoomaticRIPOptionSetting: Copies=29"
+*Copies 30/30: "%% FoomaticRIPOptionSetting: Copies=30"
+*Copies 31/31: "%% FoomaticRIPOptionSetting: Copies=31"
+*Copies 32/32: "%% FoomaticRIPOptionSetting: Copies=32"
+*Copies 33/33: "%% FoomaticRIPOptionSetting: Copies=33"
+*Copies 34/34: "%% FoomaticRIPOptionSetting: Copies=34"
+*Copies 35/35: "%% FoomaticRIPOptionSetting: Copies=35"
+*Copies 36/36: "%% FoomaticRIPOptionSetting: Copies=36"
+*Copies 37/37: "%% FoomaticRIPOptionSetting: Copies=37"
+*Copies 38/38: "%% FoomaticRIPOptionSetting: Copies=38"
+*Copies 39/39: "%% FoomaticRIPOptionSetting: Copies=39"
+*Copies 40/40: "%% FoomaticRIPOptionSetting: Copies=40"
+*Copies 41/41: "%% FoomaticRIPOptionSetting: Copies=41"
+*Copies 42/42: "%% FoomaticRIPOptionSetting: Copies=42"
+*Copies 43/43: "%% FoomaticRIPOptionSetting: Copies=43"
+*Copies 44/44: "%% FoomaticRIPOptionSetting: Copies=44"
+*Copies 45/45: "%% FoomaticRIPOptionSetting: Copies=45"
+*Copies 46/46: "%% FoomaticRIPOptionSetting: Copies=46"
+*Copies 47/47: "%% FoomaticRIPOptionSetting: Copies=47"
+*Copies 48/48: "%% FoomaticRIPOptionSetting: Copies=48"
+*Copies 49/49: "%% FoomaticRIPOptionSetting: Copies=49"
+*Copies 50/50: "%% FoomaticRIPOptionSetting: Copies=50"
+*Copies 51/51: "%% FoomaticRIPOptionSetting: Copies=51"
+*Copies 52/52: "%% FoomaticRIPOptionSetting: Copies=52"
+*Copies 53/53: "%% FoomaticRIPOptionSetting: Copies=53"
+*Copies 54/54: "%% FoomaticRIPOptionSetting: Copies=54"
+*Copies 55/55: "%% FoomaticRIPOptionSetting: Copies=55"
+*Copies 56/56: "%% FoomaticRIPOptionSetting: Copies=56"
+*Copies 57/57: "%% FoomaticRIPOptionSetting: Copies=57"
+*Copies 58/58: "%% FoomaticRIPOptionSetting: Copies=58"
+*Copies 59/59: "%% FoomaticRIPOptionSetting: Copies=59"
+*Copies 60/60: "%% FoomaticRIPOptionSetting: Copies=60"
+*Copies 61/61: "%% FoomaticRIPOptionSetting: Copies=61"
+*Copies 62/62: "%% FoomaticRIPOptionSetting: Copies=62"
+*Copies 63/63: "%% FoomaticRIPOptionSetting: Copies=63"
+*Copies 64/64: "%% FoomaticRIPOptionSetting: Copies=64"
+*Copies 65/65: "%% FoomaticRIPOptionSetting: Copies=65"
+*Copies 66/66: "%% FoomaticRIPOptionSetting: Copies=66"
+*Copies 67/67: "%% FoomaticRIPOptionSetting: Copies=67"
+*Copies 68/68: "%% FoomaticRIPOptionSetting: Copies=68"
+*Copies 69/69: "%% FoomaticRIPOptionSetting: Copies=69"
+*Copies 70/70: "%% FoomaticRIPOptionSetting: Copies=70"
+*Copies 71/71: "%% FoomaticRIPOptionSetting: Copies=71"
+*Copies 72/72: "%% FoomaticRIPOptionSetting: Copies=72"
+*Copies 73/73: "%% FoomaticRIPOptionSetting: Copies=73"
+*Copies 74/74: "%% FoomaticRIPOptionSetting: Copies=74"
+*Copies 75/75: "%% FoomaticRIPOptionSetting: Copies=75"
+*Copies 76/76: "%% FoomaticRIPOptionSetting: Copies=76"
+*Copies 77/77: "%% FoomaticRIPOptionSetting: Copies=77"
+*Copies 78/78: "%% FoomaticRIPOptionSetting: Copies=78"
+*Copies 79/79: "%% FoomaticRIPOptionSetting: Copies=79"
+*Copies 80/80: "%% FoomaticRIPOptionSetting: Copies=80"
+*Copies 81/81: "%% FoomaticRIPOptionSetting: Copies=81"
+*Copies 82/82: "%% FoomaticRIPOptionSetting: Copies=82"
+*Copies 83/83: "%% FoomaticRIPOptionSetting: Copies=83"
+*Copies 84/84: "%% FoomaticRIPOptionSetting: Copies=84"
+*Copies 85/85: "%% FoomaticRIPOptionSetting: Copies=85"
+*Copies 86/86: "%% FoomaticRIPOptionSetting: Copies=86"
+*Copies 87/87: "%% FoomaticRIPOptionSetting: Copies=87"
+*Copies 88/88: "%% FoomaticRIPOptionSetting: Copies=88"
+*Copies 89/89: "%% FoomaticRIPOptionSetting: Copies=89"
+*Copies 90/90: "%% FoomaticRIPOptionSetting: Copies=90"
+*Copies 91/91: "%% FoomaticRIPOptionSetting: Copies=91"
+*Copies 92/92: "%% FoomaticRIPOptionSetting: Copies=92"
+*Copies 93/93: "%% FoomaticRIPOptionSetting: Copies=93"
+*Copies 94/94: "%% FoomaticRIPOptionSetting: Copies=94"
+*Copies 95/95: "%% FoomaticRIPOptionSetting: Copies=95"
+*Copies 96/96: "%% FoomaticRIPOptionSetting: Copies=96"
+*Copies 97/97: "%% FoomaticRIPOptionSetting: Copies=97"
+*Copies 98/98: "%% FoomaticRIPOptionSetting: Copies=98"
+*Copies 99/99: "%% FoomaticRIPOptionSetting: Copies=99"
+*Copies 100/100: "%% FoomaticRIPOptionSetting: Copies=100"
+*CloseUI: *Copies
+
+*CloseGroup: General
+
+*OpenGroup: Adjustment/Adjustment
+
+*OpenUI *halftone/Halftone Algorithm: PickOne
+*FoomaticRIPOption halftone: enum CmdLine A
+*OrderDependency: 110 AnySetup *halftone
+*Defaulthalftone: default
+*halftone default/Default: "%% FoomaticRIPOptionSetting: halftone=default"
+*FoomaticRIPOptionSetting halftone=default: " "
+*halftone as/Accurate Screens (better): "%% FoomaticRIPOptionSetting: halftone=as"
+*FoomaticRIPOptionSetting halftone=as: " -qas "
+*halftone standard/Standard: "%% FoomaticRIPOptionSetting: halftone=standard"
+*FoomaticRIPOptionSetting halftone=standard: " -q1 "
+*halftone wts/Well Tempered Screens (best): "%% FoomaticRIPOptionSetting: halftone=wts"
+*FoomaticRIPOptionSetting halftone=wts: " -qwts "
+*CloseUI: *halftone
+
+*OpenUI *ICM/ICM Color Profile: PickOne
+*FoomaticRIPOption ICM: enum CmdLine A
+*OrderDependency: 300 AnySetup *ICM
+*DefaultICM: none
+*ICM none/No ICM color correction: "%% FoomaticRIPOptionSetting: ICM=none"
+*FoomaticRIPOptionSetting ICM=none: "-C10 -Gnone.icm "
+*ICM testing/File testing.icm: "%% FoomaticRIPOptionSetting: ICM=testing"
+*FoomaticRIPOptionSetting ICM=testing: "-C10 -Gtesting.icm "
+*ICM testing2/File testing2.icm: "%% FoomaticRIPOptionSetting: ICM=testing2"
+*FoomaticRIPOptionSetting ICM=testing2: "-C10 -Gtesting2.icm "
+*ICM testing3/File testing3.icm: "%% FoomaticRIPOptionSetting: ICM=testing3"
+*FoomaticRIPOptionSetting ICM=testing3: "-C10 -Gtesting3.icm "
+*CloseUI: *ICM
+
+*CloseGroup: Adjustment
+
+*OpenGroup: Miscellaneous/Miscellaneous
+
+*OpenUI *NupOrient/N-up Orientation: PickOne
+*FoomaticRIPOption NupOrient: enum CmdLine A
+*OrderDependency: 200 AnySetup *NupOrient
+*DefaultNupOrient: port
+*NupOrient land/Landscape: "%% FoomaticRIPOptionSetting: NupOrient=land"
+*FoomaticRIPOptionSetting NupOrient=land: "-ol "
+*NupOrient port/Portrait: "%% FoomaticRIPOptionSetting: NupOrient=port"
+*FoomaticRIPOptionSetting NupOrient=port: " "
+*NupOrient sea/Seascape: "%% FoomaticRIPOptionSetting: NupOrient=sea"
+*FoomaticRIPOptionSetting NupOrient=sea: "-os "
+*CloseUI: *NupOrient
+
+*OpenUI *NupPages/N-up Printing: PickOne
+*FoomaticRIPOption NupPages: enum CmdLine A
+*OrderDependency: 200 AnySetup *NupPages
+*DefaultNupPages: 1up
+*NupPages 1up/1-up: "%% FoomaticRIPOptionSetting: NupPages=1up"
+*FoomaticRIPOptionSetting NupPages=1up: " "
+*NupPages 2up/2-up: "%% FoomaticRIPOptionSetting: NupPages=2up"
+*FoomaticRIPOptionSetting NupPages=2up: "-2 "
+*NupPages 3up/3-up: "%% FoomaticRIPOptionSetting: NupPages=3up"
+*FoomaticRIPOptionSetting NupPages=3up: "-3 "
+*NupPages 4up/4-up: "%% FoomaticRIPOptionSetting: NupPages=4up"
+*FoomaticRIPOptionSetting NupPages=4up: "-4 "
+*NupPages 6up/6-up: "%% FoomaticRIPOptionSetting: NupPages=6up"
+*FoomaticRIPOptionSetting NupPages=6up: "-6 "
+*NupPages 8up/8-up: "%% FoomaticRIPOptionSetting: NupPages=8up"
+*FoomaticRIPOptionSetting NupPages=8up: "-8 "
+*NupPages 10up/10-up: "%% FoomaticRIPOptionSetting: NupPages=10up"
+*FoomaticRIPOptionSetting NupPages=10up: "-10 "
+*NupPages 12up/12-up: "%% FoomaticRIPOptionSetting: NupPages=12up"
+*FoomaticRIPOptionSetting NupPages=12up: "-12 "
+*NupPages 14up/14-up: "%% FoomaticRIPOptionSetting: NupPages=14up"
+*FoomaticRIPOptionSetting NupPages=14up: "-14 "
+*NupPages 15up/15-up: "%% FoomaticRIPOptionSetting: NupPages=15up"
+*FoomaticRIPOptionSetting NupPages=15up: "-15 "
+*NupPages 16up/16-up: "%% FoomaticRIPOptionSetting: NupPages=16up"
+*FoomaticRIPOptionSetting NupPages=16up: "-16 "
+*NupPages 18up/18-up: "%% FoomaticRIPOptionSetting: NupPages=18up"
+*FoomaticRIPOptionSetting NupPages=18up: "-18 "
+*CloseUI: *NupPages
+
+*CloseGroup: Miscellaneous
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
diff --git a/PPD/Xerox-WorkCentre_6015.ppd b/PPD/Xerox-WorkCentre_6015.ppd
new file mode 100644
index 0000000..08a3e58
--- /dev/null
+++ b/PPD/Xerox-WorkCentre_6015.ppd
@@ -0,0 +1,433 @@
+*PPD-Adobe: "4.3"
+*%
+*% For information on using this, and to obtain the required backend
+*% script, consult http://www.openprinting.org/
+*%
+*% This file is published under the GNU General Public License
+*%
+*% PPD-O-MATIC (3.0.0 or newer) generated this PPD file. It is for use with
+*% all programs and environments which use PPD files for dealing with
+*% printer capability information. The printer must be configured with the
+*% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This
+*% file and "foomatic-rip" work together to support PPD-controlled printer
+*% driver option access with arbitrary free software printer drivers and
+*% printing spoolers.
+*%
+*% To save this file on your disk, wait until the download has completed
+*% (the animation of the browser logo must stop) and then use the
+*% "Save as..." command in the "File" menu of your browser or in the
+*% pop-up manu when you click on this document with the right mouse button.
+*% DO NOT cut and paste this file into an editor with your mouse. This can
+*% introduce additional line breaks which lead to unexpected results.
+*%
+*% You may save this file as 'Xerox-WorkCentre_6015-foo2hbpl2.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "FOO2HBPL.PPD"
+*Manufacturer: "Xerox"
+*Product: "(WorkCentre 6015)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
+*%pprRIP: foomatic-rip other
+*ModelName: "Xerox WorkCentre 6015"
+*ShortNickName: "Xerox WorkCentre 6015 foo2hbpl2"
+*NickName: "Xerox WorkCentre 6015 Foomatic/foo2hbpl2 (recommended)"
+*PSVersion: "(3010.000) 550"
+*PSVersion: "(3010.000) 651"
+*PSVersion: "(3010.000) 652"
+*PSVersion: "(3010.000) 653"
+*PSVersion: "(3010.000) 704"
+*PSVersion: "(3010.000) 705"
+*PSVersion: "(3010.000) 800"
+*LanguageLevel: "3"
+*ColorDevice: True
+*DefaultColorSpace: RGB
+*FileSystem: False
+*Throughput: "1"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "DRV:Dfoo2hbpl2,R1,M0,TF;"
+
+*driverName foo2hbpl2/foo2hbpl2: ""
+*driverType F/Filter: ""
+*driverUrl: "http://foo2hbpl2.rkkda.com/"
+*driverObsolete: False
+
+
+
+
+*HWMargins: 9 12.00 9 12
+*VariablePaperSize: True
+*MaxMediaWidth: 100000
+*MaxMediaHeight: 100000
+*NonUIOrderDependency: 135 AnySetup *CustomPageSize
+*CustomPageSize True: "pop pop pop pop pop
+%% FoomaticRIPOptionSetting: PageSize=Custom"
+*End
+*FoomaticRIPOptionSetting PageSize=Custom: "-pCustom.%0x%1 "
+*ParamCustomPageSize Width: 1 points 36 100000
+*ParamCustomPageSize Height: 2 points 36 100000
+*ParamCustomPageSize Orientation: 3 int 0 0
+*ParamCustomPageSize WidthOffset: 4 points 0 0
+*ParamCustomPageSize HeightOffset: 5 points 0 0
+
+*FoomaticIDs: Xerox-WorkCentre_6015 foo2hbpl2
+*FoomaticRIPCommandLine: "foo2hbpl2-wrapper %A"
+
+*OpenGroup: General/General
+
+*OpenUI *Quality/Printing Quality: PickOne
+*FoomaticRIPOption Quality: enum CmdLine A
+*OrderDependency: 110 AnySetup *Quality
+*DefaultQuality: normal
+*Quality draft/Draft: "%% FoomaticRIPOptionSetting: Quality=draft"
+*FoomaticRIPOptionSetting Quality=draft: " -t "
+*Quality normal/Normal: "%% FoomaticRIPOptionSetting: Quality=normal"
+*FoomaticRIPOptionSetting Quality=normal: " "
+*CloseUI: *Quality
+
+*OpenUI *ColorMode/Color Mode: PickOne
+*FoomaticRIPOption ColorMode: enum CmdLine A
+*OrderDependency: 120 AnySetup *ColorMode
+*DefaultColorMode: Monochrome
+*ColorMode Color/Color: "%% FoomaticRIPOptionSetting: ColorMode=Color"
+*FoomaticRIPOptionSetting ColorMode=Color: "-c "
+*ColorMode Monochrome/Monochrome: "%% FoomaticRIPOptionSetting: ColorMode=Monochrome"
+*FoomaticRIPOptionSetting ColorMode=Monochrome: " "
+*CloseUI: *ColorMode
+
+*OpenUI *PageSize/Page Size: PickOne
+*FoomaticRIPOption PageSize: enum CmdLine A
+*OrderDependency: 135 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*FoomaticRIPOptionSetting PageSize=Letter: "-p4 "
+*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*FoomaticRIPOptionSetting PageSize=A4: "-p1 "
+*PageSize B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*FoomaticRIPOptionSetting PageSize=B5jis: "-p2 "
+*PageSize Env10/Env #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
+*FoomaticRIPOptionSetting PageSize=Env10: "-p9 "
+*PageSize EnvC5/Env C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
+*FoomaticRIPOptionSetting PageSize=EnvC5: "-p11 "
+*PageSize EnvDL/Env DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
+*FoomaticRIPOptionSetting PageSize=EnvDL: "-p12 "
+*PageSize EnvMonarch/Env Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
+*FoomaticRIPOptionSetting PageSize=EnvMonarch: "-p10 "
+*PageSize Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*FoomaticRIPOptionSetting PageSize=Executive: "-p5 "
+*PageSize FanfoldGermanLegal/Fanfold German Legal: "%% FoomaticRIPOptionSetting: PageSize=FanfoldGermanLegal"
+*FoomaticRIPOptionSetting PageSize=FanfoldGermanLegal: "-p6 "
+*PageSize Folio/Folio: "%% FoomaticRIPOptionSetting: PageSize=Folio"
+*FoomaticRIPOptionSetting PageSize=Folio: "-p6 "
+*PageSize Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*FoomaticRIPOptionSetting PageSize=Legal: "-p7 "
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 135 AnySetup *PageRegion
+*DefaultPageRegion: ev/foo2hbpl2-PageSize-0
+*PageRegion Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*PageRegion B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*PageRegion Env10/Env #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
+*PageRegion EnvC5/Env C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
+*PageRegion EnvDL/Env DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
+*PageRegion EnvMonarch/Env Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
+*PageRegion Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*PageRegion FanfoldGermanLegal/Fanfold German Legal: "%% FoomaticRIPOptionSetting: PageSize=FanfoldGermanLegal"
+*PageRegion Folio/Folio: "%% FoomaticRIPOptionSetting: PageSize=Folio"
+*PageRegion Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: ev/foo2hbpl2-PageSize-0
+*ImageableArea Letter/Letter: "9 12.00 603 780.00"
+*ImageableArea A4/A4: "9 12.00 586 830.00"
+*ImageableArea B5jis/B5 (JIS): "9 12.00 509 715.00"
+*ImageableArea Env10/Env #10: "9 12.00 288 672.00"
+*ImageableArea EnvC5/Env C5: "9 12.00 450 637.00"
+*ImageableArea EnvDL/Env DL: "9 12.00 302 611.00"
+*ImageableArea EnvMonarch/Env Monarch: "9 12.00 270 528.00"
+*ImageableArea Executive/Executive: "9 12.00 513 744.00"
+*ImageableArea FanfoldGermanLegal/Fanfold German Legal: "9 12.00 603 996.00"
+*ImageableArea Folio/Folio: "9 12.00 603 924.00"
+*ImageableArea Legal/Legal: "9 12.00 603 996.00"
+
+*DefaultPaperDimension: ev/foo2hbpl2-PageSize-0
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension B5jis/B5 (JIS): "518 727"
+*PaperDimension Env10/Env #10: "297 684"
+*PaperDimension EnvC5/Env C5: "459 649"
+*PaperDimension EnvDL/Env DL: "311 623"
+*PaperDimension EnvMonarch/Env Monarch: "279 540"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension FanfoldGermanLegal/Fanfold German Legal: "612 1008"
+*PaperDimension Folio/Folio: "612 936"
+*PaperDimension Legal/Legal: "612 1008"
+
+*OpenUI *MediaType/Media Type: PickOne
+*FoomaticRIPOption MediaType: enum CmdLine A
+*OrderDependency: 150 AnySetup *MediaType
+*DefaultMediaType: plain
+*MediaType plain/Plain Paper: "%% FoomaticRIPOptionSetting: MediaType=plain"
+*FoomaticRIPOptionSetting MediaType=plain: "-m1 "
+*MediaType plain2/Plain Paper Side 2: "%% FoomaticRIPOptionSetting: MediaType=plain2"
+*FoomaticRIPOptionSetting MediaType=plain2: "-m8 "
+*MediaType bond/Bond: "%% FoomaticRIPOptionSetting: MediaType=bond"
+*FoomaticRIPOptionSetting MediaType=bond: "-m2 "
+*MediaType bond2/Bond Side 2: "%% FoomaticRIPOptionSetting: MediaType=bond2"
+*FoomaticRIPOptionSetting MediaType=bond2: "-m9 "
+*MediaType envelope/Envelope: "%% FoomaticRIPOptionSetting: MediaType=envelope"
+*FoomaticRIPOptionSetting MediaType=envelope: "-m6 "
+*MediaType labels/Labels: "%% FoomaticRIPOptionSetting: MediaType=labels"
+*FoomaticRIPOptionSetting MediaType=labels: "-m5 "
+*MediaType lwcard/Light Weight Card: "%% FoomaticRIPOptionSetting: MediaType=lwcard"
+*FoomaticRIPOptionSetting MediaType=lwcard: "-m3 "
+*MediaType lwcard2/Light Weight Card Side 2: "%% FoomaticRIPOptionSetting: MediaType=lwcard2"
+*FoomaticRIPOptionSetting MediaType=lwcard2: "-m10 "
+*MediaType lwgcard/Light Weight Glossy Card: "%% FoomaticRIPOptionSetting: MediaType=lwgcard"
+*FoomaticRIPOptionSetting MediaType=lwgcard: "-m4 "
+*MediaType lwgcard2/Light Weight Glossy Card Side 2: "%% FoomaticRIPOptionSetting: MediaType=lwgcard2"
+*FoomaticRIPOptionSetting MediaType=lwgcard2: "-m11 "
+*MediaType recycled/Recycled Paper: "%% FoomaticRIPOptionSetting: MediaType=recycled"
+*FoomaticRIPOptionSetting MediaType=recycled: "-m7 "
+*MediaType recycled2/Recycled Paper Side 2: "%% FoomaticRIPOptionSetting: MediaType=recycled2"
+*FoomaticRIPOptionSetting MediaType=recycled2: "-m12 "
+*CloseUI: *MediaType
+
+*OpenUI *Copies/Copies: PickOne
+*FoomaticRIPOption Copies: int CmdLine A
+*FoomaticRIPOptionPrototype Copies: "-n%s "
+*FoomaticRIPOptionRange Copies: 1 100
+*OrderDependency: 220 AnySetup *Copies
+*DefaultCopies: 1
+*FoomaticRIPDefaultCopies: 1
+*Copies 1/1: "%% FoomaticRIPOptionSetting: Copies=1"
+*Copies 2/2: "%% FoomaticRIPOptionSetting: Copies=2"
+*Copies 3/3: "%% FoomaticRIPOptionSetting: Copies=3"
+*Copies 4/4: "%% FoomaticRIPOptionSetting: Copies=4"
+*Copies 5/5: "%% FoomaticRIPOptionSetting: Copies=5"
+*Copies 6/6: "%% FoomaticRIPOptionSetting: Copies=6"
+*Copies 7/7: "%% FoomaticRIPOptionSetting: Copies=7"
+*Copies 8/8: "%% FoomaticRIPOptionSetting: Copies=8"
+*Copies 9/9: "%% FoomaticRIPOptionSetting: Copies=9"
+*Copies 10/10: "%% FoomaticRIPOptionSetting: Copies=10"
+*Copies 11/11: "%% FoomaticRIPOptionSetting: Copies=11"
+*Copies 12/12: "%% FoomaticRIPOptionSetting: Copies=12"
+*Copies 13/13: "%% FoomaticRIPOptionSetting: Copies=13"
+*Copies 14/14: "%% FoomaticRIPOptionSetting: Copies=14"
+*Copies 15/15: "%% FoomaticRIPOptionSetting: Copies=15"
+*Copies 16/16: "%% FoomaticRIPOptionSetting: Copies=16"
+*Copies 17/17: "%% FoomaticRIPOptionSetting: Copies=17"
+*Copies 18/18: "%% FoomaticRIPOptionSetting: Copies=18"
+*Copies 19/19: "%% FoomaticRIPOptionSetting: Copies=19"
+*Copies 20/20: "%% FoomaticRIPOptionSetting: Copies=20"
+*Copies 21/21: "%% FoomaticRIPOptionSetting: Copies=21"
+*Copies 22/22: "%% FoomaticRIPOptionSetting: Copies=22"
+*Copies 23/23: "%% FoomaticRIPOptionSetting: Copies=23"
+*Copies 24/24: "%% FoomaticRIPOptionSetting: Copies=24"
+*Copies 25/25: "%% FoomaticRIPOptionSetting: Copies=25"
+*Copies 26/26: "%% FoomaticRIPOptionSetting: Copies=26"
+*Copies 27/27: "%% FoomaticRIPOptionSetting: Copies=27"
+*Copies 28/28: "%% FoomaticRIPOptionSetting: Copies=28"
+*Copies 29/29: "%% FoomaticRIPOptionSetting: Copies=29"
+*Copies 30/30: "%% FoomaticRIPOptionSetting: Copies=30"
+*Copies 31/31: "%% FoomaticRIPOptionSetting: Copies=31"
+*Copies 32/32: "%% FoomaticRIPOptionSetting: Copies=32"
+*Copies 33/33: "%% FoomaticRIPOptionSetting: Copies=33"
+*Copies 34/34: "%% FoomaticRIPOptionSetting: Copies=34"
+*Copies 35/35: "%% FoomaticRIPOptionSetting: Copies=35"
+*Copies 36/36: "%% FoomaticRIPOptionSetting: Copies=36"
+*Copies 37/37: "%% FoomaticRIPOptionSetting: Copies=37"
+*Copies 38/38: "%% FoomaticRIPOptionSetting: Copies=38"
+*Copies 39/39: "%% FoomaticRIPOptionSetting: Copies=39"
+*Copies 40/40: "%% FoomaticRIPOptionSetting: Copies=40"
+*Copies 41/41: "%% FoomaticRIPOptionSetting: Copies=41"
+*Copies 42/42: "%% FoomaticRIPOptionSetting: Copies=42"
+*Copies 43/43: "%% FoomaticRIPOptionSetting: Copies=43"
+*Copies 44/44: "%% FoomaticRIPOptionSetting: Copies=44"
+*Copies 45/45: "%% FoomaticRIPOptionSetting: Copies=45"
+*Copies 46/46: "%% FoomaticRIPOptionSetting: Copies=46"
+*Copies 47/47: "%% FoomaticRIPOptionSetting: Copies=47"
+*Copies 48/48: "%% FoomaticRIPOptionSetting: Copies=48"
+*Copies 49/49: "%% FoomaticRIPOptionSetting: Copies=49"
+*Copies 50/50: "%% FoomaticRIPOptionSetting: Copies=50"
+*Copies 51/51: "%% FoomaticRIPOptionSetting: Copies=51"
+*Copies 52/52: "%% FoomaticRIPOptionSetting: Copies=52"
+*Copies 53/53: "%% FoomaticRIPOptionSetting: Copies=53"
+*Copies 54/54: "%% FoomaticRIPOptionSetting: Copies=54"
+*Copies 55/55: "%% FoomaticRIPOptionSetting: Copies=55"
+*Copies 56/56: "%% FoomaticRIPOptionSetting: Copies=56"
+*Copies 57/57: "%% FoomaticRIPOptionSetting: Copies=57"
+*Copies 58/58: "%% FoomaticRIPOptionSetting: Copies=58"
+*Copies 59/59: "%% FoomaticRIPOptionSetting: Copies=59"
+*Copies 60/60: "%% FoomaticRIPOptionSetting: Copies=60"
+*Copies 61/61: "%% FoomaticRIPOptionSetting: Copies=61"
+*Copies 62/62: "%% FoomaticRIPOptionSetting: Copies=62"
+*Copies 63/63: "%% FoomaticRIPOptionSetting: Copies=63"
+*Copies 64/64: "%% FoomaticRIPOptionSetting: Copies=64"
+*Copies 65/65: "%% FoomaticRIPOptionSetting: Copies=65"
+*Copies 66/66: "%% FoomaticRIPOptionSetting: Copies=66"
+*Copies 67/67: "%% FoomaticRIPOptionSetting: Copies=67"
+*Copies 68/68: "%% FoomaticRIPOptionSetting: Copies=68"
+*Copies 69/69: "%% FoomaticRIPOptionSetting: Copies=69"
+*Copies 70/70: "%% FoomaticRIPOptionSetting: Copies=70"
+*Copies 71/71: "%% FoomaticRIPOptionSetting: Copies=71"
+*Copies 72/72: "%% FoomaticRIPOptionSetting: Copies=72"
+*Copies 73/73: "%% FoomaticRIPOptionSetting: Copies=73"
+*Copies 74/74: "%% FoomaticRIPOptionSetting: Copies=74"
+*Copies 75/75: "%% FoomaticRIPOptionSetting: Copies=75"
+*Copies 76/76: "%% FoomaticRIPOptionSetting: Copies=76"
+*Copies 77/77: "%% FoomaticRIPOptionSetting: Copies=77"
+*Copies 78/78: "%% FoomaticRIPOptionSetting: Copies=78"
+*Copies 79/79: "%% FoomaticRIPOptionSetting: Copies=79"
+*Copies 80/80: "%% FoomaticRIPOptionSetting: Copies=80"
+*Copies 81/81: "%% FoomaticRIPOptionSetting: Copies=81"
+*Copies 82/82: "%% FoomaticRIPOptionSetting: Copies=82"
+*Copies 83/83: "%% FoomaticRIPOptionSetting: Copies=83"
+*Copies 84/84: "%% FoomaticRIPOptionSetting: Copies=84"
+*Copies 85/85: "%% FoomaticRIPOptionSetting: Copies=85"
+*Copies 86/86: "%% FoomaticRIPOptionSetting: Copies=86"
+*Copies 87/87: "%% FoomaticRIPOptionSetting: Copies=87"
+*Copies 88/88: "%% FoomaticRIPOptionSetting: Copies=88"
+*Copies 89/89: "%% FoomaticRIPOptionSetting: Copies=89"
+*Copies 90/90: "%% FoomaticRIPOptionSetting: Copies=90"
+*Copies 91/91: "%% FoomaticRIPOptionSetting: Copies=91"
+*Copies 92/92: "%% FoomaticRIPOptionSetting: Copies=92"
+*Copies 93/93: "%% FoomaticRIPOptionSetting: Copies=93"
+*Copies 94/94: "%% FoomaticRIPOptionSetting: Copies=94"
+*Copies 95/95: "%% FoomaticRIPOptionSetting: Copies=95"
+*Copies 96/96: "%% FoomaticRIPOptionSetting: Copies=96"
+*Copies 97/97: "%% FoomaticRIPOptionSetting: Copies=97"
+*Copies 98/98: "%% FoomaticRIPOptionSetting: Copies=98"
+*Copies 99/99: "%% FoomaticRIPOptionSetting: Copies=99"
+*Copies 100/100: "%% FoomaticRIPOptionSetting: Copies=100"
+*CloseUI: *Copies
+
+*CloseGroup: General
+
+*OpenGroup: Adjustment/Adjustment
+
+*OpenUI *halftone/Halftone Algorithm: PickOne
+*FoomaticRIPOption halftone: enum CmdLine A
+*OrderDependency: 110 AnySetup *halftone
+*Defaulthalftone: default
+*halftone default/Default: "%% FoomaticRIPOptionSetting: halftone=default"
+*FoomaticRIPOptionSetting halftone=default: " "
+*halftone as/Accurate Screens (better): "%% FoomaticRIPOptionSetting: halftone=as"
+*FoomaticRIPOptionSetting halftone=as: " -qas "
+*halftone standard/Standard: "%% FoomaticRIPOptionSetting: halftone=standard"
+*FoomaticRIPOptionSetting halftone=standard: " -q1 "
+*halftone wts/Well Tempered Screens (best): "%% FoomaticRIPOptionSetting: halftone=wts"
+*FoomaticRIPOptionSetting halftone=wts: " -qwts "
+*CloseUI: *halftone
+
+*OpenUI *ICM/ICM Color Profile: PickOne
+*FoomaticRIPOption ICM: enum CmdLine A
+*OrderDependency: 300 AnySetup *ICM
+*DefaultICM: none
+*ICM none/No ICM color correction: "%% FoomaticRIPOptionSetting: ICM=none"
+*FoomaticRIPOptionSetting ICM=none: "-C10 -Gnone.icm "
+*ICM testing/File testing.icm: "%% FoomaticRIPOptionSetting: ICM=testing"
+*FoomaticRIPOptionSetting ICM=testing: "-C10 -Gtesting.icm "
+*ICM testing2/File testing2.icm: "%% FoomaticRIPOptionSetting: ICM=testing2"
+*FoomaticRIPOptionSetting ICM=testing2: "-C10 -Gtesting2.icm "
+*ICM testing3/File testing3.icm: "%% FoomaticRIPOptionSetting: ICM=testing3"
+*FoomaticRIPOptionSetting ICM=testing3: "-C10 -Gtesting3.icm "
+*CloseUI: *ICM
+
+*CloseGroup: Adjustment
+
+*OpenGroup: Miscellaneous/Miscellaneous
+
+*OpenUI *NupOrient/N-up Orientation: PickOne
+*FoomaticRIPOption NupOrient: enum CmdLine A
+*OrderDependency: 200 AnySetup *NupOrient
+*DefaultNupOrient: port
+*NupOrient land/Landscape: "%% FoomaticRIPOptionSetting: NupOrient=land"
+*FoomaticRIPOptionSetting NupOrient=land: "-ol "
+*NupOrient port/Portrait: "%% FoomaticRIPOptionSetting: NupOrient=port"
+*FoomaticRIPOptionSetting NupOrient=port: " "
+*NupOrient sea/Seascape: "%% FoomaticRIPOptionSetting: NupOrient=sea"
+*FoomaticRIPOptionSetting NupOrient=sea: "-os "
+*CloseUI: *NupOrient
+
+*OpenUI *NupPages/N-up Printing: PickOne
+*FoomaticRIPOption NupPages: enum CmdLine A
+*OrderDependency: 200 AnySetup *NupPages
+*DefaultNupPages: 1up
+*NupPages 1up/1-up: "%% FoomaticRIPOptionSetting: NupPages=1up"
+*FoomaticRIPOptionSetting NupPages=1up: " "
+*NupPages 2up/2-up: "%% FoomaticRIPOptionSetting: NupPages=2up"
+*FoomaticRIPOptionSetting NupPages=2up: "-2 "
+*NupPages 3up/3-up: "%% FoomaticRIPOptionSetting: NupPages=3up"
+*FoomaticRIPOptionSetting NupPages=3up: "-3 "
+*NupPages 4up/4-up: "%% FoomaticRIPOptionSetting: NupPages=4up"
+*FoomaticRIPOptionSetting NupPages=4up: "-4 "
+*NupPages 6up/6-up: "%% FoomaticRIPOptionSetting: NupPages=6up"
+*FoomaticRIPOptionSetting NupPages=6up: "-6 "
+*NupPages 8up/8-up: "%% FoomaticRIPOptionSetting: NupPages=8up"
+*FoomaticRIPOptionSetting NupPages=8up: "-8 "
+*NupPages 10up/10-up: "%% FoomaticRIPOptionSetting: NupPages=10up"
+*FoomaticRIPOptionSetting NupPages=10up: "-10 "
+*NupPages 12up/12-up: "%% FoomaticRIPOptionSetting: NupPages=12up"
+*FoomaticRIPOptionSetting NupPages=12up: "-12 "
+*NupPages 14up/14-up: "%% FoomaticRIPOptionSetting: NupPages=14up"
+*FoomaticRIPOptionSetting NupPages=14up: "-14 "
+*NupPages 15up/15-up: "%% FoomaticRIPOptionSetting: NupPages=15up"
+*FoomaticRIPOptionSetting NupPages=15up: "-15 "
+*NupPages 16up/16-up: "%% FoomaticRIPOptionSetting: NupPages=16up"
+*FoomaticRIPOptionSetting NupPages=16up: "-16 "
+*NupPages 18up/18-up: "%% FoomaticRIPOptionSetting: NupPages=18up"
+*FoomaticRIPOptionSetting NupPages=18up: "-18 "
+*CloseUI: *NupPages
+
+*CloseGroup: Miscellaneous
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
diff --git a/foo2hbpl2-wrapper.1in b/foo2hbpl2-wrapper.1in
new file mode 100644
index 0000000..b50649e
--- /dev/null
+++ b/foo2hbpl2-wrapper.1in
@@ -0,0 +1,239 @@
+'\" t
+.TH foo2hbpl2-wrapper 1 "${MODpage}" "foo2hbpl2-wrapper ${MODver}"
+#ifndef OLDGROFF
+#include "macros.man"
+#endif
+'\"==========================================================================
+'\" MANUAL PAGE SOURCE
+'\"==========================================================================
+.SH NAME
+foo2hbpl2-wrapper \- Convert Postscript into a ZJS printer stream
+.SH SYNOPSIS
+.B foo2hbpl2-wrapper
+.RI [ options "] [" ps-file ]
+.SH DESCRIPTION
+.B foo2hbpl2-wrapper
+is a Foomatic compatible printer wrapper for the \fBfoo2hbpl2\fP printer driver.
+This script reads a Postscript \fIps-file\fP or standard input
+and converts it to Zenographics ZjStream printer format
+for driving the Dell 1153,
+Fuji Xerox DocuPrint CM205,
+and Xerox WorkCentre 6015 MFP printers.
+.P
+This script can be used in a standalone fashion, but is intended to
+be called from a printer spooler system which uses the Foomatic
+printer database.
+
+.SH COMMAND LINE OPTIONS
+.SS Normal Options
+These are the options used to select the parameters of a
+print job that are usually controlled on a per job basis.
+.TP
+.BI \-c
+Print in color (else monochrome).
+.TP
+.BI \-C\0 colormode
+Color correction mode [0].
+.TS
+n l .
+10 ICM color profile (using -G *.icm file)
+.TE
+.TP
+.BI \-d\0 duplex
+Duplex code to send to printer [1].
+.TS
+| n l | n l | n l .
+1 off 2 long edge 3 short edge
+.TE
+.TP
+.BI \-m\0 media
+Media code to send to printer [1].
+.TS
+l r.
+_
+Media HBPL
+_
+plain 1
+bond 2
+lwcard 3
+lwgcard 4
+labels 5
+envelope 6
+recycled 7
+plain2 8
+bond2 9
+lwcard2 10
+lwgcard2 11
+recycled2 12
+.TE
+.TP
+.BI \-p\0 paper
+Paper size code to send to printer [1].
+.TS
+l r.
+_
+Paper HBPL
+_
+A4 1
+B5jis 2
+letter 4
+executive 5
+fanfold german legal 6
+folio 6
+legal 7
+env#10 9
+envMonarch 10
+envC5 11
+envDL 12
+.TE
+.TP
+.BI \-n\0 copies
+Number of copies [1].
+.TP
+.BI \-r\0 xres x yres
+Set device resolution in pixels/inch [1200x600].
+.TP
+.BI \-s\0 source
+Source (Input Slot) code to send to printer [7].
+.TS
+| n l | n l.
+1 upper 4 manual
+2 lower 7 auto
+.TE
+.TP
+.BI \-t
+Draft mode. Every other pixel is white.
+.TP
+.BI \-T\0 density
+Print density (1-5). The default is 3 (medium).
+.TP
+.BI "\-2 \-3 \-4 \-5 \-6 \-8 \-9 \-10 \-12 \-14 \-15 \-16 \-18"
+Print in N-up. Requires the \fBpsutils\fP package.
+.TP
+.BI \-o\0 orient
+Orientation used for N-up.
+.TS
+l l l.
+Portrait -op (normal)
+Landscape -ol (rotated 90 degrees anticlockwise)
+Seascape -os (rotated 90 degrees clockwise)
+.TE
+.SS Printer Tweaking Options
+These are the options used to customize the operation of \fBfoo2hbpl2\fP
+for a particular printer.
+.TP
+.BI \-u\0 xoff x yoff
+Set the offset of the start of the printable region from the
+upper left corner, in pixels [varies with paper size].
+The defaults should work on the 2200DL and 2300DL, and have not
+been tested on any other printers.
+.TP
+.BI \-l\0 xoff x yoff
+Set the offset of the end of the printable region from the
+lower right corner, in pixels [varies with paper size].
+The defaults should work on the 2200DL and 2300DL, and have not
+been tested on any other printers.
+.TP
+.BI \-L\0 mask
+Send the logical clipping values from -u/-l in the ZjStream.
+\fBfoo2hbpl2-wrapper\fP always runs Ghostscript with the ideal page dimensions,
+so that the scale of the image is correct,
+regardless whether or not the printer has unprintable regions.
+This option is used to move the position of the clipped image
+back to where it belongs on the page. The default is to send
+the amount which was clipped by -u and -l, and should be
+good in most cases.
+.TS
+l l.
+0 don't send any logical clipping amounts
+1 only send Y clipping amount
+2 only send X clipping amount
+3 send both X and Y clipping amounts
+.TE
+.TP
+.BI \-P
+Do not send START_PLANE codes on monochrome output. May be
+needed by some monochrome-only printers, such as the
+HP LaserJet 1000.
+.TP
+.BI \-X\0 padlen
+Add extra zero padding to the end of BID segments. The default is
+16 bytes. Padding 16 bytes of zeroes
+is needed for older ZjStream printers, such as the Minolta 2200DL
+and HP LaserJet 1000, and seems harmless to newer ones, such as
+the Minolta 2300DL. So the default should be good for all cases.
+.SS Color Tweaking Options
+These are the options used to control the quality of color output.
+Color correction is currently a WORK IN PROGRESS.
+.TP
+.BI \-g\0 gsopts
+Additional options to pass to Ghostscript, such as -g\(lq-dDITHERPPI=nnn\(rq,
+etc. This option may appear more than once.
+.TP
+.BI \-G\0 profile.icm
+Convert \fIprofile.icm\fP to a Postscript color rendering
+dictionary (CRD) using \fBfoo2zjs-icc2ps\fP and
+adjust the printer colors by using the Postscript \fBsetcolorrendering\fP
+operator. (WORK IN PROGRESS).
+.TP
+.BI \-G\0 gamma-file.ps
+Prepend \fIgamma-file.ps\fP to the Postscript input to perform
+color correction using the \fBsetcolortransfer\fP Postscript operator.
+For example, the file might contain:
+.br
+{0.333 exp} {0.333 exp} {0.333 exp} {0.333 exp} setcolortransfer
+.TP
+.BI \-I\0 intent
+Select profile intent from the ICM file.
+0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute.
+Default is 0 (perceptual).
+.SS Debugging Options
+These options are used for debugging \fBfoo2hbpl2\fP and its wrapper.
+.TP
+.BI \-S\0 plane
+Output just a single color plane from a color print and print it
+on the black plane. The default is to output all color planes.
+.TS
+l l.
+1 Cyan
+2 Magenta
+3 Yellow
+4 Black
+.TE
+.TP
+.BI \-D\0 level
+Set Debug level [0].
+
+.SH EXAMPLES
+Create a monochrome ZjStream from a Postscript document,
+examine it, and then print it using a RAW print queue:
+
+.RS
+.nf
+foo2hbpl2-wrapper testpage.ps > testpage.prn
+hbpl2decode < testpage.prn
+lpr -P raw testpage.prn
+.fi
+.RE
+.P
+Create a color ZjStream stream from a Postscript document:
+
+.RS
+.nf
+foo2hbpl2-wrapper -c testpage.ps > testpage.prn
+.fi
+.RE
+
+.SH FILES
+.BR /usr/bin/foo2hbpl2-wrapper
+.SH SEE ALSO
+.BR foo2hbpl2 (1),
+.BR hbpldecode (1)
+.SH "AUTHOR"
+Rick Richardson <rick.richardson@comcast.net>
+.br
+${URLZJS}/
+'/"
+'/"
+'/"
+.em pdf_outline
diff --git a/foo2hbpl2-wrapper.in b/foo2hbpl2-wrapper.in
new file mode 100755
index 0000000..f29bc1a
--- /dev/null
+++ b/foo2hbpl2-wrapper.in
@@ -0,0 +1,724 @@
+#!/bin/sh
+
+#* Copyright (C) 2013 Rick Richardson
+#*
+#* This program is free software; you can redistribute it and/or modify
+#* it under the terms of the GNU General Public License as published by
+#* the Free Software Foundation; either version 2 of the License, or
+#* (at your option) any later version.
+#*
+#* This program is distributed in the hope that it will be useful,
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#* GNU General Public License for more details.
+#*
+#* You should have received a copy of the GNU General Public License
+#* along with this program; if not, write to the Free Software
+#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#*
+#* Authors: Rick Richardson <rick.richardson@comcast.net>
+
+VERSION='$Id: foo2hbpl2-wrapper.in,v 1.3 2013/03/03 17:05:03 rick Exp $'
+
+#
+# Printer Notes:
+#
+# Dell 1355 Multifunction Color Printer
+# Xerox WorkCentre 6015 Multifunction Color Printer
+# Fuji Xerox DocuPrint CM205 Multifunction Color Printer
+#
+
+PROGNAME="$0"
+BASENAME=`basename $PROGNAME`
+PREFIX=/usr
+SHARE=$PREFIX/share/foo2hbpl
+PATH=$PATH:/sw/bin:/opt/local/bin
+
+#
+# Log the command line, for debugging and problem reports
+#
+if [ -x /usr/bin/logger -o -x /bin/logger ]; then
+ logger -t "$BASENAME" -p lpr.info -- "$BASENAME $@" </dev/null
+fi
+
+usage() {
+ cat <<EOF
+Usage:
+ $BASENAME [options] [ps-file]
+
+ Foomatic printer wrapper for the foo2hbpl2 printer driver.
+ This script reads a Postscript ps-file or standard input
+ and converts it to a Xerox HBPL version 2 stream.
+
+Normal Options:
+-c Print in color (else monochrome)
+-C colormode Colormode [$COLORMODE]
+ 10=ICM RGB color profile (using -G *.icm file)
+-d duplex Duplex code to send to printer [$DUPLEX]
+ 1=off, 2=longedge, 3=shortedge
+-m media Media code to send to printer [$MEDIA]
+ 1=plain, 2=bond, 3=lwcard, 4=lwgcard, 5=labels,
+ 6=envelope, 7=recycled, 8=plain2, 9=bond2,
+ 10=lwcard2, 11=lwgcard2, 12=recycled2
+-p paper Paper code [$PAPER]
+ 1=A4, 2=B5, 4=letter, 5=executive,
+ 6=fanfoldgermanlegal/folio, 7=legal, 9=env#10,
+ 10=envMonarch, 11=envC5, 12=envDL
+-n copies Number of copies [$COPIES]
+-r <xres>x<yres> Set device resolution in pixels/inch [$RES]
+-s source Source code to send to printer [$SOURCE]
+ 1=upper, 2=lower, 4=manual, 7=auto
+ Code numbers may vary with printer model.
+-t Draft mode. Every other pixel is white.
+-2/-3/-4/-6/-8/-10/-12/-14/-15/-16/-18
+ Print with N-up (requires psutils)
+-o orient For N-up: -op is portrait, -ol is landscape, -os is seascape.
+
+Printer Tweaking Options:
+-u <xoff>x<yoff> Set offset of upper left printable in pixels [varies]
+-l <xoff>x<yoff> Set offset of lower right printable in pixels [varies]
+-L mask Send logical clipping values from -u/-l in ZjStream [3]
+ 0=no, 1=Y, 2=X, 3=XY
+-P Do not output START_PLANE codes. May be needed by some
+ monochrome-only printers.
+-X padlen Add extra zero padding to the end of BID segments [16]
+
+Color Tweaking Options:
+-g gsopts Additional options to pass to Ghostscript, such as
+ -dDITHERPPI=nnn, etc. May appear more than once. []
+-G profile.icm Convert profile.icm to a Postscript CRD using icc2ps and
+ adjust colors using the setcolorrendering PS operator.
+ $SHARE/icm/ will be searched for profile.icm.
+-I intent Select profile intent from ICM file [$INTENT]
+ 0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute
+-G gamma-file.ps Prepend gamma-file to the Postscript input to perform
+ color correction using the setcolortransfer PS operator.
+
+Debugging Options:
+-S plane Output just a single color plane from a color print [all]
+ 1=Cyan, 2=Magenta, 3=Yellow, 4=Black
+-D lvl Set Debug level [$DEBUG]
+-V $VERSION
+EOF
+
+ exit 1
+}
+
+#
+# Report an error and exit
+#
+error() {
+ echo "$BASENAME: $1" >&2
+ exit 1
+}
+
+dbgcmd() {
+ if [ $DEBUG -ge 1 ]; then
+ echo "$@" >&2
+ fi
+ "$@"
+}
+
+#
+# N-up-ify the job. Requires psnup from psutils package
+#
+nup() {
+ case "$NUP" in
+ [2368]|1[0458])
+ tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.3in -p$paper -q
+ ;;
+ [49]|1[26])
+ tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.5in -p$paper -q
+ ;;
+ *)
+ error "Illegal call to nup()."
+ ;;
+ esac
+}
+
+#
+# Process the options
+#
+
+# Try to use a local copy of GhostScript 8.54, if available. Otherwise,
+# fallback to whatever the Linux distro has installed (usually 7.07)
+#
+# N.B. := operator used here, when :- would be better, because "ash"
+# doesn't have :-
+if eval gs.foo -v >/dev/null 2>&1; then
+ GSBIN=${GSBIN:-gs.foo}
+else
+ GSBIN=${GSBIN:-gs}
+fi
+
+CMDLINE="$*"
+DEBUG=0
+DUPLEX=1
+COLOR=
+COLORMODE=default
+MODEL=0
+QUALITY=1
+QUALITY=wts
+MEDIA=1 # plain
+COPIES=1
+PAPER=4 # letter
+RES=1200x600
+SOURCE=1
+NUP=
+CLIP_UL=
+CLIP_LR=
+CLIP_LOG=
+BC=
+AIB=
+NOPLANES=
+COLOR2MONO=
+GAMMAFILE=default
+INTENT=0
+GSOPTS=
+EXTRAPAD=
+SAVETONER=
+NUP_ORIENT=
+GSDEV=-sDEVICE=pbmraw
+# What mode to use if the user wants us to pick the "best" mode
+case `$GSBIN --version` in
+7*) DEFAULTCOLORMODE=10
+ DEFAULTCOLORMODE=1
+ ;;
+8.1*)
+ DEFAULTCOLORMODE=1
+ QUALITY=1
+ ;;
+*) DEFAULTCOLORMODE=1
+ ;;
+esac
+while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tz:ABS:D:G:I:PX:Vh?" opt
+do
+ case $opt in
+ b) GSBIN="$OPTARG";;
+ c) COLOR=-c;;
+ d) DUPLEX="$OPTARG";;
+ g) GSOPTS="$GSOPTS $OPTARG";;
+ m) MEDIA="$OPTARG";;
+ n) COPIES="$OPTARG";;
+ p) PAPER="$OPTARG";;
+ q) QUALITY="$OPTARG";;
+ r) RES="$OPTARG";;
+ s) SOURCE="$OPTARG";;
+ t) SAVETONER="-t";;
+ z) MODEL="$OPTARG";;
+ l) CLIP_LR="-l $OPTARG";;
+ u) CLIP_UL="-u $OPTARG";;
+ L) CLIP_LOG="-L $OPTARG";;
+ A) AIB=-A;;
+ B) BC=-B;;
+ C) COLORMODE="$OPTARG";;
+ S) COLOR2MONO="-S$OPTARG";;
+ D) DEBUG="$OPTARG";;
+ G) GAMMAFILE="$OPTARG";;
+ I) INTENT="$OPTARG";;
+ P) NOPLANES=-P;;
+ X) EXTRAPAD="-X $OPTARG";;
+ [234689]) NUP="$opt";;
+ [57]) error "Can't find acceptable layout for $opt-up";;
+ 1) case "$OPTARG" in
+ [024568]) NUP="1$OPTARG";;
+ *) error "Can't find acceptable layout for 1$OPTARG-up";;
+ esac
+ ;;
+ o) case "$OPTARG" in
+ l*) NUP_ORIENT=-l;;
+ s*) NUP_ORIENT=-r;;
+ p*|*) NUP_ORIENT=;;
+ esac;;
+ V) echo "$VERSION"; foo2hbpl -V; foo2zjs-pstops -V; exit 0;;
+ h|\?)
+ if [ "$CMDLINE" != "-?" -a "$CMDLINE" != -h ]; then
+ echo "Illegal command:"
+ echo " $0 $CMDLINE"
+ echo
+ fi
+ usage;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+#
+# If there is an argument left, take it as the file to print.
+# Else, the input comes from stdin.
+#
+if [ $# -ge 1 ]; then
+ if [ "$LPJOB" = "" ]; then
+ : # LPJOB="$1"
+ fi
+ exec < $1
+fi
+
+#
+case "$QUALITY" in
+0)
+ GSOPTS="-dCOLORSCREEN $GSOPTS"
+ ;;
+1)
+ GSOPTS="-dCOLORSCREEN $GSOPTS"
+ ;;
+2)
+ GSOPTS="-dMaxBitmap=500000000 $GSOPTS"
+ ;;
+as)
+ GSOPTS="-dCOLORSCREEN -dMaxBitmap=500000000 $GSOPTS"
+ ;;
+wts)
+ GSOPTS="-dCOLORSCREEN -dMaxBitmap=500000000 $GSOPTS"
+ ;;
+esac
+
+#
+# Validate model code
+#
+case "$MODEL" in
+0|1|2|3) ;;
+*) error "Unknown model code $MODEL";;
+esac
+
+#
+# Validate media code
+#
+case "$MEDIA" in
+1|plain) MEDIA=1;;
+2|bond) MEDIA=2;;
+3|lwcard) MEDIA=3;;
+4|lwgcard) MEDIA=4;;
+5|labels) MEDIA=5;;
+6|envelope) MEDIA=6;;
+7|recycled) MEDIA=7;;
+8|plain2) MEDIA=1;;
+9|bond2) MEDIA=2;;
+10|lwcard2) MEDIA=3;;
+11|lwgcard2) MEDIA=4;;
+12|recycled2) MEDIA=7;;
+[0-9]*) ;;
+*) error "Unknown media code $MEDIA";;
+esac
+
+#
+# Validate source (InputSlot) code
+#
+case "$SOURCE" in
+1|auto) SOURCE=1;;
+2|manual) SOURCE=2;;
+3|multi) SOURCE=3;;
+4|tray1) SOURCE=4;;
+[0-9]*) ;;
+*) error "Unknown source code $SOURCE";;
+esac
+
+#
+# Validate Duplex code
+#
+case "$DUPLEX" in
+1|off|none) DUPLEX=1;;
+2|long*) DUPLEX=2;;
+3|short*) DUPLEX=3;;
+[0-9]*) ;;
+*) error "Unknown duplex code $DUPLEX";;
+esac
+
+#
+# Validate Resolution
+#
+case "$RES" in
+#600x600) ;;
+1200x600) ;;
+#1200x1200) ;;
+#2400x600) ;;
+*) error "Illegal resolution $RES";;
+esac
+
+#
+# Figure out the paper dimensions in pixels/inch, and set the
+# default clipping region. Unfortunately, this is a trouble
+# area for ZjStream printers. Various versions of ZjS print
+# engines react differently when asked to print into their
+# unprintable regions.
+#
+set_clipping() {
+ ulx=$1; uly=$2
+ lrx=$3; lry=$4
+
+ # Set clipping region if it isn't already set
+ if [ "$CLIP_UL" = "" ]; then
+ case "$RES" in
+ 600x600) ulx=`expr $ulx / 2`;;
+ 2400x600) ulx=`expr $ulx \* 2`;;
+ esac
+ CLIP_UL="-u ${ulx}x${uly}"
+ fi
+ if [ "$CLIP_LR" = "" ]; then
+ case "$RES" in
+ 600x600) lrx=`expr $lrx / 2`;;
+ 2400x600) lrx=`expr $lrx \* 2`;;
+ esac
+ CLIP_LR="-l ${lrx}x${lry}"
+ fi
+}
+
+case "$PAPER" in
+Custom*x*)
+ # Command line only
+ XDIM=`echo "$PAPER" | sed -e "s/Custom.//" -e "s/x.*//" `
+ YDIM=`echo "$PAPER" | sed -e "s/.*x//" `
+ if [ "$XDIM" = "" -o "$YDIM" = "" ]; then
+ error "Custom page size '$PAPER' != 1-99999"
+ fi
+ if [ "$XDIM" -eq 0 -o "$YDIM" -eq 0 ]; then
+ error "Custom page size '$PAPER' != 1-99999"
+ fi
+ XDIM=`dc -e "$XDIM 1200* 72/p"`
+ YDIM=`dc -e "$YDIM 600* 72/p"`
+ PAPER=21; paper=letter;
+ # Doesn't work on a real printer - smudges.
+ # set_clipping 2 100 2 100
+ set_clipping 150 100 150 100
+ ;;
+Custom*)
+ #%%BeginFeature: *CustomPageSize True
+ #216
+ #360
+ #0
+ #0
+ #0
+ #pop pop pop pop pop
+
+ #%%BeginFeature: *CustomPageSize True
+ #792.000000 612.000000 1 0.000000 0.000000
+ #pop pop pop pop pop
+
+ if [ $DEBUG = 0 ]; then
+ TMPFILE=/tmp/cus$$
+ else
+ TMPFILE=/tmp/custom.ps
+ fi
+ cat >$TMPFILE
+ exec <$TMPFILE
+
+ tmp=`head -n 10000 $TMPFILE \
+ | sed -n '/CustomPageSize/{n;p;n;p;}' \
+ | tr '\n' ' '`
+ case "$tmp" in
+ [0-9]*\ [0-9]*)
+ XDIM=`echo "$tmp" | sed 's/ .*//'`
+ YDIM=`echo "$tmp" | sed -e 's/^[^ ]* //' -e 's/ .*//'`
+ ;;
+ *)
+ if [ $DEBUG = 0 ]; then rm -f $TMPFILE; fi
+ error "Custom page size [XY]DIM != 1-99999"
+ ;;
+ esac
+ XDIM=`dc -e "$XDIM 1200* 72/p"`
+ YDIM=`dc -e "$YDIM 600* 72/p"`
+ PAPER=21; paper=letter;
+ # Doesn't work on a real printer - smudges.
+ # set_clipping 2 100 2 100
+ set_clipping 150 100 150 100
+ ;;
+1|a4|A4) PAPER=1; paper=a4; XDIM="9920"; YDIM="7016"
+ set_clipping 150 100 150 100
+ ;;
+2|b5jis|B5jis) PAPER=2; paper=b5; XDIM="8598"; YDIM="6070"
+ set_clipping 138 100 138 100 # modulo 256
+ ;;
+4|letter) PAPER=4; paper=letter; XDIM="10200"; YDIM="6600"
+ set_clipping 150 100 150 100
+ ;;
+5|executive) PAPER=5; paper=executive; XDIM="8700"; YDIM="6300"
+ set_clipping 150 100 150 100
+ ;;
+6|fanfoldgermanlegal|folio)
+ PAPER=6; paper=legal; XDIM="10200"; YDIM="7800"
+ set_clipping 150 100 150 100
+ ;;
+7|legal) PAPER=7; paper=legal; XDIM="10200"; YDIM="8400"
+ set_clipping 150 100 150 100
+ ;;
+9|"env#10") PAPER=9; paper=env10; XDIM="4950"; YDIM="5700"
+ set_clipping 171 100 171 100 # modulo 256
+ ;;
+10|envMonarch) PAPER=10; paper=envMonarch;XDIM="4650"; YDIM="4500"
+ set_clipping 150 100 150 100
+ ;;
+11|envC5) PAPER=11; paper=envC5; XDIM="7650"; YDIM="5408"
+ set_clipping 150 100 150 100
+ ;;
+12|envDL) PAPER=12; paper=envDL; XDIM="5200"; YDIM="5200"
+ set_clipping 168 100 168 100 # modulo 256
+ ;;
+#16|a5|A5) PAPER=16; paper=a5; XDIM="6992"; YDIM="4960"
+# set_clipping 168 100 168 100 # modulo 256
+# ;;
+#24|folio) PAPER=24; paper=folio; XDIM="9922"; YDIM="7796"
+# set_clipping 150 100 150 100
+# ;;
+#26|"env#9") PAPER=26; paper=env9; XDIM="4496"; YDIM="5324"
+# set_clipping 200 100 200 100 # modulo 256
+# ;;
+#23|envC6) PAPER=23; paper=envC6; XDIM="5386"; YDIM="3826"
+# set_clipping 150 100 150 100
+# ;;
+#12|b5iso|B5iso) PAPER=12; paper=b5; XDIM="8314"; YDIM="5906"
+# set_clipping 189 100 189 100 # modulo 256
+# ;;
+#25|env6.75) PAPER=25; paper=env6.75; XDIM="4348"; YDIM="3900"
+# set_clipping 150 100 150 100
+# ;;
+#17|a6|A6) PAPER=17; paper=a6; XDIM="4960"; YDIM="3496"
+# set_clipping 176 100 176 100 # modulo 256
+# ;;
+#28|oficio) PAPER=28; paper=a6; XDIM="10200"; YDIM="8100"
+# set_clipping 150 100 150 100
+# ;;
+*) error "Unimplemented paper code $PAPER";;
+esac
+# e.g. /usr/share/ghostscript/7.07/lib/gs_statd.ps
+PAPERSIZE="-sPAPERSIZE=$paper";
+
+case "$RES" in
+600x600) XDIM=`expr $XDIM / 2`;;
+1200x600) ;;
+1200x1200) YDIM=`expr $YDIM \* 2`;;
+2400x600) XDIM=`expr $XDIM \* 2`;;
+esac
+DIM="${XDIM}x${YDIM}"
+
+#
+# Filter thru psnup if N-up printing has been requested
+#
+case $NUP in
+[234689]|1[024568]) PREFILTER="nup";;
+*) PREFILTER=cat;;
+esac
+if [ "$DEBUG" -ge 9 ]; then
+ PREFILTER="tee /tmp/$BASENAME.ps"
+fi
+
+#
+# Overload -G. If the file name ends with ".icm" or ".ICM"
+# then convert the ICC color profile to a Postscript CRD,
+# then prepend it to the users job. Select the intent
+# using the -I option.
+#
+
+create_crd() {
+ #
+ # Create a Postscript CRD
+ #
+ ICC2PS=$PREFIX/bin/foo2zjs-icc2ps
+ if [ -x $ICC2PS ]; then
+ case "$GAMMAFILE" in
+ none | none.icm | */none.icm)
+ ;;
+ *)
+ if [ -x /usr/bin/logger ]; then
+ logger -t "$BASENAME" -p lpr.info -- \
+ "`basename $ICC2PS` -o $GAMMAFILE -t$INTENT > $ICCTMP.crd.ps"
+ fi
+ $ICC2PS -o $GAMMAFILE -t$INTENT > $ICCTMP.crd.ps 2>$ICCTMP.log \
+ || error "Problem converting .ICM file to Postscript"
+ ;;
+ esac
+
+ PSTOPS_OPTS="$PSTOPS_OPTS -c"
+ cat > $ICCTMP.usecie.ps <<-EOF
+ %!PS-Adobe-3.0
+ <</UseCIEColor true>>setpagedevice
+ EOF
+ if [ "$QUALITY" = wts -o "$QUALITY" = as ]; then
+ if [ "$QUALITY" = wts ]; then
+ cat >> $ICCTMP.usecie.ps <<-EOF
+ << /UseWTS true >> setuserparams
+ EOF
+ else
+ cat >> $ICCTMP.usecie.ps <<-EOF
+ << /UseWTS false >> setuserparams
+ EOF
+ fi
+ cat >> $ICCTMP.usecie.ps <<-EOF
+ <<
+ /AccurateScreens true
+ /HalftoneType 1
+ /HalftoneName (Round Dot Screen) cvn
+ /SpotFunction { 180 mul cos exch 180 mul cos add 2 div}
+ /Frequency 137
+ /Angle 37
+ >> sethalftone
+ EOF
+ fi
+ cat > $ICCTMP.selcrd.ps <<-EOF
+ /Current /ColorRendering findresource setcolorrendering
+ EOF
+ case "$GAMMAFILE" in
+ none | none.icm | */none.icm) GAMMAFILE="$ICCTMP.usecie.ps";;
+ *) GAMMAFILE="$ICCTMP.usecie.ps $ICCTMP.crd.ps $ICCTMP.selcrd.ps";;
+ esac
+ else
+ GAMMAFILE=
+ fi
+}
+
+if [ $DEBUG -gt 0 ]; then
+ ICCTMP=/tmp/icc
+else
+ ICCTMP=/tmp/icc$$
+fi
+
+if [ "" = "$COLOR" ]; then
+ COLORMODE=
+ GAMMAFILE=
+else
+ case "$COLORMODE" in
+ default) COLORMODE=$DEFAULTCOLORMODE;;
+ esac
+ case "$GAMMAFILE" in
+ default) GAMMAFILE=samclp300-0.icm;;
+ esac
+fi
+
+CRDBASE="$PREFIX/share/foo2hbpl/crd"
+case "$MODEL" in
+ 0) model=CLP-300;;
+ 1) model=CLP-600;;
+ 2) model=CLP-600;;
+ 3) model=CLP-600;;
+esac
+case "$RES" in
+ 600x600) SCREEN=$model-600x600cms2;;
+ 1200x600) SCREEN=$model-1200x600cms2;;
+ 1200x1200) SCREEN=$model-1200x1200cms2;;
+esac
+
+PSTOPS_OPTS="-n"
+
+case "$COLORMODE" in
+0|"")
+ # Monochrome
+ ;;
+10|icm)
+ # Use old ICM method
+ AIB=-A
+ BC=-B
+ case "$GAMMAFILE" in
+ none | none.icm | */none.icm)
+ create_crd
+ ;;
+ *.icm|*.ICM|*.icc|*.ICC)
+ #
+ # Its really an .ICM file, not a gamma file.
+ #
+ # The file can be a full path name, or the name of a file in $SHARE/icm/
+ #
+ if [ -r "$GAMMAFILE" ]; then
+ create_crd
+ elif [ -r "$SHARE/icm/$GAMMAFILE" ]; then
+ GAMMAFILE="$SHARE/icm/$GAMMAFILE"
+ create_crd
+ else
+ GAMMAFILE=
+ fi
+ ;;
+ esac
+ ;;
+1|crd)
+ # CRD
+ GAMMAFILE=""
+ GAMMAFILE="$GAMMAFILE $CRDBASE/${model}cms"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
+ # Black text...
+ TMPFILE2=/tmp/black$$
+ cat $CRDBASE/black-text.ps - >$TMPFILE2
+ exec <$TMPFILE2
+ ;;
+*.crd)
+ GAMMAFILE="$CRDBASE/prolog.ps"
+ if [ -f $COLORMODE ]; then
+ GAMMAFILE="$GAMMAFILE $COLORMODE"
+ elif [ -f $CRDBASE/$COLORMODE ]; then
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$COLORMODE"
+ else
+ error "Can't find CRD '$COLORMODE' in . or in $CRDBASE"
+ fi
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
+ ;;
+*)
+ error "Unknown color method '$COLORMODE'"
+ ;;
+esac
+
+if [ "$COLOR" != "" -a "$QUALITY" = wts ]; then
+ PSTOPS_OPTS="$PSTOPS_OPTS -w"
+elif [ "$COLOR" != "" -a "$QUALITY" = as ]; then
+ PSTOPS_OPTS="$PSTOPS_OPTS -a"
+fi
+
+if [ "" != "$COLOR" ]; then
+ if [ "" = "$AIB" -a "" = "$BC" ]; then
+ # Faster, but can't handle AllIsBlack or BlackClears
+ GSDEV=-sDEVICE=pksmraw
+ else
+ # Can't handle different size pages
+ GSDEV=-sDEVICE=bitcmyk
+ fi
+fi
+
+#
+# Figure out USERNAME
+#
+if [ "$LPUSER" != "" ]; then
+ USER="$LPUSER@$LPHOST"
+else
+ USER=""
+fi
+
+#
+# Main Program, just cobble together the pipeline and run it
+#
+# The malarky with file descriptors 1 and 3 is to avoid a bug in
+# (some versions?) of Ghostscript where Postscript's stdout gets
+# intermingled with the printer drivers output, resulting in
+# corrupted image data.
+#
+GS="$GSBIN -q -dBATCH -dSAFER -dQUIET -dNOPAUSE"
+
+foo2zjs-pstops $PSTOPS_OPTS | \
+$PREFILTER \
+| ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \
+ -sOutputFile="|cat 1>&3" $GAMMAFILE -_ >/dev/null) 3>&1 \
+| foo2hbpl2 -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
+ -z$MODEL $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER \
+ -J "$LPJOB" -U "$USER" \
+ $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG
+
+#
+# Log the command line, for debugging and problem reports
+#
+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 -- \
+ "foo2hbpl2 -r$RES -g$DIM -p$PAPER -m$MEDIA \
+-n$COPIES -d$DUPLEX -s$SOURCE -z$MODEL $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG \
+$SAVETONER $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD"
+fi
+
+#
+# Remove cruft
+#
+if [ $DEBUG -eq 0 ]; then
+ for i in crd.ps log usecie.ps selcrd.ps
+ do
+ file="$ICCTMP.$i"
+ [ -f $file ] && rm -f $file
+ done
+ [ -f "$TMPFILE" ] && rm -f $TMPFILE
+ [ -f "$TMPFILE2" ] && rm -f $TMPFILE2
+fi
+
+exit 0
diff --git a/foo2hbpl2.1in b/foo2hbpl2.1in
new file mode 100644
index 0000000..72ba63c
--- /dev/null
+++ b/foo2hbpl2.1in
@@ -0,0 +1,203 @@
+'\" t
+.TH foo2hbpl2 1 "${MODpage}" "foo2hbpl2 ${MODver}"
+#ifndef OLDGROFF
+#include "macros.man"
+#endif
+'\"==========================================================================
+'\" MANUAL PAGE SOURCE
+'\"==========================================================================
+.SH NAME
+foo2hbpl2 \- Convert Ghostscript pbmraw or bitcmyk format into a
+ZJS printer stream
+.SH SYNOPSIS
+.B foo2hbpl2
+.RI [ options "] <" pbmraw-file " >" hbpl2-file
+.sp 1
+.B foo2hbpl2
+.RI [ options "] <" bitcmyk-file " >" hbpl2-file
+.sp 1
+.B foo2hbpl2
+.RI [ options "] <" pksmraw-file " >" hbpl2-file
+.SH DESCRIPTION
+.B foo2hbpl2
+converts Ghostscript pbmraw, bitcmyk, or pksmraw output formats to monochrome
+or color ZJS streams,
+for driving the Dell 1153,
+Fuji Xerox DocuPrint CM205,
+and Xerox WorkCentre 6015 MFP printers.
+
+.SH COMMAND LINE OPTIONS
+.SS Normal Options
+These are the options used to select the parameters of a
+print job that are usually controlled on a per job basis.
+.TP
+.BI \-c
+Force color mode if autodetect doesn't work.
+.TP
+.BI \-d\0 duplex
+Duplex code to send to printer [1].
+.TS
+| n l | n l | n l .
+1 off 2 long edge 3 short edge
+.TE
+.TP
+.BI \-g\0 xpix x ypix
+Set page dimensions in pixels [10200x6600].
+.TP
+.BI \-m\0 media
+Media code to send to printer [1].
+.TS
+l r.
+_
+Media HBPL
+_
+plain 1
+bond 2
+lwcard 3
+lwgcard 4
+labels 5
+envelope 6
+recycled 7
+plain2 8
+bond2 9
+lwcard2 10
+lwgcard2 11
+recycled2 12
+.TE
+.TP
+.BI \-p\0 paper
+Paper code to send to printer [1].
+.TS
+l r.
+_
+Paper HBPL
+_
+A4 1
+B5jis 2
+letter 4
+executive 5
+fanfold german legal 6
+folio 6
+legal 7
+env#10 9
+envMonarch 10
+envC5 11
+envDL 12
+.TE
+.TP
+.BI \-n\0 copies
+Number of copies [1].
+.TP
+.BI \-r\0 xres x yres
+Set device resolution in pixels/inch [1200x600].
+.TP
+.BI \-s\0 source
+Source (InputSlot) code to send to printer [7].
+.TS
+| n l | n l.
+1 upper 4 manual
+2 lower 7 auto
+.TE
+.TP
+.BI \-t
+Draft mode. Every other pixel is white.
+.TP
+.BI \-J\0 filename
+Filename string to send to printer.
+.TP
+.BI \-U\0 username
+Username string to send to printer.
+.SS Printer Tweaking Options
+These are the options used to customize the operation of \fBfoo2hbpl2\fP
+for a particular printer.
+.TP
+.BI \-u\0 xoff x yoff
+Set the offset of the start of the printable region from the
+upper left corner, in pixels [0x0].
+.TP
+.BI \-l\0 xoff x yoff
+Set the offset of the end of the printable region from the
+lower right corner, in pixels [0x0].
+.TP
+.BI \-L\0 mask
+Send logical clipping amounts implied by -u/-l in the ZjStream [3].
+.TS
+l l.
+0 don't send any logical clipping amounts
+1 only send Y clipping amount
+2 only send X clipping amount
+3 send both X and Y clipping amounts
+.TE
+.TP
+.BI \-P
+Do not send START_PLANE codes on monochrome output. May be
+needed by some black and white only printers, such as the
+HP LaserJet 1000.
+.TP
+.BI \-A
+AllIsBlack: convert C=1,M=1,Y=1 to just K=1. Works with bitcmyk input only.
+.TP
+.BI \-B
+BlackClears: K=1 forces C,M,Y to 0. Works with bitcmyk input only.
+.TP
+.BI \-X\0 padlen
+Add extra zero padding to the end of BID segments. The default is
+16 bytes. Padding 16 bytes of zeroes
+is needed for older ZjStream printers, such as the Minolta 2200DL
+and HP LaserJet 1000, and seems harmless to newer ones, such as
+the Minolta 2300DL. So the default should be good for all cases.
+.SS Debugging Options
+These options are used for debugging \fBfoo2hbpl2\fP.
+.TP
+.BI \-S\0 plane
+Output just a single color plane from a color print and print it
+on the black plane. The default is to output all color planes.
+.TS
+l l.
+1 Cyan
+2 Magenta
+3 Yellow
+4 Black
+.TE
+.TP
+.BI \-D\0 level
+Set Debug level [0].
+
+.SH EXAMPLES
+Create a black and white ZJS stream:
+
+.RS
+.nf
+gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \
+ -sPAPERSIZE=letter -r1200x600 -sDEVICE=pbmraw \
+ -sOutputFile=- - < testpage.ps \
+| foo2hbpl2 -r1200x600 -g10200x6600 -p1 >testpage.zm
+.fi
+.RE
+.P
+Create a color ZJS stream:
+
+.RS
+.nf
+gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \
+ -sPAPERSIZE=letter -g10200x6600 -r1200x600 -sDEVICE=bitcmyk \
+ -sOutputFile=- - < testpage.ps \
+| foo2hbpl2 -r1200x600 -g10200x6600 -p1 >testpage.zc
+.fi
+.RE
+
+.SH FILES
+.BR /usr/bin/foo2hbpl2
+.SH SEE ALSO
+.BR foo2hbpl2-wrapper (1),
+.BR hbpldecode (1)
+.SH "AUTHOR"
+Rick Richardson <rick.richardson@comcast.net>
+.br
+Peter Korf <peter@niendo.de>
+.br
+${URLZJS}/
+'/"
+'/"
+'/"
+.em pdf_outline
diff --git a/foo2hbpl2.c b/foo2hbpl2.c
new file mode 100644
index 0000000..d9157b4
--- /dev/null
+++ b/foo2hbpl2.c
@@ -0,0 +1,1693 @@
+/*
+
+GENERAL
+This program converts pbm (B/W) images and 1-bit-per-pixel cmyk images
+(both produced by ghostscript) to Zenographics ZJ-stream format. There
+is some information about the ZJS format at http://ddk.zeno.com.
+
+With this utility, you can print to some Xerox and Dell, such as these:
+ - Xerox WorkCentre 6015 B/W and color
+ - Dell 1355cnw B/W and color
+ - Fuji Xerox DocuPrint CM205 B/W and color
+
+AUTHORS
+This program began life as Robert Szalai's 'pbmtozjs' program. It
+also uses Markus Kuhn's jbig-kit compression library (included, but
+also available at http://www.cl.cam.ac.uk/~mgk25/jbigkit/).
+
+The program was overhauled by Rick Richardson to limit data chunk size
+to 65536 bytes, add command line options, add color support for the
+Minolta/QMS 2300DL, and other miscellaneous features.
+
+You can contact the current author at mailto:rick.richardson@comcast.net
+
+LICENSE
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+If you want to use this program under different license conditions,
+then contact the author for an arrangement.
+
+It is possible that certain products which can be built using the jbig
+software module might form inventions protected by patent rights in
+some countries (e.g., by patents about arithmetic coding algorithms
+owned by IBM and AT&T in the USA). Provision of this software by the
+author does NOT include any licenses for any patents. In those
+countries where a patent license is required for certain applications
+of this software module, you will have to obtain such a license
+yourself.
+
+*/
+
+static char Version[] = "$Id: foo2hbpl2.c,v 1.23 2013/03/03 17:05:03 rick Exp $";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <time.h>
+#ifdef linux
+ #include <sys/utsname.h>
+#endif
+#include "jbig.h"
+#include "hbpl.h"
+
+/*
+ * Command line options
+ */
+int Debug = 0;
+int ResX = 1200;
+int ResY = 600;
+int Bpp = 1;
+int PaperCode = DMPAPER_LETTER;
+int PageWidth = 1200 * 8.5;
+int PageHeight = 600 * 11;
+int UpperLeftX = 0;
+int UpperLeftY = 0;
+int LowerRightX = 0;
+int LowerRightY = 0;
+int Copies = 1;
+int Duplex = DMDUPLEX_OFF;
+int SourceCode = DMBIN_AUTO;
+int MediaCode = DMMEDIA_STANDARD;
+char *Username = NULL;
+char *Filename = NULL;
+int Mode = 1;
+ #define MODE_MONO 1
+ #define MODE_COLOR 2
+int Model = 1;
+ #define MODEL_2300DL 0
+ #define MODEL_HP1020 1
+ #define MODEL_HP_PRO 2
+ #define MODEL_HP_PRO_CP 3
+ #define MODEL_LAST 0
+
+int Color2Mono = 0;
+int BlackClears = 0;
+int AllIsBlack = 0;
+int OutputStartPlane = 1;
+int ExtraPad = 16;
+
+int LogicalOffsetX = 0;
+int LogicalOffsetY = 0;
+
+#define LOGICAL_CLIP_X 2
+#define LOGICAL_CLIP_Y 1
+int LogicalClip = LOGICAL_CLIP_X | LOGICAL_CLIP_Y;
+int SaveToner = 0;
+int PageNum = 0;
+ #define even_page(x) ( ((x) & 1) == 0 )
+ #define odd_page(x) ( ((x) & 1) == 1 )
+int RealWidth;
+int EconoMode = 0;
+int PrintDensity = 3;
+int Dots[4];
+int TotalDots;
+
+int IsCUPS = 0;
+
+FILE *EvenPages = NULL;
+typedef struct
+{
+ off_t b, e;
+} SEEKREC;
+SEEKREC SeekRec[2000];
+int SeekIndex = 0;
+off_t SeekMedia;
+
+long JbgOptions[5] =
+{
+ /* Order */
+ 0,
+ /* Options */
+ JBG_LRLTWO,
+ /* L0 */
+ 128,
+ /* MX */
+ 0, /* 0 is linux driver, 8 is windows driver */
+ /* MY */
+ 0
+};
+
+void
+usage(void)
+{
+ fprintf(stderr,
+"Usage:\n"
+" foo2hbpl2 [options] <pbmraw-file >hbpl-file\n"
+"\n"
+" Convert Ghostscript pbmraw format to a monochrome ZJS stream,\n"
+" for driving the Dell 1153 and Xerox WorkCentre 6015 MFP printers.\n"
+"\n"
+" gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \\ \n"
+" -sPAPERSIZE=letter -r1200x600 -sDEVICE=pbmraw \\ \n"
+" -sOutputFile=- - < testpage.ps \\ \n"
+" | foo2hbpl2 -r1200x600 -g10200x6600 -p1 >testpage.zm\n"
+"\n"
+" foo2hbpl2 [options] <bitcmyk-file >hbpl-file\n"
+" foo2hbpl2 [options] <pksmraw-file >hbpl-file\n"
+"\n"
+" Convert Ghostscript bitcmyk or pksmraw format to a color ZJS stream,\n"
+" for driving Dell 1153 and Xerox WorkCentre 6015 MFP printers.\n"
+" N.B. Color correction is expected to be performed by ghostscript.\n"
+"\n"
+" gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \\ \n"
+" -sPAPERSIZE=letter -g10200x6600 -r1200x600 -sDEVICE=bitcmyk \\ \n"
+" -sOutputFile=- - < testpage.ps \\ \n"
+" | foo2hbpl2 -r1200x600 -g10200x6600 -p1 >testpage.zc\n"
+"\n"
+"Normal Options:\n"
+"-c Force color mode if autodetect doesn't work\n"
+"-d duplex Duplex code to send to printer [%d]\n"
+" 1=off, 2=longedge, 3=shortedge\n"
+" 4=manual longedge, 5=manual shortedge\n"
+"-g <xpix>x<ypix> Set page dimensions in pixels [%dx%d]\n"
+"-m media Media code to send to printer [%d]\n"
+" 1=plain, 2=bond, 3=lwcard, 4=lwgcard, 5=labels,\n"
+" 6=envelope, 7=recycled, 8=plain2, 9=bond2,\n"
+" 10=lwcard2, 11=lwgcard2, 12=recycled2\n"
+"-p paper Paper code to send to printer [%d]\n"
+" 1=A4, 2=B5, 4=letter, 5=executive,\n"
+" 6=fanfoldgermanlegal/folio, 7=legal, 9=env#10,\n"
+" 10=envMonarch, 11=envC5, 12=envDL\n"
+"-n copies Number of copies [%d]\n"
+"-r <xres>x<yres> Set device resolution in pixels/inch [%dx%d]\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"
+"-t Draft mode. Every other pixel is white.\n"
+// "-T density Print density (1-5) [%d].\n"
+"-J filename Filename string to send to printer [%s]\n"
+"-U username Username string to send to printer [%s]\n"
+"\n"
+"Printer Tweaking Options:\n"
+"-u <xoff>x<yoff> Set offset of upper left printable in pixels [%dx%d]\n"
+"-l <xoff>x<yoff> Set offset of lower right printable in pixels [%dx%d]\n"
+"-L mask Send logical clipping values from -u/-l in ZjStream [%d]\n"
+" 0=no, 1=Y, 2=X, 3=XY\n"
+"-A AllIsBlack: convert C=1,M=1,Y=1 to just K=1\n"
+"-B BlackClears: K=1 forces C,M,Y to 0\n"
+" -A, -B work with bitcmyk input only\n"
+"-P Do not output START_PLANE codes. May be needed by some\n"
+" some black and white only printers.\n"
+"-X padlen Add extra zero padding to the end of BID segments [%d]\n"
+// "-z model Model: [%d]\n"
+"\n"
+"Debugging Options:\n"
+"-S plane Output just a single color plane from a color print [all]\n"
+" 1=Cyan, 2=Magenta, 3=Yellow, 4=Black\n"
+"-D lvl Set Debug level [%d]\n"
+"-V Version %s\n"
+ , Duplex
+ , PageWidth , PageHeight
+ , MediaCode
+ , PaperCode
+ , Copies
+ , ResX , ResY
+ , SourceCode
+// , PrintDensity
+ , Filename ? Filename : ""
+ , Username ? Username : ""
+ , UpperLeftX , UpperLeftY
+ , LowerRightX , LowerRightY
+ , LogicalClip
+ , ExtraPad
+// , Model
+ , Debug
+ , Version
+ );
+
+ exit(1);
+}
+
+/*
+ * Mirror1: bits 01234567 become 76543210
+ */
+unsigned char Mirror1[256] =
+{
+ 0,128, 64,192, 32,160, 96,224, 16,144, 80,208, 48,176,112,240,
+ 8,136, 72,200, 40,168,104,232, 24,152, 88,216, 56,184,120,248,
+ 4,132, 68,196, 36,164,100,228, 20,148, 84,212, 52,180,116,244,
+ 12,140, 76,204, 44,172,108,236, 28,156, 92,220, 60,188,124,252,
+ 2,130, 66,194, 34,162, 98,226, 18,146, 82,210, 50,178,114,242,
+ 10,138, 74,202, 42,170,106,234, 26,154, 90,218, 58,186,122,250,
+ 6,134, 70,198, 38,166,102,230, 22,150, 86,214, 54,182,118,246,
+ 14,142, 78,206, 46,174,110,238, 30,158, 94,222, 62,190,126,254,
+ 1,129, 65,193, 33,161, 97,225, 17,145, 81,209, 49,177,113,241,
+ 9,137, 73,201, 41,169,105,233, 25,153, 89,217, 57,185,121,249,
+ 5,133, 69,197, 37,165,101,229, 21,149, 85,213, 53,181,117,245,
+ 13,141, 77,205, 45,173,109,237, 29,157, 93,221, 61,189,125,253,
+ 3,131, 67,195, 35,163, 99,227, 19,147, 83,211, 51,179,115,243,
+ 11,139, 75,203, 43,171,107,235, 27,155, 91,219, 59,187,123,251,
+ 7,135, 71,199, 39,167,103,231, 23,151, 87,215, 55,183,119,247,
+ 15,143, 79,207, 47,175,111,239, 31,159, 95,223, 63,191,127,255,
+};
+
+/*
+ * Mirror2: bits 01234567 become 67452301
+ */
+unsigned char Mirror2[256] =
+{
+ 0, 64,128,192, 16, 80,144,208, 32, 96,160,224, 48,112,176,240,
+ 4, 68,132,196, 20, 84,148,212, 36,100,164,228, 52,116,180,244,
+ 8, 72,136,200, 24, 88,152,216, 40,104,168,232, 56,120,184,248,
+ 12, 76,140,204, 28, 92,156,220, 44,108,172,236, 60,124,188,252,
+ 1, 65,129,193, 17, 81,145,209, 33, 97,161,225, 49,113,177,241,
+ 5, 69,133,197, 21, 85,149,213, 37,101,165,229, 53,117,181,245,
+ 9, 73,137,201, 25, 89,153,217, 41,105,169,233, 57,121,185,249,
+ 13, 77,141,205, 29, 93,157,221, 45,109,173,237, 61,125,189,253,
+ 2, 66,130,194, 18, 82,146,210, 34, 98,162,226, 50,114,178,242,
+ 6, 70,134,198, 22, 86,150,214, 38,102,166,230, 54,118,182,246,
+ 10, 74,138,202, 26, 90,154,218, 42,106,170,234, 58,122,186,250,
+ 14, 78,142,206, 30, 94,158,222, 46,110,174,238, 62,126,190,254,
+ 3, 67,131,195, 19, 83,147,211, 35, 99,163,227, 51,115,179,243,
+ 7, 71,135,199, 23, 87,151,215, 39,103,167,231, 55,119,183,247,
+ 11, 75,139,203, 27, 91,155,219, 43,107,171,235, 59,123,187,251,
+ 15, 79,143,207, 31, 95,159,223, 47,111,175,239, 63,127,191,255,
+};
+
+/*
+ * Mirror4: bits 01234567 become 45670123
+ */
+unsigned char Mirror4[256] =
+{
+ 0, 16, 32, 48, 64, 80, 96,112,128,144,160,176,192,208,224,240,
+ 1, 17, 33, 49, 65, 81, 97,113,129,145,161,177,193,209,225,241,
+ 2, 18, 34, 50, 66, 82, 98,114,130,146,162,178,194,210,226,242,
+ 3, 19, 35, 51, 67, 83, 99,115,131,147,163,179,195,211,227,243,
+ 4, 20, 36, 52, 68, 84,100,116,132,148,164,180,196,212,228,244,
+ 5, 21, 37, 53, 69, 85,101,117,133,149,165,181,197,213,229,245,
+ 6, 22, 38, 54, 70, 86,102,118,134,150,166,182,198,214,230,246,
+ 7, 23, 39, 55, 71, 87,103,119,135,151,167,183,199,215,231,247,
+ 8, 24, 40, 56, 72, 88,104,120,136,152,168,184,200,216,232,248,
+ 9, 25, 41, 57, 73, 89,105,121,137,153,169,185,201,217,233,249,
+ 10, 26, 42, 58, 74, 90,106,122,138,154,170,186,202,218,234,250,
+ 11, 27, 43, 59, 75, 91,107,123,139,155,171,187,203,219,235,251,
+ 12, 28, 44, 60, 76, 92,108,124,140,156,172,188,204,220,236,252,
+ 13, 29, 45, 61, 77, 93,109,125,141,157,173,189,205,221,237,253,
+ 14, 30, 46, 62, 78, 94,110,126,142,158,174,190,206,222,238,254,
+ 15, 31, 47, 63, 79, 95,111,127,143,159,175,191,207,223,239,255,
+};
+
+int BlackOnes[256] =
+{
+ 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
+};
+
+void
+rotate_bytes_180(unsigned char *sp, unsigned char *ep, unsigned char *mirror)
+{
+ unsigned char tmp;
+
+ while (sp < ep)
+ {
+ tmp = mirror[*sp];
+ *sp = mirror[*ep];
+ *ep = tmp;
+ ++sp;
+ --ep;
+ }
+ if (sp == ep)
+ *sp = mirror[*sp];
+}
+
+void
+debug(int level, char *fmt, ...)
+{
+ va_list ap;
+
+ if (Debug < level)
+ return;
+
+ setvbuf(stderr, (char *) NULL, _IOLBF, BUFSIZ);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+}
+
+void
+error(int fatal, char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ if (fatal)
+ exit(fatal);
+}
+
+/*
+ * A linked list of compressed data
+ */
+typedef struct _BIE_CHAIN{
+ unsigned char *data;
+ size_t len;
+ struct _BIE_CHAIN *next;
+} BIE_CHAIN;
+
+void
+free_chain(BIE_CHAIN *chain)
+{
+ BIE_CHAIN *next;
+ next = chain;
+ while ((chain = next))
+ {
+ next = chain->next;
+ if (chain->data)
+ free(chain->data);
+ free(chain);
+ }
+}
+
+int
+size_chain(BIE_CHAIN *chain)
+{
+ BIE_CHAIN *next;
+ int size = 0;
+
+ next = chain;
+ while ((chain = next))
+ {
+ next = chain->next;
+ if (chain->data)
+ size = size + chain->len;
+ }
+ return (size);
+}
+
+int
+write_plane(int planeNum, BIE_CHAIN **root, FILE *fp)
+{
+ BIE_CHAIN *current = *root;
+ // BIE_CHAIN *next;
+
+ debug(3, "Write Plane %d\n", planeNum);
+
+ /* error handling */
+ if (!current)
+ error(1,"There is no JBIG!\n");
+ if (!current->next)
+ error(1,"There is no or wrong JBIG header!\n");
+ if (current->len != 20)
+ error(1,"wrong BIH length\n");
+
+ for (current = *root; current && current->len; current = current->next)
+ {
+ fwrite(current->data, 1, current->len, fp);
+ }
+
+ free_chain(*root);
+
+ return 0;
+}
+
+void
+start_page(BIE_CHAIN **root, BIE_CHAIN **root2,
+ BIE_CHAIN **root3, BIE_CHAIN **root4, int nbie, FILE *ofp)
+{
+ BIE_CHAIN *current = *root;
+ unsigned long w, h;
+ static int pageno = 0;
+ // int nitems;
+ HBPL_PS ps;
+ int i;
+
+ /* error handling */
+ if (!current)
+ error(1, "There is no JBIG!\n");
+ if (!current->next)
+ error(1, "There is no or wrong JBIG header!\n");
+ if (current->len != 20 )
+ error(1,"wrong BIH length\n");
+
+ /*
+ * Don't know what this done, if anything...
+ */
+ if ((PageNum % 4) == 0) // after 3 pages...
+ {
+ HBPL_DM dm;
+
+ dm.hdr.type[0] = 033;
+ dm.hdr.type[1] = 'D';
+ dm.hdr.type[2] = 'M';
+ dm.data = 0;
+ dm.hdr.len = le32(sizeof(dm) - 4);
+ fwrite(&dm, 1, sizeof(dm), ofp);
+ }
+
+
+ /* startpage, jbig_bih, jbig_bid, jbig_end, endpage */
+ w = (((long) current->data[ 4] << 24)
+ | ((long) current->data[ 5] << 16)
+ | ((long) current->data[ 6] << 8)
+ | (long) current->data[ 7]);
+ h = (((long) current->data[ 8] << 24)
+ | ((long) current->data[ 9] << 16)
+ | ((long) current->data[10] << 8)
+ | (long) current->data[11]);
+ TotalDots = w*h;
+ debug(9, "start_page: w x h = %d x %d\n", w, h);
+
+ memset(&ps, 0, sizeof(ps));
+ ps.hdr.type[0] = 033;
+ ps.hdr.type[1] = 'P';
+ ps.hdr.type[2] = 'S';
+ ps.hdr.len = le32(sizeof(ps) - 4);
+ ps.w = le32(w / Bpp);
+ ps.h = le32(h);
+ ps.color = root2 ? 1 : 0;
+ if (ps.color)
+ ps.wh_total = le32( (w * h) / 2); // In bytes
+ else
+ ps.wh_total = le32( (w * h) / 8); // In bytes
+ ps.papersize = PaperCode;
+ ps.mediatype = MediaCode;
+ ps.unk2 = 0; // TODO
+ ps.res = le16(ResY);
+ if (ps.color == 0)
+ {
+ int size;
+
+ size = size_chain(*root);
+ ps.len = le32(size);
+ ps.bihoff[0] = le32(0);
+ ps.bihoff[1] = le32(0);
+ ps.bihoff[2] = le32(0);
+ ps.bihoff[3] = le32(size);
+ }
+ else
+ {
+ int size1, size2, size3, size4;
+
+ size1 = size_chain(*root);
+ size2 = root2 ? size_chain(*root2) : 0;
+ size3 = root3 ? size_chain(*root3) : 0;
+ size4 = root4 ? size_chain(*root4) : 0;
+ ps.len = le32(size1+size2+size3+size4);
+ ps.bihoff[0] = le32(size1);
+ ps.bihoff[1] = le32(size2);
+ ps.bihoff[2] = le32(size3);
+ ps.bihoff[3] = le32(size4);
+ }
+ ps.unk3 = le16(0x0); // TODO
+ for (i = 0; i < 5; ++i)
+ ps.unk4[i] = le32(0x0); // TODO
+ fwrite(&ps, 1, sizeof(ps), ofp);
+
+ ++pageno;
+ if (IsCUPS)
+ fprintf(stderr, "PAGE: %d %d\n", pageno, Copies);
+}
+
+void
+end_page(FILE *ofp)
+{
+ HBPL_PE pe;
+
+ memset(&pe, 0, sizeof(pe));
+ pe.hdr.type[0] = 033;
+ pe.hdr.type[1] = 'P';
+ pe.hdr.type[2] = 'E';
+ pe.hdr.len = le32(sizeof(pe) - 4);
+ fwrite(&pe, 1, sizeof(pe), ofp);
+}
+
+int
+write_page(BIE_CHAIN **root, BIE_CHAIN **root2,
+ BIE_CHAIN **root3, BIE_CHAIN **root4, FILE *ofp)
+{
+ int nbie = root2 ? 4 : 1;
+
+ start_page(root, root2, root3, root4, nbie, ofp);
+
+ if (root)
+ {
+ if (OutputStartPlane)
+ write_plane(nbie == 1 ? 4 : 1, root, ofp);
+ else
+ write_plane(nbie == 1 ? 0 : 1, root, ofp);
+ }
+ if (root2)
+ write_plane(2, root2, ofp);
+ if (root3)
+ write_plane(3, root3, ofp);
+ if (root4)
+ write_plane(4, root4, ofp);
+
+ end_page(ofp);
+ return 0;
+}
+
+/*
+ * This creates a linked list of compressed data. The first item
+ * in the list is the BIH and is always 20 bytes in size. Each following
+ * item is 65536 bytes in length. The last item length is whatever remains.
+ */
+void
+output_jbig(unsigned char *start, size_t len, void *cbarg)
+{
+ BIE_CHAIN *current, **root = (BIE_CHAIN **) cbarg;
+ int size = 65536; // Printer does strange things otherwise.
+
+ if ( (*root) == NULL)
+ {
+ (*root) = malloc(sizeof(BIE_CHAIN));
+ if (!(*root))
+ error(1, "Can't allocate space for chain\n");
+
+ (*root)->data = NULL;
+ (*root)->next = NULL;
+ (*root)->len = 0;
+ size = 20;
+ if (len != 20)
+ error(1, "First chunk must be BIH and 20 bytes long\n");
+ }
+
+ current = *root;
+ while (current->next)
+ current = current->next;
+
+ while (len > 0)
+ {
+ int amt, left;
+
+ if (!current->data)
+ {
+ current->data = malloc(size);
+ if (!current->data)
+ error(1, "Can't allocate space for compressed data\n");
+ }
+
+ left = size - current->len;
+ amt = (len > left) ? left : len;
+ memcpy(current->data + current->len, start, amt);
+ current->len += amt;
+ len -= amt;
+ start += amt;
+
+ if (current->len == size)
+ {
+ current->next = malloc(sizeof(BIE_CHAIN));
+ if (!current->next)
+ error(1, "Can't allocate space for chain\n");
+ current = current->next;
+ current->data = NULL;
+ current->next = NULL;
+ current->len = 0;
+ }
+ }
+}
+
+void
+start_doc(FILE *fp)
+{
+ HBPL_JP jp;
+
+ fprintf(fp, "\033%%-12345X@PJL JOB NAME=PRINTER\r\n");
+ #ifdef linux
+ {
+ struct utsname u;
+
+ uname(&u);
+ fprintf(fp, "@PJL JOBATTR=\"HOST:%s\"\r\n", u.nodename);
+ }
+ #endif
+ fprintf(fp, "@PJL SET JOBATTR=\"USER:%s\"\r\n", Username ? Username : "");
+ fprintf(fp, "@PJL SET JOBATTR=\"DOCU:%s\"\r\n", Filename ? Filename : "");
+ fprintf(fp, "@PJL SET JOBATTR=\"OWNR:%s\"\r\n", Username ? Username : "");
+ fprintf(fp, "@PJL SET DUPLEX=OFF\r\n");
+ fprintf(fp, "@PJL SET IWAMANUALDUP=OFF\r\n");
+ fprintf(fp, "@PJL SET MEDIASOURCE=0\r\n");
+ fprintf(fp, "@PJL SET RENDERMODE=%s\r\n",
+ Mode == MODE_COLOR ? "COLOR" : "GRAYSCALE");
+ fprintf(fp, "@PJL SET RESOLUTION=600\r\n");
+ fprintf(fp, "@PJL SET BITSPERPIXEL=%d\r\n", Bpp);
+ fprintf(fp, "@PJL SET COPIES=%d\r\n", Copies);
+ fprintf(fp, "@PJL ENTER LANGUAGE=HBPL\r\n");
+
+ memset(&jp, 0, sizeof(jp));
+ jp.hdr.type[0] = 033;
+ jp.hdr.type[1] = 'J';
+ jp.hdr.type[2] = 'P';
+ jp.hdr.len = le32(sizeof(jp) - 4);
+ jp.unk1 = le32(0x01000001);
+ jp.source_size = 0; // TODO
+ fwrite(&jp, 1, sizeof(jp), fp);
+}
+
+void
+end_doc(FILE *fp)
+{
+ fprintf(fp, "\033%%-12345X@PJL EOJ\r\n");
+}
+
+void
+load_tray2(FILE *fp)
+{
+ // int nitems;
+
+ // nitems = 0;
+ // chunk_write(ZJT_2600N_PAUSE, nitems, nitems * sizeof(ZJ_ITEM_UINT32), fp);
+}
+
+int
+compute_image_dots(int w, int h, unsigned char *bitmap)
+{
+ int dots = 0;
+ int x, y, bpl;
+
+ switch (Model)
+ {
+ case MODEL_HP_PRO_CP:
+ bpl = (w + 7) / 8;
+ for (y = 0; y < h; ++y)
+ for (x = 0; x < bpl; ++x)
+ dots += BlackOnes[ bitmap[y*bpl + x] ];
+ return dots;
+ default:
+ return 0;
+ }
+}
+
+static int AnyColor;
+
+void
+cmyk_planes(unsigned char *plane[4], unsigned char *raw, int w, int h)
+{
+ int rawbpl = (w+1) / 2;
+ int bpl = (w + 7) / 8;
+ int i;
+ int x, y;
+ unsigned char byte;
+ unsigned char mask[8] = { 128, 64, 32, 16, 8, 4, 2, 1 };
+ int aib = AllIsBlack;
+ int bc = BlackClears;
+
+ if (Model != MODEL_2300DL)
+ bpl = (bpl + 15) & ~15;
+ debug(1, "w=%d, bpl=%d, rawbpl=%d\n", w, bpl, rawbpl);
+
+ AnyColor = 0;
+ for (i = 0; i < 4; ++i)
+ memset(plane[i], 0, bpl * h);
+
+ //
+ // Unpack the combined plane into individual color planes
+ //
+ // TODO: this can be speeded up using a 256 or 65536 entry lookup table
+ //
+ for (y = 0; y < h; ++y)
+ {
+ for (x = 0; x < w; ++x)
+ {
+ byte = raw[y*rawbpl + x/2];
+
+ if (aib && (byte & 0xE0) == 0xE0)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ }
+ else if (byte & 0x10)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ if (!bc)
+ {
+ if (byte & 0x80) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x40) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x20) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE0) AnyColor |= byte;
+ }
+ }
+ else
+ {
+ if (byte & 0x80) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x40) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x20) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE0) AnyColor |= byte;
+ }
+
+ ++x;
+ if (aib && (byte & 0x0E) == 0x0E)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ }
+ else if (byte & 0x1)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ if (!bc)
+ {
+ if (byte & 0x8) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x4) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x2) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE) AnyColor |= byte;
+ }
+ }
+ else
+ {
+ if (byte & 0x8) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x4) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x2) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE) AnyColor |= byte;
+ }
+ }
+ }
+ debug(2, "BlackClears = %d; AnyColor = %s %s %s\n",
+ BlackClears,
+ (AnyColor & 0x88) ? "Cyan" : "",
+ (AnyColor & 0x44) ? "Magenta" : "",
+ (AnyColor & 0x22) ? "Yellow" : ""
+ );
+}
+
+int
+cmyk_page(unsigned char *raw, int w, int h, FILE *ofp)
+{
+ BIE_CHAIN *chain[4];
+ int i;
+ int bpl, bpl16;
+ unsigned char *plane[4], *bitmaps[4][1];
+ struct jbg_enc_state se[4];
+
+ RealWidth = w;
+ if (1 || Model == MODEL_HP1020
+ || Model == MODEL_HP_PRO || Model == MODEL_HP_PRO_CP)
+ {
+ w = (w + 127) & ~127;
+ bpl = (w + 7) / 8;
+ bpl16 = (bpl + 15) & ~15;
+ }
+ else
+ {
+ bpl = (w + 7) / 8;
+ bpl16 = bpl;
+ }
+ debug(1, "w = %d, bpl = %d, bpl16 = %d\n", w, bpl, bpl16);
+
+ for (i = 0; i < 4; ++i)
+ {
+ plane[i] = malloc(bpl16 * h);
+ if (!plane[i]) error(3, "Cannot allocate space for bit plane\n");
+ chain[i] = NULL;
+ }
+
+ cmyk_planes(plane, raw, RealWidth, h);
+ for (i = 0; i < 4; ++i)
+ {
+ if (Debug >= 9)
+ {
+ FILE *dfp;
+ char fname[256];
+
+ sprintf(fname, "xxxplane%d", i);
+ dfp = fopen(fname, "w");
+ if (dfp)
+ {
+ fwrite(plane[i], bpl*h, 1, dfp);
+ fclose(dfp);
+ }
+ }
+
+ Dots[i] = compute_image_dots(w, h, plane[i]);
+
+ *bitmaps[i] = plane[i];
+
+ jbg_enc_init(&se[i], w, h, 1, bitmaps[i], output_jbig, &chain[i]);
+ jbg_enc_options(&se[i], JbgOptions[0], JbgOptions[1],
+ JbgOptions[2], JbgOptions[3], JbgOptions[4]);
+ jbg_enc_out(&se[i]);
+ jbg_enc_free(&se[i]);
+ }
+
+ if (Color2Mono)
+ write_page(&chain[Color2Mono-1], NULL, NULL, NULL, ofp);
+ else if (AnyColor)
+ // Pages are: Y, M, C, K
+ write_page(&chain[2], &chain[1], &chain[0], &chain[3], ofp);
+ else
+ write_page(&chain[3], NULL, NULL, NULL, ofp);
+
+ for (i = 0; i < 4; ++i)
+ free(plane[i]);
+ return 0;
+}
+
+int
+pksm_page(unsigned char *plane[4], int w, int h, FILE *ofp)
+{
+ BIE_CHAIN *chain[4];
+ int i;
+ unsigned char *bitmaps[4][1];
+ struct jbg_enc_state se[4];
+
+ RealWidth = w;
+ if (1 || Model == MODEL_HP1020
+ || Model == MODEL_HP_PRO || Model == MODEL_HP_PRO_CP)
+ w = (w + 127) & ~127;
+
+ for (i = 0; i < 4; ++i)
+ chain[i] = NULL;
+
+ for (i = 0; i < 4; ++i)
+ {
+ Dots[i] = compute_image_dots(w, h, plane[i]);
+
+ *bitmaps[i] = plane[i];
+
+ jbg_enc_init(&se[i], w, h, 1, bitmaps[i], output_jbig, &chain[i]);
+ jbg_enc_options(&se[i], JbgOptions[0], JbgOptions[1],
+ JbgOptions[2], JbgOptions[3], JbgOptions[4]);
+ jbg_enc_out(&se[i]);
+ jbg_enc_free(&se[i]);
+ }
+
+ if (Color2Mono)
+ write_page(&chain[Color2Mono-1], NULL, NULL, NULL, ofp);
+ else if (AnyColor)
+ // Pages are: Y, M, C, K
+ write_page(&chain[2], &chain[1], &chain[0], &chain[3], ofp);
+ else
+ write_page(&chain[3], NULL, NULL, NULL, ofp);
+
+ return 0;
+}
+
+int
+pbm_page(unsigned char *buf, int w, int h, FILE *ofp)
+{
+ BIE_CHAIN *chain = NULL;
+ unsigned char *bitmaps[1];
+ struct jbg_enc_state se;
+
+ RealWidth = w;
+ if (1 || Model == MODEL_HP1020
+ || Model == MODEL_HP_PRO || Model == MODEL_HP_PRO_CP)
+ w = (w + 127) & ~127;
+
+ if (SaveToner)
+ {
+ int x, y;
+ int bpl, bpl16;
+
+ bpl = (w + 7) / 8;
+ if (Model == MODEL_2300DL)
+ bpl16 = bpl;
+ else
+ bpl16 = (bpl + 15) & ~15;
+
+ for (y = 0; y < h; y += 2)
+ for (x = 0; x < bpl16; ++x)
+ buf[y*bpl16 + x] &= 0x55;
+ for (y = 1; y < h; y += 2)
+ for (x = 0; x < bpl16; ++x)
+ buf[y*bpl16 + x] &= 0xaa;
+ }
+
+ if (Model == MODEL_HP_PRO || Model == MODEL_HP_PRO_CP)
+ {
+ int x, y;
+ int bpl, bpl16;
+
+ /*
+ * Blank initial lines for .25"
+ */
+ bpl = (w + 7) / 8;
+ bpl16 = (bpl + 15) & ~15;
+
+ if (0)
+ for (y = 0; y < 150; ++y)
+ memset(buf + y*bpl16, 0, bpl16);
+
+ if (0)
+ for (y = 0; y < h; y += 1)
+ {
+ for (x = 0; x < 32; ++x)
+ buf[y*bpl16 + x] = 0;
+ for (x = bpl16 - 32; x < bpl16; ++x)
+ buf[y*bpl16 + x] = 0;
+ }
+ if (0)
+ for (y = h - 200; y < h; y += 1)
+ memset(buf + y*bpl16, 0, bpl16);
+ }
+
+ Dots[3] = compute_image_dots(w, h, buf);
+
+ *bitmaps = buf;
+
+ debug(9, "w x h = %d x %d\n", w, h);
+ jbg_enc_init(&se, w, h, 1, bitmaps, output_jbig, &chain);
+ jbg_enc_options(&se, JbgOptions[0], JbgOptions[1],
+ JbgOptions[2], JbgOptions[3], JbgOptions[4]);
+ jbg_enc_out(&se);
+ jbg_enc_free(&se);
+
+ write_page(&chain, NULL, NULL, NULL, ofp);
+
+ return 0;
+}
+
+int
+read_and_clip_image(unsigned char *buf,
+ int rawBpl, int rightBpl, int pixelsPerByte,
+ int bpl, int h, int bpl16, FILE *ifp)
+{
+ unsigned char *rowbuf, *rowp;
+ int y;
+ int rc;
+
+ rowbuf = malloc(rawBpl);
+ if (!rowbuf)
+ error(1, "Can't allocate row buffer\n");
+
+ // Clip top rows
+ if (UpperLeftY)
+ {
+ for (y = 0; y < UpperLeftY; ++y)
+ {
+ rc = fread(rowbuf, rawBpl, 1, ifp);
+ if (rc == 0)
+ goto eof;
+ if (rc != 1)
+ error(1, "Premature EOF(1) on input at y=%d\n", y);
+ }
+ }
+
+ // Copy the rows that we want to image
+ rowp = buf;
+ for (y = 0; y < h; ++y, rowp += bpl16)
+ {
+ // Clip left pixel *bytes*
+ if (UpperLeftX)
+ {
+ rc = fread(rowbuf, UpperLeftX / pixelsPerByte, 1, ifp);
+ if (rc == 0 && y == 0 && !UpperLeftY)
+ goto eof;
+ if (rc != 1)
+ error(1, "Premature EOF(2) on input at y=%d\n", y);
+ }
+
+ if (bpl != bpl16)
+ memset(rowp, 0, bpl16);
+ rc = fread(rowp, bpl, 1, ifp);
+ if (rc == 0 && y == 0 && !UpperLeftY && !UpperLeftX)
+ goto eof;
+ if (rc != 1)
+ error(1, "Premature EOF(3) on input at y=%d\n", y);
+
+ // Clip right pixels
+ if (rightBpl != bpl)
+ {
+ rc = fread(rowbuf, rightBpl - bpl, 1, ifp);
+ if (rc != 1)
+ error(1, "Premature EOF(4) on input at y=%d\n", y);
+ }
+ }
+
+ // Clip bottom rows
+ if (LowerRightY)
+ {
+ for (y = 0; y < LowerRightY; ++y)
+ {
+ rc = fread(rowbuf, rawBpl, 1, ifp);
+ if (rc != 1)
+ error(1, "Premature EOF(5) on input at y=%d\n", y);
+ }
+ }
+
+ free(rowbuf);
+ return (0);
+
+eof:
+ free(rowbuf);
+ return (EOF);
+}
+
+int
+cmyk_pages(FILE *ifp, FILE *ofp)
+{
+ unsigned char *buf;
+ int rawW, rawH, rawBpl;
+ int rightBpl;
+ int w, h, bpl;
+ int rc;
+
+ //
+ // Save the original Upper Right clip values as the logical offset,
+ // because we may adjust them slightly below, in the interest of speed.
+ //
+ if (LogicalClip & LOGICAL_CLIP_X)
+ LogicalOffsetX = UpperLeftX;
+ if (LogicalClip & LOGICAL_CLIP_Y)
+ LogicalOffsetY = UpperLeftY;
+
+ rawW = PageWidth;
+ rawH = PageHeight;
+ rawBpl = (PageWidth + 1) / 2;
+
+ // We only clip multiples of 2 pixels off the leading edge, and
+ // add any remainder to the amount we clip from the right edge.
+ // Its fast, and good enough for government work.
+ LowerRightX += UpperLeftX & 1;
+ UpperLeftX &= ~1;
+
+ w = rawW - UpperLeftX - LowerRightX;
+ h = rawH - UpperLeftY - LowerRightY;
+ bpl = (w + 1) / 2;
+ rightBpl = (rawW - UpperLeftX + 1) / 2;
+
+ buf = malloc(bpl * h);
+ if (!buf)
+ error(1, "Unable to allocate page buffer of %d x %d = %d bytes\n",
+ rawW, rawH, rawBpl * rawH);
+
+ for (;;)
+ {
+ rc = read_and_clip_image(buf, rawBpl, rightBpl, 2, bpl, h, bpl, ifp);
+ if (rc == EOF)
+ goto done;
+
+ ++PageNum;
+ if (Duplex == DMDUPLEX_LONGEDGE && even_page(PageNum))
+ rotate_bytes_180(buf, buf + bpl * h - 1, Mirror4);
+ if (Duplex == DMDUPLEX_MANUALLONG && even_page(PageNum))
+ rotate_bytes_180(buf, buf + bpl * h - 1, Mirror4);
+
+ if (even_page(PageNum) && EvenPages)
+ {
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ cmyk_page(buf, w, h, EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "CMYK Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+ else
+ cmyk_page(buf, w, h, ofp);
+ }
+
+done:
+ free(buf);
+ return 0;
+}
+
+static unsigned long
+getint(FILE *fp)
+{
+ int c;
+ unsigned long i = 0;
+ int rc;
+
+ while ((c = getc(fp)) != EOF && !isdigit(c))
+ if (c == '#')
+ while ((c = getc(fp)) != EOF && !(c == 13 || c == 10)) ;
+ if (c != EOF)
+ {
+ ungetc(c, fp);
+ rc = fscanf(fp, "%lu", &i);
+ if (rc != 1) error(1, "fscanf: rc == 0!\n");
+ }
+ return i;
+}
+
+static void
+skip_to_nl(FILE *fp)
+{
+ for (;;)
+ {
+ int c;
+ c = getc(fp);
+ if (c == EOF)
+ error(1, "Premature EOF on input stream\n");
+ if (c == '\n')
+ return;
+ }
+}
+
+int
+pbm_header(FILE *ifp, int *p4eatenp, int *wp, int *hp)
+{
+ int c1, c2;
+
+ if (*p4eatenp)
+ *p4eatenp = 0; // P4 already eaten in main
+ else
+ {
+ c1 = getc(ifp);
+ if (c1 == EOF)
+ return 0;
+ c2 = getc(ifp);
+ if (c1 != 'P' || c2 != '4')
+ error(1, "Not a pbmraw data stream\n");
+ }
+
+ skip_to_nl(ifp);
+
+ *wp = getint(ifp);
+ *hp = getint(ifp);
+ skip_to_nl(ifp);
+ return 1;
+}
+
+int
+pksm_pages(FILE *ifp, FILE *ofp)
+{
+ unsigned char *plane[4];
+ int rawW, rawH, rawBpl;
+ int saveW = 0, saveH = 0;
+ int rightBpl;
+ int w, h, bpl;
+ int bpl16;
+ int i;
+ int rc;
+ int p4eaten = 1;
+
+ //
+ // Save the original Upper Right clip values as the logical offset,
+ // because we may adjust them slightly below, in the interest of speed.
+ //
+ if (LogicalClip & LOGICAL_CLIP_X)
+ LogicalOffsetX = UpperLeftX;
+ if (LogicalClip & LOGICAL_CLIP_Y)
+ LogicalOffsetY = UpperLeftY;
+
+ for (;;)
+ {
+ ++PageNum;
+ AnyColor = 0;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if (pbm_header(ifp, &p4eaten, &rawW, &rawH) == 0)
+ {
+ if (i == 0)
+ goto eof;
+ else
+ error(1, "Premature EOF(pksm) on page %d hdr, plane %d\n",
+ PageNum, i);
+ }
+ if (i == 0)
+ {
+ saveW = rawW;
+ saveH = rawH;
+ }
+ if (saveW != rawW)
+ error(1, "Image width changed from %d to %d on plane %d\n",
+ saveW, rawW, i);
+ if (saveH != rawH)
+ error(1, "Image height changed from %d to %d on plane %d\n",
+ saveH, rawH, i);
+
+ rawBpl = (rawW + 7) / 8;
+
+ // We only clip multiples of 8 pixels off the leading edge, and
+ // add any remainder to the amount we clip from the right edge.
+ // Its fast, and good enough for government work.
+ LowerRightX += UpperLeftX & 7;
+ UpperLeftX &= ~7;
+
+ w = rawW - UpperLeftX - LowerRightX;
+ h = rawH - UpperLeftY - LowerRightY;
+ bpl = (w + 7) / 8;
+ rightBpl = (rawW - UpperLeftX + 7) / 8;
+
+ if (Model == MODEL_HP1020
+ || Model == MODEL_HP_PRO || Model == MODEL_HP_PRO_CP)
+ bpl16 = (bpl + 15) & ~15;
+ else
+ bpl16 = bpl;
+ debug(1, "bpl=%d bpl16=%d\n", bpl, bpl16);
+
+ plane[i] = malloc(bpl16 * h);
+ if (!plane[i])
+ error(1, "Can't allocate plane buffer\n");
+
+ rc = read_and_clip_image(plane[i],
+ rawBpl, rightBpl, 8, bpl, h, bpl16, ifp);
+ if (rc == EOF)
+ error(1, "Premature EOF(pksm) on page %d data, plane %d\n",
+ PageNum, i);
+
+ if (Debug >= 9)
+ {
+ FILE *dfp;
+ char fname[256];
+ sprintf(fname, "xxxplane%d", i);
+ dfp = fopen(fname, "w");
+ if (dfp)
+ {
+ rc = fwrite(plane[i], bpl*h, 1, dfp);
+ fclose(dfp);
+ }
+ }
+
+ // See if we can optimize this to be a monochrome page
+ if (!AnyColor && i != 3)
+ {
+ unsigned char *p, *e;
+
+ for (p = plane[i], e = p + bpl16*h; p < e; ++p)
+ if (*p)
+ {
+ AnyColor |= 1<<i;
+ break;
+ }
+ }
+
+ if (Duplex == DMDUPLEX_LONGEDGE && even_page(PageNum))
+ rotate_bytes_180(plane[i], plane[i] + bpl * h - 1, Mirror1);
+ if (Duplex == DMDUPLEX_MANUALLONG && even_page(PageNum))
+ rotate_bytes_180(plane[i], plane[i] + bpl * h - 1, Mirror1);
+ }
+
+ debug(2, "AnyColor = %s %s %s\n",
+ (AnyColor & 0x01) ? "Cyan" : "",
+ (AnyColor & 0x02) ? "Magenta" : "",
+ (AnyColor & 0x04) ? "Yellow" : ""
+ );
+
+ if (even_page(PageNum) && EvenPages)
+ {
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ pksm_page(plane, w, h, EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "PKSM Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+ else
+ pksm_page(plane, w, h, ofp);
+
+ for (i = 0; i < 4; ++i)
+ free(plane[i]);
+ }
+eof:
+ return (0);
+}
+
+void
+blank_page(FILE *ofp)
+{
+ int w, h, bpl, bpl16 = 0;
+ unsigned char *plane;
+
+ w = PageWidth - UpperLeftX - LowerRightX;
+ h = PageHeight - UpperLeftY - LowerRightY;
+ bpl = (w + 7) / 8;
+ switch (Model)
+ {
+ case MODEL_2300DL: bpl16 = bpl; break;
+ case MODEL_HP1020: bpl16 = (bpl + 15) & ~15; break;
+ case MODEL_HP_PRO: bpl16 = (bpl + 15) & ~15; break;
+ case MODEL_HP_PRO_CP: bpl16 = (bpl + 15) & ~15; break;
+ default: error(1, "Bad model %d\n", Model); break;
+ }
+
+ plane = malloc(bpl16 * h);
+ if (!plane)
+ error(1, "Unable to allocate blank plane (%d bytes)\n", bpl16*h);
+ memset(plane, 0, bpl16*h);
+
+ pbm_page(plane, w, h, ofp);
+ ++PageNum;
+ free(plane);
+}
+
+int
+pbm_pages(FILE *ifp, FILE *ofp)
+{
+ unsigned char *buf;
+ int rawW, rawH, rawBpl;
+ int rightBpl;
+ int w, h, bpl;
+ int bpl16 = 0;
+ int rc;
+ int p4eaten = 1;
+ FILE *tfp = NULL;
+ long tpos = 0;
+
+ //
+ // Save the original Upper Right clip values as the logical offset,
+ // because we may adjust them slightly below, in the interest of speed.
+ //
+ if (LogicalClip & LOGICAL_CLIP_X)
+ LogicalOffsetX = UpperLeftX;
+ if (LogicalClip & LOGICAL_CLIP_Y)
+ LogicalOffsetY = UpperLeftY;
+
+ for (;;)
+ {
+ if (pbm_header(ifp, &p4eaten, &rawW, &rawH) == 0)
+ break;
+
+ rawBpl = (rawW + 7) / 8;
+
+ // We only clip multiples of 8 pixels off the leading edge, and
+ // add any remainder to the amount we clip from the right edge.
+ // Its fast, and good enough for government work.
+ LowerRightX += UpperLeftX & 7;
+ UpperLeftX &= ~7;
+
+ w = rawW - UpperLeftX - LowerRightX;
+ h = rawH - UpperLeftY - LowerRightY;
+ bpl = (w + 7) / 8;
+ rightBpl = (rawW - UpperLeftX + 7) / 8;
+
+ switch (Model)
+ {
+ case MODEL_2300DL: bpl16 = bpl; break;
+ case MODEL_HP1020: bpl16 = (bpl + 15) & ~15; break;
+ case MODEL_HP_PRO: bpl16 = (bpl + 15) & ~15; break;
+ case MODEL_HP_PRO_CP: bpl16 = (bpl + 15) & ~15; break;
+ default: error(1, "Bad model %d\n", Model); break;
+ }
+
+ buf = malloc(bpl16 * h);
+ if (!buf)
+ error(1, "Can't allocate page buffer\n");
+
+ rc = read_and_clip_image(buf, rawBpl, rightBpl, 8, bpl, h, bpl16, ifp);
+ if (rc == EOF)
+ error(1, "Premature EOF(pbm) on input stream\n");
+
+ ++PageNum;
+ if (Duplex == DMDUPLEX_LONGEDGE && even_page(PageNum))
+ rotate_bytes_180(buf, buf + bpl16 * h - 1, Mirror1);
+
+ if (even_page(PageNum) && EvenPages)
+ {
+ if (Duplex == DMDUPLEX_MANUALLONG)
+ rotate_bytes_180(buf, buf + bpl16 * h - 1, Mirror1);
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ pbm_page(buf, w, h, EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "PBM Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+ else if (Model == MODEL_HP_PRO
+ && (Duplex == DMDUPLEX_LONGEDGE || Duplex == DMDUPLEX_SHORTEDGE) )
+ {
+ /*
+ * Duplex on P1606dn works like this:
+ * P2(norm), P1(rot180), P4(norm), P3(rot180)
+ */
+ if (odd_page(PageNum))
+ {
+ tfp = tmpfile();
+ pbm_page(buf, w, h, tfp);
+ fflush(tfp);
+ tpos = ftell(tfp);
+ rewind(tfp);
+ }
+ else
+ {
+ pbm_page(buf, w, h, ofp);
+ while (tpos--)
+ putc(getc(tfp), ofp);
+ fclose(tfp);
+ }
+ }
+ else
+ pbm_page(buf, w, h, ofp);
+
+ free(buf);
+ }
+
+ if (Model == MODEL_HP_PRO
+ && (Duplex == DMDUPLEX_LONGEDGE || Duplex == DMDUPLEX_SHORTEDGE)
+ && odd_page(PageNum) )
+ {
+ /*
+ * Duplex on P1606dn if there are an odd number of pages:
+ * P2(blank), P1(rot180)
+ */
+ blank_page(ofp);
+ while (tpos--)
+ putc(getc(tfp), ofp);
+ fclose(tfp);
+ }
+
+ return (0);
+}
+
+int
+parse_xy(char *str, int *xp, int *yp)
+{
+ char *p;
+
+ if (!str || str[0] == 0) return -1;
+
+ *xp = strtoul(str, &p, 10);
+ if (str == p) return -2;
+ while (*p && (*p < '0' || *p > '9'))
+ ++p;
+ str = p;
+ if (str[0] == 0) return -3;
+ *yp = strtoul(str, &p, 10);
+ if (str == p) return -4;
+ return (0);
+}
+
+void
+do_one(FILE *in)
+{
+ int mode;
+
+ if (Mode == MODE_COLOR)
+ {
+ mode = getc(in);
+ if (mode != 'P')
+ {
+ ungetc(mode, in);
+ cmyk_pages(in, stdout);
+ }
+ else
+ {
+ mode = getc(in);
+ if (mode == '4')
+ pksm_pages(in, stdout);
+ else
+ error(1, "Not a pksmraw file!\n");
+ }
+ }
+ else
+ {
+ mode = getc(in);
+ if (mode != 'P')
+ error(1, "Not a pbm file!\n");
+ mode = getc(in);
+ if (mode == '4')
+ pbm_pages(in, stdout);
+ else
+ error(1, "Not a pbmraw file!\n");
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ int i, j;
+
+ while ( (c = getopt(argc, argv,
+ "cd:g:n:m:p:r:s:tT:u:l:z:L:ABPJ:S:U:X:D:V?h")) != EOF)
+ switch (c)
+ {
+ case 'c': Mode = MODE_COLOR; break;
+ case 'S': Color2Mono = atoi(optarg);
+ Mode = MODE_COLOR;
+ if (Color2Mono < 0 || Color2Mono > 4)
+ error(1, "Illegal value '%s' for -C\n", optarg);
+ break;
+ case 'd': Duplex = atoi(optarg); break;
+ case 'g': if (parse_xy(optarg, &PageWidth, &PageHeight))
+ error(1, "Illegal format '%s' for -g\n", optarg);
+ if (PageWidth < 0 || PageWidth > 1000000)
+ error(1, "Illegal X value '%s' for -g\n", optarg);
+ if (PageHeight < 0 || PageHeight > 1000000)
+ error(1, "Illegal Y value '%s' for -g\n", optarg);
+ break;
+ case 'm': MediaCode = atoi(optarg); break;
+ case 'n': Copies = atoi(optarg); break;
+ case 'p': PaperCode = atoi(optarg); break;
+ case 'r': if (parse_xy(optarg, &ResX, &ResY))
+ error(1, "Illegal format '%s' for -r\n", optarg);
+ break;
+ case 's': SourceCode = atoi(optarg); break;
+ case 't': SaveToner = 1; break;
+ case 'T': PrintDensity = atoi(optarg);
+ if (PrintDensity < 1 || PrintDensity > 5)
+ error(1, "Illegal value '%s' for PrintDensity -T\n",
+ optarg);
+ break;
+ case 'u':
+ if (strcmp(optarg, "0") == 0)
+ break;
+ if (parse_xy(optarg, &UpperLeftX, &UpperLeftY))
+ error(1, "Illegal format '%s' for -u\n", optarg);
+ break;
+ case 'l':
+ if (strcmp(optarg, "0") == 0)
+ break;
+ if (parse_xy(optarg, &LowerRightX, &LowerRightY))
+ error(1, "Illegal format '%s' for -l\n", optarg);
+ break;
+ case 'z': Model = atoi(optarg);
+ if (Model < 0 || Model > MODEL_LAST)
+ error(1, "Illegal value '%s' for -z\n", optarg);
+ break;
+ case 'L': LogicalClip = atoi(optarg);
+ if (LogicalClip < 0 || LogicalClip > 3)
+ error(1, "Illegal value '%s' for -L\n", optarg);
+ break;
+ case 'A': AllIsBlack = !AllIsBlack; break;
+ case 'B': BlackClears = !BlackClears; break;
+ case 'P': OutputStartPlane = !OutputStartPlane; break;
+ case 'J': if (optarg[0]) Filename = optarg; break;
+ case 'U': if (optarg[0]) Username = optarg; break;
+ case 'X': ExtraPad = atoi(optarg); break;
+ case 'D': Debug = atoi(optarg); break;
+ case 'V': printf("%s\n", Version); exit(0);
+ default: usage(); exit(1);
+ }
+
+ if (UpperLeftX < 0 || UpperLeftX >= PageWidth)
+ error(1, "Illegal X value '%d' for -u\n", UpperLeftX);
+ if (UpperLeftY < 0 || UpperLeftY >= PageHeight)
+ error(1, "Illegal Y value '%d' for -u\n", UpperLeftY);
+ if (LowerRightX < 0 || LowerRightX >= PageWidth)
+ error(1, "Illegal X value '%d' for -l\n", LowerRightX);
+ if (LowerRightY < 0 || LowerRightY >= PageHeight)
+ error(1, "Illegal Y value '%d' for -l\n", LowerRightY);
+
+ argc -= optind;
+ argv += optind;
+
+ if (getenv("DEVICE_URI"))
+ IsCUPS = 1;
+
+ // Model temporary set HP...
+ Model = 1;
+ Bpp = ResX / 600;
+
+ if (Model == MODEL_HP1020
+ || Model == MODEL_HP_PRO
+ || Model == MODEL_HP_PRO_CP)
+ {
+ Bpp = ResX / 600;
+ // ResX = 600;
+ if (SaveToner)
+ {
+ SaveToner = 0;
+ EconoMode = 1;
+ }
+ }
+
+ if (Model == MODEL_HP_PRO || Model == MODEL_HP_PRO_CP)
+ JbgOptions[3] = 0; /* MX = 0 */
+
+ switch (Duplex)
+ {
+ case DMDUPLEX_MANUALLONG:
+ case DMDUPLEX_MANUALSHORT:
+ EvenPages = tmpfile();
+ break;
+ }
+
+ start_doc(stdout);
+
+ if (argc == 0)
+ {
+ do_one(stdin);
+ }
+ else
+ {
+ for (i = 0; i < argc; ++i)
+ {
+ FILE *ifp;
+
+ ifp = fopen(argv[i], "r");
+ if (!ifp)
+ error(1, "Can't open '%s' for reading\n", argv[i]);
+ do_one(ifp);
+ fclose(ifp);
+ }
+ }
+
+ /*
+ * Do manual duplex
+ */
+ if (EvenPages)
+ {
+ DWORD media;
+ int rc;
+
+ // Handle odd page count
+ if (odd_page(PageNum))
+ {
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ blank_page(EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "Blank Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+
+ /*
+ * Manual Pause
+ */
+ if (Model == MODEL_HP1020
+ || Model == MODEL_HP_PRO
+ || Model == MODEL_HP_PRO_CP)
+ load_tray2(stdout);
+
+ fseek(EvenPages, SeekMedia, 0L);
+ media = be32(DMMEDIA_LETTERHEAD);
+ rc = fwrite(&media, 1, sizeof(DWORD), EvenPages);
+ if (rc == 0) error(1, "fwrite(10): rc == 0!\n");
+
+ // Write even pages in reverse order
+ for (i = SeekIndex-1; i >= 0; --i)
+ {
+ debug(1, "EvenPage: %d %ld %ld\n",
+ i, SeekRec[i].b, SeekRec[i].e);
+ fseek(EvenPages, SeekRec[i].b, 0L);
+ for (j = 0; j < (SeekRec[i].e - SeekRec[i].b); ++j)
+ putc(getc(EvenPages), stdout);
+ }
+ fclose(EvenPages);
+ }
+
+ end_doc(stdout);
+
+ exit(0);
+}
diff --git a/foomatic-db/driver/foo2hbpl2.xml b/foomatic-db/driver/foo2hbpl2.xml
new file mode 100644
index 0000000..d66f376
--- /dev/null
+++ b/foomatic-db/driver/foo2hbpl2.xml
@@ -0,0 +1,19 @@
+<driver id="driver/foo2hbpl2">
+ <name>foo2hbpl2</name>
+ <url>http://foo2hbpl2.rkkda.com/</url>
+ <execution>
+ <filter />
+ <prototype>foo2hbpl2-wrapper %A</prototype>
+ </execution>
+ <comments> <en>
+
+ This is a driver developed for the Dell 1355 and the
+ Xerox WorkCentre 6015 Multifunction Printer (printer only).
+
+ </en> </comments>
+ <printers>
+ <printer><id>printer/Dell-1355</id></printer>
+ <printer><id>printer/Xerox-WorkCentre_6015</id></printer>
+ <printer><id>printer/Fuji_Xerox-DocuPrint_CM205</id></printer>
+ </printers>
+</driver>
diff --git a/foomatic-db/opt/foo2hbpl2-ColorMode.xml b/foomatic-db/opt/foo2hbpl2-ColorMode.xml
new file mode 100644
index 0000000..4cfefcb
--- /dev/null
+++ b/foomatic-db/opt/foo2hbpl2-ColorMode.xml
@@ -0,0 +1,38 @@
+<option type="enum" id="opt/foo2hbpl2-ColorMode">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname> <en>Color Mode</en> </arg_longname>
+ <arg_shortname> <en>ColorMode</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>General</arg_group>
+ <arg_order>120</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2hbpl2-ColorMode-mono</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2hbpl2-ColorMode-mono">
+ <ev_longname> <en>Monochrome</en> </ev_longname>
+ <comments><en>
+ Prints in monochrome only
+ </en></comments>
+ <ev_shortname> <en>Monochrome</en> </ev_shortname>
+ <ev_driverval></ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-ColorMode-color">
+ <ev_longname> <en>Color</en> </ev_longname>
+ <comments><en>
+ Prints in color using the best compromise setting.
+ </en></comments>
+ <ev_shortname> <en>Color</en> </ev_shortname>
+ <ev_driverval>-c</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2hbpl2-ICM.xml b/foomatic-db/opt/foo2hbpl2-ICM.xml
new file mode 100644
index 0000000..eac7a01
--- /dev/null
+++ b/foomatic-db/opt/foo2hbpl2-ICM.xml
@@ -0,0 +1,70 @@
+<option type="enum" id="opt/foo2hbpl2-ICM">
+ <comments>
+ <en>
+ This option controls which .ICM file to use for color correction.
+ ICM files are stored in directory /usr/share/foo2qpdl/icm/.
+ </en>
+ </comments>
+ <arg_longname> <en>ICM Color Profile</en> </arg_longname>
+ <arg_shortname> <en>ICM</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>Adjustment</arg_group>
+ <arg_order>300</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2hbpl2-ICM-none</arg_defval>
+ </constraint>
+ <constraint sense="true">
+ <make>Xerox</make>
+ <model>WorkCenter 6015</model>
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2hbpl2-ICM-none</arg_defval>
+ </constraint>
+ <constraint sense="true">
+ <make>Dell</make>
+ <model>1355</model>
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2qpdl-ICM-none</arg_defval>
+ </constraint>
+ <constraint sense="true">
+ <make>Fuji Xerox</make>
+ <model>DocuPrint_CM205</model>
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2qpdl-ICM-none</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2hbpl2-ICM-none">
+ <ev_longname> <en>No ICM color correction</en> </ev_longname>
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <ev_shortname> <en>none</en> </ev_shortname>
+ <ev_driverval>-C10 -Gnone.icm</ev_driverval>
+ </enum_val>
+
+ <enum_val id="ev/foo2hbpl2-ICM-testing">
+ <ev_longname> <en>File testing.icm</en> </ev_longname>
+ <ev_shortname> <en>testing</en> </ev_shortname>
+ <ev_driverval>-C10 -Gtesting.icm</ev_driverval>
+ </enum_val>
+
+ <enum_val id="ev/foo2hbpl2-ICM-testing2">
+ <ev_longname> <en>File testing2.icm</en> </ev_longname>
+ <ev_shortname> <en>testing2</en> </ev_shortname>
+ <ev_driverval>-C10 -Gtesting2.icm</ev_driverval>
+ </enum_val>
+
+ <enum_val id="ev/foo2hbpl2-ICM-testing3">
+ <ev_longname> <en>File testing3.icm</en> </ev_longname>
+ <ev_shortname> <en>testing3</en> </ev_shortname>
+ <ev_driverval>-C10 -Gtesting3.icm</ev_driverval>
+ </enum_val>
+
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2hbpl2-MediaType.xml b/foomatic-db/opt/foo2hbpl2-MediaType.xml
new file mode 100644
index 0000000..1ba2d6c
--- /dev/null
+++ b/foomatic-db/opt/foo2hbpl2-MediaType.xml
@@ -0,0 +1,82 @@
+<option type="enum" id="opt/foo2hbpl2-MediaType">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname> <en>Media Type</en> </arg_longname>
+ <arg_shortname> <en>MediaType</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>General</arg_group>
+ <arg_order>150</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>-m%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2hbpl2-MediaType-1</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2hbpl2-MediaType-1">
+ <ev_longname> <en>Plain Paper</en> </ev_longname>
+ <ev_shortname> <en>plain</en> </ev_shortname>
+ <ev_driverval>1</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-2">
+ <ev_longname> <en>Bond</en> </ev_longname>
+ <ev_shortname> <en>bond</en> </ev_shortname>
+ <ev_driverval>2</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-3">
+ <ev_longname> <en>Light Weight Card</en> </ev_longname>
+ <ev_shortname> <en>lwcard</en> </ev_shortname>
+ <ev_driverval>3</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-4">
+ <ev_longname> <en>Light Weight Glossy Card</en> </ev_longname>
+ <ev_shortname> <en>lwgcard</en> </ev_shortname>
+ <ev_driverval>4</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-5">
+ <ev_longname> <en>Labels</en> </ev_longname>
+ <ev_shortname> <en>labels</en> </ev_shortname>
+ <ev_driverval>5</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-6">
+ <ev_longname> <en>Envelope</en> </ev_longname>
+ <ev_shortname> <en>envelope</en> </ev_shortname>
+ <ev_driverval>6</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-7">
+ <ev_longname> <en>Recycled Paper</en> </ev_longname>
+ <ev_shortname> <en>recycled</en> </ev_shortname>
+ <ev_driverval>7</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-8">
+ <ev_longname> <en>Plain Paper Side 2</en> </ev_longname>
+ <ev_shortname> <en>plain2</en> </ev_shortname>
+ <ev_driverval>8</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-9">
+ <ev_longname> <en>Bond Side 2</en> </ev_longname>
+ <ev_shortname> <en>bond2</en> </ev_shortname>
+ <ev_driverval>9</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-10">
+ <ev_longname> <en>Light Weight Card Side 2</en> </ev_longname>
+ <ev_shortname> <en>lwcard2</en> </ev_shortname>
+ <ev_driverval>10</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-11">
+ <ev_longname> <en>Light Weight Glossy Card Side 2</en></ev_longname>
+ <ev_shortname> <en>lwgcard2</en> </ev_shortname>
+ <ev_driverval>11</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-MediaType-12">
+ <ev_longname> <en>Recycled Paper Side 2</en> </ev_longname>
+ <ev_shortname> <en>recycled2</en> </ev_shortname>
+ <ev_driverval>12</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2hbpl2-PageSize.xml b/foomatic-db/opt/foo2hbpl2-PageSize.xml
new file mode 100644
index 0000000..e14c082
--- /dev/null
+++ b/foomatic-db/opt/foo2hbpl2-PageSize.xml
@@ -0,0 +1,80 @@
+<option type="enum" id="opt/foo2hbpl2-PageSize">
+ <arg_longname> <en>Page Size</en> </arg_longname>
+ <arg_shortname> <en>PageSize</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>General</arg_group>
+ <arg_order>135</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>-p%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2hbpl2-PageSize-0</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2hbpl2-PageSize-1">
+ <ev_longname> <en>A4</en> </ev_longname>
+ <ev_shortname> <en>A4</en> </ev_shortname>
+ <ev_driverval>1</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-2">
+ <ev_longname> <en>B5 (JIS)</en> </ev_longname>
+ <ev_shortname> <en>B5jis</en> </ev_shortname>
+ <ev_driverval>2</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-4">
+ <ev_longname> <en>Letter</en> </ev_longname>
+ <ev_shortname> <en>Letter</en> </ev_shortname>
+ <ev_driverval>4</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-5">
+ <ev_longname> <en>Executive</en> </ev_longname>
+ <ev_shortname> <en>Executive</en> </ev_shortname>
+ <ev_driverval>5</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-6">
+ <ev_longname> <en>Fanfold German Legal</en> </ev_longname>
+ <ev_shortname> <en>FanfoldGermanLegal</en> </ev_shortname>
+ <ev_driverval>6</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-6-alt">
+ <ev_longname> <en>Folio</en> </ev_longname>
+ <ev_shortname> <en>Folio</en> </ev_shortname>
+ <ev_driverval>6</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-7">
+ <ev_longname> <en>Legal</en> </ev_longname>
+ <ev_shortname> <en>Legal</en> </ev_shortname>
+ <ev_driverval>7</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-9">
+ <ev_longname> <en>Env #10</en> </ev_longname>
+ <ev_shortname> <en>Env10</en> </ev_shortname>
+ <ev_driverval>9</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-10">
+ <ev_longname> <en>Env Monarch</en> </ev_longname>
+ <ev_shortname> <en>EnvMonarch</en> </ev_shortname>
+ <ev_driverval>10</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-11">
+ <ev_longname> <en>Env C5</en> </ev_longname>
+ <ev_shortname> <en>EnvC5</en> </ev_shortname>
+ <ev_driverval>11</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-12">
+ <ev_longname> <en>Env DL</en> </ev_longname>
+ <ev_shortname> <en>EnvDL</en> </ev_shortname>
+ <ev_driverval>12</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2hbpl2-PageSize-Custom">
+ <ev_longname> <en>Custom</en> </ev_longname>
+ <ev_shortname> <en>Custom</en> </ev_shortname>
+ <ev_driverval>Custom.%0x%1</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2xxx-Copies.xml b/foomatic-db/opt/foo2xxx-Copies.xml
index 8dde4e2..0a3ec63 100644
--- a/foomatic-db/opt/foo2xxx-Copies.xml
+++ b/foomatic-db/opt/foo2xxx-Copies.xml
@@ -60,6 +60,10 @@
<driver>foo2hiperc</driver>
<arg_defval>1</arg_defval>
</constraint>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>1</arg_defval>
+ </constraint>
</constraints>
<arg_max>100</arg_max>
<arg_min>1</arg_min>
diff --git a/foomatic-db/opt/foo2xxx-Halftone.xml b/foomatic-db/opt/foo2xxx-Halftone.xml
index 975019d..a02effe 100644
--- a/foomatic-db/opt/foo2xxx-Halftone.xml
+++ b/foomatic-db/opt/foo2xxx-Halftone.xml
@@ -63,6 +63,10 @@
<driver>foo2hiperc</driver>
<arg_defval>ev/foo2xxx-Halftone-Default</arg_defval>
</constraint>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2xxx-Halftone-Default</arg_defval>
+ </constraint>
</constraints>
<enum_vals>
<enum_val id="ev/foo2xxx-Halftone-Default">
diff --git a/foomatic-db/opt/foo2xxx-Nup.xml b/foomatic-db/opt/foo2xxx-Nup.xml
index d006b5c..51c5b97 100644
--- a/foomatic-db/opt/foo2xxx-Nup.xml
+++ b/foomatic-db/opt/foo2xxx-Nup.xml
@@ -60,6 +60,10 @@
<driver>foo2hiperc</driver>
<arg_defval>ev/foo2xxx-Nup-1</arg_defval>
</constraint>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2xxx-Nup-1</arg_defval>
+ </constraint>
</constraints>
<enum_vals>
<enum_val id="ev/foo2xxx-Nup-1">
diff --git a/foomatic-db/opt/foo2xxx-NupOrient.xml b/foomatic-db/opt/foo2xxx-NupOrient.xml
index 94ffac6..2a6309d 100644
--- a/foomatic-db/opt/foo2xxx-NupOrient.xml
+++ b/foomatic-db/opt/foo2xxx-NupOrient.xml
@@ -60,6 +60,10 @@
<driver>foo2hiperc</driver>
<arg_defval>ev/foo2xxx-NupOrient-port</arg_defval>
</constraint>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2xxx-NupOrient-port</arg_defval>
+ </constraint>
</constraints>
<enum_vals>
<enum_val id="ev/foo2xxx-NupOrient-port">
diff --git a/foomatic-db/opt/foo2xxx-Quality.xml b/foomatic-db/opt/foo2xxx-Quality.xml
index dd6681a..4fcbe9f 100644
--- a/foomatic-db/opt/foo2xxx-Quality.xml
+++ b/foomatic-db/opt/foo2xxx-Quality.xml
@@ -63,6 +63,10 @@
<driver>foo2hiperc</driver>
<arg_defval>ev/foo2xxx-Quality-Normal</arg_defval>
</constraint>
+ <constraint sense="true">
+ <driver>foo2hbpl2</driver>
+ <arg_defval>ev/foo2xxx-Quality-Normal</arg_defval>
+ </constraint>
</constraints>
<enum_vals>
<enum_val id="ev/foo2xxx-Quality-Normal">
diff --git a/foomatic-db/printer/Dell-1355.xml b/foomatic-db/printer/Dell-1355.xml
new file mode 100644
index 0000000..76714d1
--- /dev/null
+++ b/foomatic-db/printer/Dell-1355.xml
@@ -0,0 +1,71 @@
+<printer id="printer/Dell-1355">
+ <make>Dell</make>
+ <model>1355</model>
+ <mechanism>
+ <laser/>
+ <color/>
+ <resolution>
+ <dpi>
+ <x>1200</x>
+ <y>600</y>
+ </dpi>
+ </resolution>
+ <margins>
+ <general>
+ <unit>mm</unit>
+ <top>4.23164</top>
+ <bottom>4.23164</bottom>
+ <left>3.175</left>
+ <right>3.175</right>
+ </general>
+ </margins>
+<!--
+ <consumables>
+ <comments> <en>
+ Toner Cyan (1000 prints) - $45
+ Toner Magenta (1000 prints) - $45
+ Toner Yellow (1000 prints) - $45
+ Toner Black (2000 prints) - $54
+ Waste Toner (5000 prints) - $10
+ Drum Kit (20000 prints) - $159
+ </en> </comments>
+ <partno>106R01271</partno>
+ <partno>106R01272</partno>
+ <partno>106R01273</partno>
+ <partno>106R01274</partno>
+ <partno>108R00722</partno>
+ <partno>108R00744</partno>
+ </consumables>
+-->
+ </mechanism>
+ <url>http://www.office.xerox.com/multifunction-printer/color-multifunction/workcentre-6015/enfo.html</url>
+ <lang>
+ <proprietary/>
+ <!--no pjl--><!--No "text"?-->
+ </lang>
+ <autodetect>
+<!--
+ <parallel>
+ <ieee1284>MFG:Xerox;CMD:SPLC;MDL:Phaser 6110;CLS:PRINTER;STATUS:BUSY;</ieee1284>
+ <manufacturer>Xerox</manufacturer>
+ <model>Phaser 6110</model>
+ <commandset>SPLC</commandset>
+ </parallel>
+-->
+ <snmp>
+ <description>Xerox WorkCentre 6015</description>
+ </snmp>
+ </autodetect>
+ <functionality>C</functionality>
+ <driver>foo2hbpl2</driver>
+ <!--not "unverified"--><!--no "contrib_url"-->
+ <comments> <en>
+
+ The Dell 1355 is color multifunction printer with a 2013 street
+ price of $250.
+
+ These printers are supported by the foo2hbpl2 open software printer
+ driver.
+
+ </en> </comments>
+</printer>
diff --git a/foomatic-db/printer/Fuji_Xerox-DocuPrint_CM205.xml b/foomatic-db/printer/Fuji_Xerox-DocuPrint_CM205.xml
new file mode 100644
index 0000000..9255dc2
--- /dev/null
+++ b/foomatic-db/printer/Fuji_Xerox-DocuPrint_CM205.xml
@@ -0,0 +1,71 @@
+<printer id="printer/Fuji_Xerox-DocuPrint_CM205">
+ <make>Fuji Xerox</make>
+ <model>DocuPrint CM205</model>
+ <mechanism>
+ <laser/>
+ <color/>
+ <resolution>
+ <dpi>
+ <x>1200</x>
+ <y>600</y>
+ </dpi>
+ </resolution>
+ <margins>
+ <general>
+ <unit>mm</unit>
+ <top>4.23164</top>
+ <bottom>4.23164</bottom>
+ <left>3.175</left>
+ <right>3.175</right>
+ </general>
+ </margins>
+<!--
+ <consumables>
+ <comments> <en>
+ Toner Cyan (1000 prints) - $45
+ Toner Magenta (1000 prints) - $45
+ Toner Yellow (1000 prints) - $45
+ Toner Black (2000 prints) - $54
+ Waste Toner (5000 prints) - $10
+ Drum Kit (20000 prints) - $159
+ </en> </comments>
+ <partno>106R01271</partno>
+ <partno>106R01272</partno>
+ <partno>106R01273</partno>
+ <partno>106R01274</partno>
+ <partno>108R00722</partno>
+ <partno>108R00744</partno>
+ </consumables>
+-->
+ </mechanism>
+ <url>http://www.office.xerox.com/multifunction-printer/color-multifunction/workcentre-6015/enfo.html</url>
+ <lang>
+ <proprietary/>
+ <!--no pjl--><!--No "text"?-->
+ </lang>
+ <autodetect>
+<!--
+ <parallel>
+ <ieee1284>MFG:Xerox;CMD:SPLC;MDL:Phaser 6110;CLS:PRINTER;STATUS:BUSY;</ieee1284>
+ <manufacturer>Xerox</manufacturer>
+ <model>Phaser 6110</model>
+ <commandset>SPLC</commandset>
+ </parallel>
+-->
+ <snmp>
+ <description>Xerox WorkCentre 6015</description>
+ </snmp>
+ </autodetect>
+ <functionality>C</functionality>
+ <driver>foo2hbpl2</driver>
+ <!--not "unverified"--><!--no "contrib_url"-->
+ <comments> <en>
+
+ The Xerox WorkCentre 6015/B (USB) and Xerox WorkCentre 6015/N (Net)
+ are color multifunction printer with a 2013 street price of $250.
+
+ These printers are supported by the foo2hbpl2 open software printer
+ driver.
+
+ </en> </comments>
+</printer>
diff --git a/foomatic-db/printer/Xerox-WorkCentre_6015.xml b/foomatic-db/printer/Xerox-WorkCentre_6015.xml
new file mode 100644
index 0000000..7addb70
--- /dev/null
+++ b/foomatic-db/printer/Xerox-WorkCentre_6015.xml
@@ -0,0 +1,71 @@
+<printer id="printer/Xerox-WorkCentre_6015">
+ <make>Xerox</make>
+ <model>WorkCentre 6015</model>
+ <mechanism>
+ <laser/>
+ <color/>
+ <resolution>
+ <dpi>
+ <x>1200</x>
+ <y>600</y>
+ </dpi>
+ </resolution>
+ <margins>
+ <general>
+ <unit>mm</unit>
+ <top>4.23164</top>
+ <bottom>4.23164</bottom>
+ <left>3.175</left>
+ <right>3.175</right>
+ </general>
+ </margins>
+<!--
+ <consumables>
+ <comments> <en>
+ Toner Cyan (1000 prints) - $45
+ Toner Magenta (1000 prints) - $45
+ Toner Yellow (1000 prints) - $45
+ Toner Black (2000 prints) - $54
+ Waste Toner (5000 prints) - $10
+ Drum Kit (20000 prints) - $159
+ </en> </comments>
+ <partno>106R01271</partno>
+ <partno>106R01272</partno>
+ <partno>106R01273</partno>
+ <partno>106R01274</partno>
+ <partno>108R00722</partno>
+ <partno>108R00744</partno>
+ </consumables>
+-->
+ </mechanism>
+ <url>http://www.office.xerox.com/multifunction-printer/color-multifunction/workcentre-6015/enfo.html</url>
+ <lang>
+ <proprietary/>
+ <!--no pjl--><!--No "text"?-->
+ </lang>
+ <autodetect>
+<!--
+ <parallel>
+ <ieee1284>MFG:Xerox;CMD:SPLC;MDL:Phaser 6110;CLS:PRINTER;STATUS:BUSY;</ieee1284>
+ <manufacturer>Xerox</manufacturer>
+ <model>Phaser 6110</model>
+ <commandset>SPLC</commandset>
+ </parallel>
+-->
+ <snmp>
+ <description>Xerox WorkCentre 6015</description>
+ </snmp>
+ </autodetect>
+ <functionality>C</functionality>
+ <driver>foo2hbpl2</driver>
+ <!--not "unverified"--><!--no "contrib_url"-->
+ <comments> <en>
+
+ The Xerox WorkCentre 6015/B (USB) and Xerox WorkCentre 6015/N (Net)
+ are color multifunction printer with a 2013 street price of $250.
+
+ These printers are supported by the foo2hbpl2 open software printer
+ driver.
+
+ </en> </comments>
+</printer>
diff --git a/hbpl.h b/hbpl.h
new file mode 100644
index 0000000..8953900
--- /dev/null
+++ b/hbpl.h
@@ -0,0 +1,256 @@
+/*
+ * Manifest constants for the ZjStream protocol
+ *
+ * I'm told that a lot of this stuff came from a file called "zjrca.h".
+ * But a Google search does not turn up that file. I added my own
+ * improvements and missing pieces. -Rick
+ */
+
+#include <inttypes.h>
+typedef uint32_t DWORD;
+typedef uint16_t WORD;
+typedef uint8_t BYTE;
+
+#pragma pack(push)
+#pragma pack(1)
+
+typedef struct _HBPL_HEADER {
+ char type[3];
+ char len;
+} HBPL_HEADER;
+
+typedef struct _HBPL_JP {
+ HBPL_HEADER hdr; // 0
+ DWORD unk1; // 4
+ DWORD unk2; // 8
+ char unk3[3]; // 12,13,14
+ char source_size; // 15
+ DWORD unk[12]; // 16 ... 60
+} HBPL_JP;
+
+typedef struct _HBPL_PS {
+ HBPL_HEADER hdr; // 0
+ DWORD w; // 4
+ DWORD h; // 8
+ DWORD wh_total; // 12 in bytes
+ DWORD len; // 16
+ char papersize; // 20
+ char mediatype; // 21
+ char color; // 22
+ char unk2; // 23
+ WORD res; // 24
+ DWORD bihoff[4]; // 26, 30, 34, 38
+ WORD unk3; // 42
+ DWORD unk4[5]; // 44, 48, 52, 56, 60
+} HBPL_PS;
+
+typedef struct _HBPL_PE {
+ HBPL_HEADER hdr; // 0
+ DWORD unk[15]; // 4 ... 60
+} HBPL_PE;
+
+typedef struct _HBPL_DM {
+ HBPL_HEADER hdr;
+ DWORD data;
+} HBPL_DM;
+
+#pragma pack(pop)
+
+typedef enum
+{
+ DMDUPLEX_OFF = 1,
+ DMDUPLEX_LONGEDGE = 2,
+ DMDUPLEX_SHORTEDGE = 3,
+ DMDUPLEX_MANUALLONG = 4,
+ DMDUPLEX_MANUALSHORT= 5
+} DMDUPLEX;
+
+typedef enum {
+ DMBIN_UPPER = 1,
+ DMBIN_ONLYONE = 1,
+ DMBIN_LOWER = 2,
+ DMBIN_MIDDLE = 3,
+ DMBIN_MANUAL = 4,
+ DMBIN_ENVELOPE = 5,
+ DMBIN_ENVMANUAL = 6,
+ DMBIN_AUTO = 7,
+ DMBIN_TRACTOR = 8,
+ DMBIN_SMALLFMT = 9,
+ DMBIN_LARGEFMT =10,
+ DMBIN_LARGECAPACITY =11,
+ DMBIN_CASSETTE =14,
+ DMBIN_FORMSOURCE =15
+} DM_BIN;
+
+typedef enum {
+ DMMEDIA_STANDARD = 1, // Standard paper
+ DMMEDIA_TRANSPARENCY= 2, // Transparency
+ DMMEDIA_GLOSSY = 3, // Glossy paper
+ DMMEDIA_USER = 4, // Device-specific media start here
+
+ DMMEDIA_ENVELOPE = 0x101, // Envelope
+ DMMEDIA_LETTERHEAD = 0x103, // Letterhead
+ DMMEDIA_THICK_STOCK = 0x105, // Thick Stock
+ DMMEDIA_POSTCARD = 0x106, // Postcard
+ DMMEDIA_LABELS = 0x107, // Labels
+} DMMEDIA;
+
+typedef enum {
+ DMCOLOR_MONOCHROME = 1,
+ DMCOLOR_COLOR = 2,
+} DMCOLOR;
+
+typedef enum {
+ DMORIENT_PORTRAIT = 1,
+ DMORIENT_LANDSCAPE = 2,
+} DMORIENT;
+
+typedef enum {
+ DMPAPER_LETTER = 1, // Letter, 8 1/2- by 11-inches
+ DMPAPER_LETTERSMALL = 2, // Letter Small, 8 1/2- by 11-inches
+ DMPAPER_TABLOID = 3, // Tabloid, 11- by 17-inches
+ DMPAPER_LEDGER = 4, // Ledger, 17- by 11-inches
+ DMPAPER_LEGAL = 5, // Legal, 8 1/2- by 14-inches
+ DMPAPER_STATEMENT = 6, // Statement, 5 1/2- by 8 1/2-inches
+ DMPAPER_EXECUTIVE = 7, // Executive, 7 1/4- by 10 1/2-inches
+ DMPAPER_A3 = 8, // A3 sheet, 297- by 420-millimeters
+ DMPAPER_A4 = 9, // A4 Sheet, 210- by 297-millimeters
+ DMPAPER_A4SMALL =10, // A4 small sheet, 210- by 297-millimeters
+ DMPAPER_A5 =11, // A5 sheet, 148- by 210-millimeters
+ DMPAPER_B4 =12, // B4 sheet, 250- by 354-millimeters
+ DMPAPER_B5 =13, // B5 sheet, 182- by 257-millimeter paper
+ DMPAPER_FOLIO =14, // Folio, 8 1/2- by 13-inch paper
+ DMPAPER_QUARTO =15, // Quarto, 215- by 275-millimeter paper
+ DMPAPER_10X14 =16, // 10- by 14-inch sheet
+ DMPAPER_11X17 =17, // 11- by 17-inch sheet
+ DMPAPER_NOTE =18, // Note, 8 1/2- by 11-inches
+ DMPAPER_ENV_9 =19, // #9 Envelope, 3 7/8- by 8 7/8-inches
+ DMPAPER_ENV_10 =20, // #10 Envelope, 4 1/8- by 9 1/2-inches
+ DMPAPER_ENV_11 =21, // #11 Envelope, 4 1/2- by 10 3/8-inches
+ DMPAPER_ENV_12 =22, // #12 Envelope, 4 3/4- by 11-inches
+ DMPAPER_ENV_14 =23, // #14 Envelope, 5- by 11 1/2-inches
+ DMPAPER_CSHEET =24, // C Sheet, 17- by 22-inches
+ DMPAPER_DSHEET =25, // D Sheet, 22- by 34-inches
+ DMPAPER_ESHEET =26, // E Sheet, 34- by 44-inches
+ DMPAPER_ENV_DL =27, // DL Envelope, 110- by 220-millimeters
+ DMPAPER_ENV_C5 =28, // C5 Envelope, 162- by 229-millimeters
+ DMPAPER_ENV_C3 =29, // C3 Envelope, 324- by 458-millimeters
+ DMPAPER_ENV_C4 =30, // C4 Envelope, 229- by 324-millimeters
+ DMPAPER_ENV_C6 =31, // C6 Envelope, 114- by 162-millimeters
+ DMPAPER_ENV_C65 =32, // C65 Envelope, 114- by 229-millimeters
+ DMPAPER_ENV_B4 =33, // B4 Envelope, 250- by 353-millimeters
+ DMPAPER_ENV_B5 =34, // B5 Envelope, 176- by 250-millimeters
+ DMPAPER_ENV_B6 =35, // B6 Envelope, 176- by 125-millimeters
+ DMPAPER_ENV_ITALY =36, // Italy Envelope, 110- by 230-millimeters
+ DMPAPER_ENV_MONARCH =37, // Monarch Envelope, 3 7/8- by 7 1/2-inches
+ DMPAPER_ENV_PERSONAL=38, // 6 3/4 Envelope, 3 5/8- by 6 1/2-inches
+ DMPAPER_FANFOLD_US =39, // US Std Fanfold, 14 7/8- by 11-inches
+ DMPAPER_FANFOLD_STD_GERMAN =40, // German Std Fanfold, 8 1/2 x 12 in
+ DMPAPER_FANFOLD_LGL_GERMAN =41, // German Legal Fanfold, 8 1/2 x 13 in
+
+ DMPAPER_ISO_B4 =42, // B4 (ISO) 250 x 353 mm
+ DMPAPER_JAPANESE_POSTCARD =43, // Japanese Postcard 100 x 148 mm
+ DMPAPER_9X11 =44, // 9 x 11 in
+ DMPAPER_10X11 =45, // 10 x 11 in
+ DMPAPER_15X11 =46, // 15 x 11 in
+ DMPAPER_ENV_INVITE =47, // Envelope Invite 220 x 220 mm
+ DMPAPER_RESERVED_48 =48, // RESERVED--DO NOT USE
+ DMPAPER_RESERVED_49 =49, // RESERVED--DO NOT USE
+ DMPAPER_LETTER_EXTRA =50, // Letter Extra 9 \275 x 12 in
+ DMPAPER_LEGAL_EXTRA =51, // Legal Extra 9 \275 x 15 in
+ DMPAPER_TABLOID_EXTRA =52, // Tabloid Extra 11.69 x 18 in
+ DMPAPER_A4_EXTRA =53, // A4 Extra 9.27 x 12.69 in
+ DMPAPER_LETTER_TRANSVERSE =54, // Letter Transverse 8 \275 x 11 in
+ DMPAPER_A4_TRANSVERSE =55, // A4 Transverse 210 x 297 mm
+ DMPAPER_LETTER_EXTRA_TRANSVERSE=56, // Letter Extra Transverse 9\275 x 12 in
+ DMPAPER_A_PLUS =57, // SuperA/SuperA/A4 227 x 356 mm
+ DMPAPER_B_PLUS =58, // SuperB/SuperB/A3 305 x 487 mm
+ DMPAPER_LETTER_PLUS =59, // Letter Plus 8.5 x 12.69 in
+ DMPAPER_A4_PLUS =60, // A4 Plus 210 x 330 mm
+ DMPAPER_A5_TRANSVERSE =61, // A5 Transverse 148 x 210 mm
+ DMPAPER_B5_TRANSVERSE =62, // B5 (JIS) Transverse 182 x 257 mm
+ DMPAPER_A3_EXTRA =63, // A3 Extra 322 x 445 mm
+ DMPAPER_A5_EXTRA =64, // A5 Extra 174 x 235 mm
+ DMPAPER_B5_EXTRA =65, // B5 (ISO) Extra 201 x 276 mm
+ DMPAPER_A2 =66, // A2 420 x 594 mm
+ DMPAPER_A3_TRANSVERSE =67, // A3 Transverse 297 x 420 mm
+ DMPAPER_A3_EXTRA_TRANSVERSE =68, // A3 Extra Transverse 322 x 445 mm
+} DMPAPER;
+
+typedef union _SWAP_32{
+ char byte[sizeof(uint32_t)];
+ uint32_t dword;
+} SWAP_32;
+
+typedef union _SWAP_16{
+ char byte[sizeof(uint16_t)];
+ uint16_t word;
+} SWAP_16;
+
+static inline uint32_t
+be32(uint32_t dword)
+{
+ SWAP_32 swap;
+ uint32_t probe = 1;
+
+ if (((char *)&probe)[0] == 1)
+ {
+ swap.byte[3] = (( SWAP_32 )dword).byte[0];
+ swap.byte[2] = (( SWAP_32 )dword).byte[1];
+ swap.byte[1] = (( SWAP_32 )dword).byte[2];
+ swap.byte[0] = (( SWAP_32 )dword).byte[3];
+ return swap.dword;
+ }
+ else
+ return dword;
+}
+
+static inline uint16_t
+be16(uint16_t word)
+{
+ SWAP_16 swap;
+ uint16_t probe = 1;
+
+ if (((char *)&probe)[0] == 1)
+ {
+ swap.byte[1] = (( SWAP_16 )word).byte[0];
+ swap.byte[0] = (( SWAP_16 )word).byte[1];
+ return swap.word;
+ }
+ else
+ return word;
+}
+
+static inline uint32_t
+le32(uint32_t dword)
+{
+ SWAP_32 swap;
+ uint32_t probe = 1;
+
+ if (((char *)&probe)[0] != 1)
+ {
+ swap.byte[3] = (( SWAP_32 )dword).byte[0];
+ swap.byte[2] = (( SWAP_32 )dword).byte[1];
+ swap.byte[1] = (( SWAP_32 )dword).byte[2];
+ swap.byte[0] = (( SWAP_32 )dword).byte[3];
+ return swap.dword;
+ }
+ else
+ return dword;
+}
+
+static inline uint16_t
+le16(uint16_t word)
+{
+ SWAP_16 swap;
+ uint16_t probe = 1;
+
+ if (((char *)&probe)[0] != 1)
+ {
+ swap.byte[1] = (( SWAP_16 )word).byte[0];
+ swap.byte[0] = (( SWAP_16 )word).byte[1];
+ return swap.word;
+ }
+ else
+ return word;
+}
diff --git a/hbpldecode.1in b/hbpldecode.1in
index de3544f..52fee8a 100644
--- a/hbpldecode.1in
+++ b/hbpldecode.1in
@@ -19,7 +19,8 @@ stream with Huffman RLE data. This data is used by the Dell 1250c,
Epson AcuLaser C1700, Fuji-Xerox cp105b, and similiar printers.
.P
Version two is an HBPL stream with JBIG encoded data. This data
-is used by the Xerox WorkCentre 6015 and the Dell 1355c.
+is used by the Xerox WorkCentre 6015,
+Fuji Xerox DocuPrint CM205, and the Dell 1355c.
.P
Both versions can be decoded by hbpldecode.
HBPL is Host Based Printer Language.
@@ -194,6 +195,8 @@ $ hbpldecode -h 6015c-color.prn
'/" .BR foo2hbpl (1)
.SH "AUTHOR"
Rick Richardson <rick.richardson@comcast.net>
+.br
+Peter Korf <peter@niendo.de>
'/" .br
'/" ${URLHC}/
'/"
diff --git a/hbpldecode.c b/hbpldecode.c
index ce88f14..8500e03 100644
--- a/hbpldecode.c
+++ b/hbpldecode.c
@@ -1,9 +1,9 @@
/*
- * $Id: hbpldecode.c,v 1.31 2013/02/19 12:55:37 rick Exp $
+ * $Id: hbpldecode.c,v 1.46 2013/03/03 23:00:19 rick Exp $
*/
/*b
- * Copyright (C) 2003-2006 Rick Richardson
+ * Copyright (C) 2011-2012 Rick Richardson, peter
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Author: Rick Richardson <rick.richardson@comcast.net>
+ * Authors: Rick Richardson <rick.richardson@comcast.net>
+ * Peter Korf <peter@niendo.de>
b*/
#include <stdio.h>
@@ -87,7 +88,8 @@ usage(void)
" Epson AcuLaser C1700, Fuji-Xerox cp105b, and similiar printers.\n"
"\n"
" Version two is an HBPL stream with JBIG encoded data. This data\n"
-" is used by the Xerox WorkCentre 6015 and the Dell 1355c.\n"
+" is used by the Xerox WorkCentre 6015, Fuji Xerox Docuprint CM205\n"
+" and the Dell 1355c.\n"
"\n"
" Both versions can be decoded by hbpldecode.\n"
"\n"
@@ -107,7 +109,8 @@ usage(void)
* Hexdump stream data
*/
void
-hexdump(FILE *fp, char *lbl1, char *lbln, const void *vdata, int length)
+hexdump(FILE *fp, int decmode, char *lbl1, char *lbln, \
+ const void *vdata, int length)
{
int s;
int i;
@@ -124,27 +127,31 @@ hexdump(FILE *fp, char *lbl1, char *lbln, const void *vdata, int length)
for (s = 0; s < length; s += 16)
{
fprintf(fp, "%s", s ? lbln : lbl1);
- fprintf(fp, "%08x:", s);
+ fprintf(fp, decmode ? "%8d:" : "%08x:", s);
n = length - s; if (n > 16) n = 16;
for (i = 0; i < 16; ++i)
{
if (i == 8)
fprintf(fp, " ");
if (i < n)
- fprintf(fp, " %02x", buf[i] = data[s+i]);
+ fprintf(fp, decmode ? " %3d" : " %02x",
+ buf[i] = data[s+i]);
else
fprintf(fp, " ");
}
- fprintf(fp, " ");
- for (i = 0; i < n; ++i)
+ if (!decmode)
{
- if (i == 8)
- fprintf(fp, " ");
- c = buf[i];
- if (c >= ' ' && c < 0x7f)
- fprintf(fp, "%c", c);
- else
- fprintf(fp, ".");
+ fprintf(fp, " ");
+ for (i = 0; i < n; ++i)
+ {
+ if (i == 8)
+ fprintf(fp, " ");
+ c = buf[i];
+ if (c >= ' ' && c < 0x7f)
+ fprintf(fp, "%c", c);
+ else
+ fprintf(fp, ".");
+ }
}
fprintf(fp, "\n");
}
@@ -207,6 +214,231 @@ proff(int curOff)
printf("%6x: ", curOff);
}
+/*
+ * Version 2 stuff
+ */
+void
+decode_image(char *filename, int pagenum, int planenum,
+ unsigned char *bih, unsigned char *jbig, int jbiglen)
+{
+ FILE *dfp;
+ struct jbg_dec_state s;
+ size_t cnt;
+ unsigned char *image;
+ char buf[512];
+ int rc;
+
+ jbg_dec_init(&s);
+ rc = jbg_dec_in(&s, bih, 20, &cnt);
+ if (rc == JBG_EIMPL)
+ error(1, "JBIG uses unimplemented feature\n");
+ rc = jbg_dec_in(&s, jbig, jbiglen, &cnt);
+ if (rc == JBG_EOK)
+ {
+ int h, w, len;
+ h = jbg_dec_getheight(&s);
+ w = jbg_dec_getwidth(&s);
+ image = jbg_dec_getimage(&s, 0);
+ len = jbg_dec_getsize(&s);
+ if (image)
+ {
+ sprintf(buf, "%s-%02d-%d.pbm",
+ filename, pagenum, planenum);
+ dfp = fopen(buf, "w");
+ if (dfp)
+ {
+ fprintf(dfp, "P4\n%8d %8d\n", w, h);
+ rc = fwrite(image, 1, len, dfp);
+ fclose(dfp);
+ dfp = NULL;
+ }
+ }
+ else
+ debug(0, "Missing image %dx%d!\n", h, w);
+ }
+ jbg_dec_free(&s);
+}
+
+void
+decode2(FILE *fp, int curOff)
+{
+ // int c;
+ int rc;
+ // FILE *dfp = NULL;
+ int pageNum = 1;
+ int len;
+ // int curOff = 0;
+ // struct jbg_dec_state s[5];
+ // unsigned char bih[4][20];
+ // int imageCnt[4] = {0,0,0,0};
+ // int pn = 0;
+ unsigned char header[4];
+ unsigned char buf[512];
+ int w, h, wh_total, res, color, mediatype, papersize;
+ int p, offbih[4];
+ #define STRARY(X, A) \
+ ((X) >= 0 && (X) < sizeof(A)/sizeof(A[0])) \
+ ? A[X] : "UNK"
+ char *strsize[] = {
+ /*00*/ "unk", "A4", "B5", "unk", "Letter",
+ /*05*/ "Executive", "FanFoldGermanLegal", "Legal", "unk", "env#10",
+ /*10*/ "envMonarch", "envC5", "envDL", "unk", "unk",
+ };
+
+ char *strtype[] = {
+ /*00*/ "unk", "Plain", "Bond", "LwCard", "LwGCard",
+ /*05*/ "Labels", "Envelope", "Recycled", "Plain-side2", "Bond-side2",
+ /*10*/ "LwCard-side2", "LwGCard-side2", "Recycled-side2",
+ };
+
+ for (;;)
+ {
+ len = 4;
+ rc = fread(header, 1, len, fp);
+ if (rc != len)
+ {
+ error(1, "len=%d, but EOF on file\n", len);
+ return;
+ }
+
+ proff(curOff);
+
+ if (header[1] == '%' && header[2] == '-') //end of file
+ len = 15;
+ else
+ {
+ if (header[1] == 'J' && header[2] == 'P')
+ len = 60; // JP doesn't have len
+ else
+ len = header[3];
+ printf("RECTYPE %c%c - size=%d ", header[1], header[2], len);
+ }
+
+ curOff += len+4;
+ rc = fread(buf, 1, len, fp);
+ if (rc != len)
+ {
+ error(1, "len=%d, but EOF on file\n", len);
+ return;
+ }
+
+ if (0) {}
+ else if (header[1] == '%' && header[2] == '-')
+ {
+ buf[len] = 0x00;
+ printf("\\033%%-%c%s", header[3], buf);
+ return;
+ }
+ else if (header[1] == 'J' && header[2] == 'P')
+ {
+ printf("[Job Parameters]\n");
+
+ hexdump(stdout, 0, "", "", buf, len);
+ hexdump(stdout, 1, "", "", buf, len);
+ printf("\t\tsize/source(?) = %d(0x%02x)\n", buf[11], buf[11]);
+ }
+ else if (header[1] == 'D' && header[2] == 'M')
+ {
+ printf("[DM]\n");
+ hexdump(stdout, 0, "", "", buf, len);
+ }
+
+ else if (header[1] == 'P' && header[2] == 'S')
+ {
+ unsigned char *mbuf;
+
+ printf("[Page Start]\n");
+ if (Debug)
+ hexdump(stdout, 0, "", "", buf, len);
+ w = getLEdword(&buf[0]);
+ h = getLEdword(&buf[4]);
+ wh_total = getLEdword(&buf[8]);
+ res = getLEword(&buf[20]);
+ papersize = buf[16];
+ mediatype = buf[17];
+ color = buf[18];
+ printf("\t\tw,h = %dx%d, wh_total = %d, res = %d, color = %d\n",
+ w, h, wh_total, res, color);
+ printf("\t\tmediatype = %s(%d), papersize = %s(%d)\n",
+ STRARY(mediatype, strtype), mediatype,
+ STRARY(papersize, strsize), papersize);
+
+ for (p = 0; p < 4; ++p)
+ {
+ // offsets at 26, 30, 34, 38
+ offbih[p] = getLEdword(&buf[22 + p*4]);
+ printf("\t\toffbih[%d] = %d (0x%x)\n", p, offbih[p], offbih[p]);
+ }
+
+ len = getLEdword(&buf[12]);
+ mbuf = malloc(len);
+ if (!mbuf)
+ error(1, "malloc on mbuf, size=%d failed\n", len);
+ rc = fread(mbuf, 1, len, fp);
+ if (rc != len)
+ {
+ error(1, "len=%d, but EOF on file\n");
+ }
+ if (Debug > 2) hexdump(stdout, 0, "", "", mbuf, len);
+ if (color == 1)
+ {
+ proff(curOff);
+ printf("Yellow BIH:\n");
+ print_bih(mbuf);
+ printf("\t\t...yellow data skipped...\n");
+ decode_image(DecFile, pageNum, 3,
+ mbuf, mbuf+20, offbih[0]-20);
+
+ proff(curOff + offbih[0]);
+ printf("Magenta BIH:\n");
+ print_bih(mbuf + offbih[0]);
+ printf("\t\t...magenta data skipped...\n");
+ decode_image(DecFile, pageNum, 2,
+ mbuf, mbuf+20+offbih[0], offbih[1]-20);
+
+ proff(curOff + offbih[0] + offbih[1]);
+ printf("Cyan BIH:\n");
+ print_bih(mbuf + offbih[0] + offbih[1]);
+ printf("\t\t...cyan data skipped...\n");
+ decode_image(DecFile, pageNum, 1,
+ mbuf, mbuf+20+offbih[0]+offbih[1], offbih[2]-20);
+
+ proff(curOff + offbih[0] + offbih[1] + offbih[2]);
+ printf("Black BIH:\n");
+ print_bih(mbuf + offbih[0] + offbih[1] + offbih[2]);
+ printf("\t\t...black data skipped...\n");
+ decode_image(DecFile, pageNum, 4,
+ mbuf, mbuf+20+offbih[0]+offbih[1]+offbih[2], offbih[3]-20);
+ }
+ else
+ {
+ proff(curOff);
+ printf("Black BIH:\n");
+ // hexdump(stdout, 0, "", "", &bih[0], 20);
+ print_bih(mbuf);
+ printf("\t\t...black data skipped...\n");
+ decode_image(DecFile, pageNum, 0, mbuf, mbuf+20, offbih[3]-20);
+ }
+ free(mbuf);
+ curOff += len;
+ ++pageNum;
+ }
+ else if (header[1] == 'P' && header[2] == 'E')
+ {
+ printf("[Page End]\n");
+ hexdump(stdout, 0, "", "", buf, len);
+ }
+ else
+ {
+ printf("[Unknown]\n");
+ hexdump(stdout, 0, "", "", buf, len);
+ }
+ }
+}
+
+/*
+ * Version 1 stuff
+ */
int
payload(FILE *fp, int *curoffp, unsigned char *data, int *vp)
{
@@ -299,136 +531,6 @@ again:
}
void
-decode2(FILE *fp, int curOff)
-{
- // int c;
- int rc;
- // FILE *dfp = NULL;
- // int pageNum = 1;
- int len;
- // int curOff = 0;
- //struct jbg_dec_state s[5];
- // unsigned char bih[4][20];
- // int imageCnt[4] = {0,0,0,0};
- // int pn = 0;
- unsigned char buf[1024*1024*2];
- int w, h, res, color, mediatype, papersize;
- int p, offbih[4];
- #define STRARY(X, A) \
- ((X) >= 0 && (X) < sizeof(A)/sizeof(A[0])) \
- ? A[X] : "UNK"
- char *strsize[] = {
- /*00*/ "unk", "A4", "B5", "unk", "Letter",
- /*05*/ "Executive", "FanFoldGermanLegal", "Legal", "unk", "unk",
- };
-
- char *strtype[] = {
- /*00*/ "unk", "Plain", "Bond", "LwCard", "LwGCard",
- /*05*/ "Labels", "Envelope", "Recycled", "Plain-side2", "Bond-side2",
- /*10*/ "LwCard-side2", "LwGCard-side2", "Recycled-side2",
- };
-
- for (;;)
- {
- len = 64;
- rc = fread(buf, 1, len, fp);
- if (rc != len)
- {
- proff(curOff);
- if (buf[0] == '\033')
- {
- printf("\\033");
- fputs((char *) buf+1, stdout);
- }
- else
- fputs((char *) buf, stdout);
- printf("\n");
- return;
- }
- proff(curOff);
- printf("RECTYPE %c%c ", buf[1], buf[2]);
- curOff += len;
- if (0) {}
- else if (buf[1] == 'J' && buf[2] == 'P')
- {
- printf("[Job Parameters]\n");
- hexdump(stdout, "", "", buf, len);
- }
- else if (buf[1] == 'P' && buf[2] == 'S')
- {
- printf("[Page Start]\n");
- hexdump(stdout, "", "", buf, len);
- w = getLEdword(&buf[4]);
- h = getLEdword(&buf[8]);
- res = getLEword(&buf[24]);
- papersize = buf[20];
- mediatype = buf[21];
- color = buf[22];
- printf("\t\tw,h=%dx%d res=%d color=%d\n",
- w, h, res, color);
- printf("\t\tmediatype=%s(%d) papersize=%s(%d)\n",
- STRARY(mediatype, strtype), mediatype,
- STRARY(papersize, strsize), papersize);
-
- for (p = 0; p < 4; ++p)
- {
- // offsets at 26, 30, 34, 38
- offbih[p] = getLEdword(&buf[26 + p*4]);
- }
-
- len = getLEdword(&buf[16]);
- rc = fread(buf, 1, len, fp);
- if (rc != len)
- {
- error(1, "len=%d, but EOF on file\n");
- }
- if (Debug > 2) hexdump(stdout, "", "", buf, len);
- if (color == 1)
- {
- proff(curOff);
- printf("Cyan BIH:\n");
- print_bih(buf);
- printf("\t\t...cyan data skipped...\n");
-
- proff(curOff + offbih[0]);
- printf("Magenta BIH:\n");
- print_bih(buf + offbih[0]);
- printf("\t\t...magenta data skipped...\n");
-
- proff(curOff + offbih[0] + offbih[1]);
- printf("Yellow BIH:\n");
- print_bih(buf + offbih[0] + offbih[1]);
- printf("\t\t...yellow data skipped...\n");
-
- proff(curOff + offbih[0] + offbih[1] + offbih[2]);
- printf("Black BIH:\n");
- print_bih(buf + offbih[0] + offbih[1] + offbih[2]);
- printf("\t\t...black data skipped...\n");
- }
- else
- {
- proff(curOff);
- printf("Black BIH:\n");
- // hexdump(stdout, "", "", &bih[0], 20);
- print_bih(buf);
- printf("\t\t...black data skipped...\n");
- }
- curOff += len;
- }
- else if (buf[1] == 'P' && buf[2] == 'E')
- {
- printf("[Page End]\n");
- hexdump(stdout, "", "", buf, len);
- }
- else
- {
- printf("[Unknown]\n");
- hexdump(stdout, "", "", buf, len);
- }
- }
-}
-
-void
decode(FILE *fp)
{
int c;
@@ -583,7 +685,7 @@ decode(FILE *fp)
printf("Continuing with hexdump...\n");
ungetc(rectype, fp);
if ( (len = fread(buf, 1, sizeof(buf), fp)) )
- hexdump(stdout, "", "", buf, len);
+ hexdump(stdout, 0, "", "", buf, len);
exit(1);
}
break;
diff --git a/printer-profile.1in b/printer-profile.1in
index 9dbea19..95ad21a 100644
--- a/printer-profile.1in
+++ b/printer-profile.1in
@@ -18,6 +18,7 @@ computes an ICM profile using the Argyll Color Management System.
Manuf is "sam". Model is "clp-300" or "clp-315".
Manuf is "hp". Model is "2600" or "cp1215".
Manuf is "km". Model is "2300" or "2530".
+ Manuf is "dell". Model is "1355".
"rgb" is the usual setting. "patches" is a multiple 196 per page.
diff --git a/printer-profile.sh b/printer-profile.sh
index 5a1b268..4c429f0 100755
--- a/printer-profile.sh
+++ b/printer-profile.sh
@@ -17,6 +17,7 @@ DESCRIPTION
Manuf is "sam". Model is "clp-300" or "clp-315".
Manuf is "hp". Model is "2600" or "cp1215" or "cp1025".
Manuf is "km". Model is "1600" or "2300" or "2530".
+ Manuf is "dell". Model is "1355".
"rgb" is the usual setting. "patches" is a multiple 196 per page.
@@ -224,6 +225,19 @@ hp*)
;;
esac
;;
+dell*)
+ MANUF=dell
+ case "$MODEL" in
+ *1355*)
+ FOO=foo2hbpl2
+ WRAPPER="foo2hbpl2-wrapper $RES_r -c -C10 -Gnone.icm"
+ OUT="nc 192.168.178.41 9100 < xxx.prn"
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ ;;
*)
usage
;;