Skip to content

Import Dave Coffin's HBPL1v1 code (and a few extras)#21

Open
JoesCat wants to merge 12 commits into
OpenPrinting:main-fixesfrom
JoesCat:hbpl1
Open

Import Dave Coffin's HBPL1v1 code (and a few extras)#21
JoesCat wants to merge 12 commits into
OpenPrinting:main-fixesfrom
JoesCat:hbpl1

Conversation

@JoesCat

@JoesCat JoesCat commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

At this point, there is still more to fix and add, but it is a start with issue #2 .

I'm looking at MediaCodes, and comparing the David's 2014 code

char *mname[13] = { //Known media types
	"",
	"NORMAL",		// 1=plain paper
	"THICK",		// 2=thick paper
	"HIGHQUALITY",		// 3=high quality paper
	"COAT2",		// 4=coated paper
	"LABEL",		// 5=label
	"ENVELOPE",		// 6=envelope
	"RECYCLED",		// 7=recycled
	"NORMALREV",		// 8=plain paper (reverse-side)
	"THICKSIDE2",		// 9=thick paper (reverse-side)
	"HIGHQUALITYREV",	// 10=high quality paper (reverse-side)
	"COATEDPAPER2REV",	// 11=coated paper (reverse-side)
	"RECYCLEREV"		// 12=recycled (reverse-side)
};

it appears we are looking at 2 classes of printers, where the 2nd class printer has...

{
	"",
	"NORMAL",		// 1=plain paper
	"NORMALREV",		// 8=plain paper (reverse-side)
	"HIGHQUALITY",		// 3=high quality paper
	"HIGHQUALITYREV",	// 10=high quality paper (reverse-side)
	"RECYCLE",		// 7=recycled
	"RECYCLEREV",		// 12=recycled (reverse-side)
	"LABEL",		// 5=label
	"THICK",		// 2=thick paper
	"THICKSIDE2",		// 9=thick paper (reverse-side)
	"COATEDPAPER2",		// 4=coated paper
	"COATEDPAPER2REV",	// 11=coated paper (reverse-side)
	"LETTERHEAD",
	"LETTERHEADREV",
	"PREPRINTED",
	"PREPRINTEDREV",
	"PREPUNCHED",
	"PREPUNCHEDREV",
	"COLOR",
	"COLORREV",
	"USER1",
	"USER1REV",
	"SPECIAL",
	"SPECIALREV",
	"ENVELOPE"		// 6=envelope
};

It may mean needing to create something similar to -z0 -z1 used with foo2zjs

@ValdikSS - Question to ask:

  • Should I continue adding to this pull request? (there is still more to add)
  • Should I separate these patches into individual Pull Requests?
  • Stop here? (as you may have other direction to follow)

JoesCat and others added 11 commits July 6, 2026 14:11
Merge hbpl1 parts of Dave Coffin's hbpl1.patch (located here):
https://web.archive.org/web/20160515134331/http://cybercom.net/~dcoffin/hbpl/hbpl1.patch
to current 2026jul5 foo2zjs

NOTE: Edits required on several files to sync-up to current code base.
Doing comparisons between 2014 files versus 2026 files similar to
hbpl1/hbpl2 added similar edits to hbpl1 files to get them closer
for general use.

NOTE: More edits are still required on several files.
Seeing my printer not supported for the last decade, and then seeing this:
"Works with Xerox Phaser 6010N OpenPrinting#6"
mikerr/foo2zjs#6
Got me interested in looking at adding HBPLv1.

Cloned Dell C1760, and then fetched data points from old PPD files.
e.g. -p1 which are then being picked up as an invalid paper size
In cups error_log manifesting as:
foo2hbpl1-wrapper: Unimplemented paper code 1

Have amended foo2hbpl1-wrapper.in to intepret paper sizes
paper parameters are also now being interpreted.
This has fixed for a Dell 1660w printer, running on Ubuntu 18.04

Import Shinbar's fix for paper_size cups error_log as seen here:
https://github.com/Shinbar/foo2zjs/commits/shinbar/dev2020/papersize/
Initially found here: OpenPrinting#2
Import Shinbar's fix for paper_size cups error_log as seen here:
https://github.com/Shinbar/foo2zjs/commits/shinbar/dev2020/papersize/
Initially found here: OpenPrinting#2
Import Shinbar's fix for paper_size cups error_log as seen here:
https://github.com/Shinbar/foo2zjs/commits/shinbar/dev2020/papersize/
Initially found here: OpenPrinting#2
Helps a little with debugging.
All the info in *mname[] is static and therefore also threadsafe,
but it will be useful to access for debugging "-D[1+]" in future.
Looking at the original HBPL1 codes from 2014 and a more recent
version it looks like we need to add an expanded class of media
codes with two codes that changed wording (COAT2, RECYCLED).

To resolve the two code sets, added a -z1 option.

Both mname[MediaCode+1] sets appear to work on the Xerox 6010N,
but don't see if there is an actual difference for codes 1..24.
mname[MediaCodes+1] appear okay on Ubuntu 26.04 FireFox for the
6010N. Many files still need upgrading. Testing was done using:
gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=letter \
  -r600x600 -sDEVICE=pamcmyk32 -sOutputFile=- - \
   <testpage.ps >testpage.za
./foo2hbpl1 -m1 -p0  <testpage.za >testpage.zm
./hbpldecode testpage.zm
cat testpage.zm > /dev/tcp/printer_IP_address/9100
Easier to see '-' vs 'na' (used by foo2hiperc*.1 vs foo2zjs*.1)
Don't know if -z0 printers can handle or understand RESET
so this was limited to -z1 or higher versions ./foo2hbpl1
Copies works, but don't know about older -z0 printers, therefore left
them as-is using a manual copy method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants