USPS imb barcode for HP laser printer on linux needed

I need to be able to print the USPS intelligent mail barcode (IMB) using a laser printer and PCL commands. My software generates text files with embedded commands for the laser printer. I am looking for information to add the font as a soft font. I print using CUPS, and have the printer defined as raw.
LVL 1
penguins_ruleAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DansDadUKCommented:
PCL soft fonts come in a number of different formats:
format 0 - bitmap (deprecated)
format 10 - Intellifont scalable bound
format 11 -  Intellifont scalable unbound
format 15 - TrueType scalable
format 16 - Universal
format 20 - resolution-specified bitmap

With the bitmap formats, you can probably 'hand-craft' the required font (but you'll need a separate font for each required size).

The Intellifont formats are little used these days (and there is very little documentation available about them), so I'd ignore these.

The Universal format is (more-or-less) like the TrueType format, but can cater for larger fonts.

Generating PCL-format TrueType or Universal fonts is not a trivial process; note that they are not just copies of a standard TrueType display font.

If you have a Windows system (as well as your *n*x one), and a licensed copy of a TrueType version of your intelligent mail barcode font, you could use the Soft Font Generate tool in the (Windows-only) PCL Paraphernalia application, available via http://www.pclparaphernalia.eu to generate a format 15 or format 16 soft font, which your bespoke software could download to the printer when needed.
DansDadUKCommented:
... and for (some) technical documentation of the PCL soft font formats, the following link provides a brief history of the PCL language, and links to the PCL5 Technical Reference manual, and also to other PCL5 & PJL manuals:

http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=bpl04568

The PCL5 Technical Reference manual (Part 1) includes a chapter on PCL soft fonts; although it goes into quite some detail, there is insufficient information to allow you to generate anything other than the bitmap formats.
penguins_ruleAuthor Commented:
I pulled a file which has the HP PCL font: uspsFontsNonAFP-1.4.0.zip from the usps website (https://ribbs.usps.gov/onecodesolution/download.cfm).
I tried to cat the US23HP.FNT and my text file. The printer did not print anything at all.
The other thing I do not know is what data to use for the font? Do I use A F T D?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

DansDadUKCommented:
I'll have a look at the content of the .zip file you refer to in the morning (UK time-zone).
DansDadUKCommented:
Within the referenced .zip file, there are four PCL soft font files in the fonts\hp folder:
UC23HL.FNT - compact height 23 cpi PCL landscape
UC23HP.FNT - compact height 23 cpi PCL portrait
US23HL.FNT - standard height 23 cpi PCL landscape
US23HP.FNT - standard height 23 cpi PCL portrait

These four fonts are all PCL format 0 (bitmap), which has been a deprecated format since the advent of the LaserJet 4 printer (in the early 1990s); replacement formats are format 20 (resolution-specified bitmap) and format 16 (universal) (which can define both scaleable and bitmap fonts).
... and LaserJet 4 and later printers, there is no need for separate Landscape and Portrait fonts, since the printer automatically rotates fonts as required.

As you'll see from the attached analyses, all four files have a number of NUL (0x00) bytes at the end - these are completely superfluous (and will probably be ignored by LaserJet printers), but I've no idea why they've been included (perhaps just a bug in whatever generated them?).

The two 'compressed' variants start with a sequence which defines the font identifier (via which the font can subsequently be selected using the PCL 'select font by ID' escape sequence (<Esc>(#X)) as 30000.
The two 'standard' variants do not include any such sequence, so you'll have to add your own,

None of the font files includes a PCL 'make soft font permanent' escape sequence (<Esc>*c5F), without which the common PCL 'reset' escape sequences (<Esc>E) will delete the fonts.
 
As you've already surmised, the fonts contains only 4 characters, mapped to the code-points associated with the ASCII characters A, D, F and T; these glyphs define the Ascender, Descender, Full and Tracker bars.

You'll have to use the USPS Encoder (or equivalent) to convert the ASCII input address data into the correct sequence of these mini-characters.
The \bin, \src and \lib folders contain items which should help you to understand how to do this encoding in your operating system environment.
PCLFontAnalysis.zip

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DansDadUKCommented:
... and the prfiles\hp folder contains four 'print ready' PCL sample print jobs to demonstrate the four fonts.

The attached analyses show what these print jobs contain.

Note that each of them (as well as including the superfluous <NUL> bytes at the end of the font download sequence, also include an invalid PCL escape sequence which the printer will probably ignore.

I suspect that these sequences were supposed to select the required font height - but this is (fortunately) irrelevant, since  (in each case) the required fixed-size (bitmap) font has just been selected via its download font identifier.
PCLsamplesPR.zip
penguins_ruleAuthor Commented:
In the US23P file, the invalid PCL sequence should have been <Esc>(s10.5V  to select the proper font.
Also, as you pointed out, the font-id is 30000.
DansDadUKCommented:
>> ... In the US23P file, the invalid PCL sequence should have been <Esc>(s10.5V  to select the proper font ...

You are correct in your assumption of the likely correct value of the invalid PCL sequence.
But it is superfluous anyway in this context, since the (non scaleable) bitmap font (of a fixed size) has already been selected via its download identifier.


>> ... the font-id is 30000 ...

The font identifier used in the font ID sequence (<Esc>*c#D) can be any value you want it to be, within the range  0 - 32767; you just have to make sure that when you want to select it by identifier (using the select font by ID sequence (<Esc>(c#X or <Esc>)c#X)), rather than via characteristics, that you use the same identifier.
penguins_ruleAuthor Commented:
i was not able to get the soft font to load onto the laser printer.
I found a product from Typehaus BarCodeJet which may have the capability i am seeking.
DansDadUKCommented:
>> ... i was not able to get the soft font to load onto the laser printer ...

Not really sure just what problem you may have had here.

I sent the content of each of the four 'print ready' PCL sample print job files direct to the port of my LaserJet 1320n printer, and they all appeared to print OK (with sample bar-code), which seems to verify that the embedded soft font files are valid.

I think (not sure) that with some modern LaserJet printers, it may be the case that downloaded soft fonts (even if set 'permanent') are discarded when the device goes into 'sleep' mode, so you can't necessarily 'load' the font at start of day, and expect to use it later.
... and even 'permanent' soft fonts have always been deleted if the printer is powered off, or if certain PCL 'font handling' escape sequences are received by the device.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Printers and Scanners

From novice to tech pro — start learning today.