Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to narrow the bar code?

How to narrow the bar code?

How to narrow the bar code?

Hi, I'm new with PCL. I'm printing in small labels and even though it's been scanned correctly, the user wants to have enough blank space before and after the bar code prints in each label. The font setting before the bar code print is:
I changed it to ¬(s0p04h07v24700T but it's still same wide, it only decreased the height. Can anyone help me?
This is the complete esc sequence I have before the field bar code is printed: ¬(9Y¬&a124C¬(s0p06h09v24700T
where ¬ is the escape key.


RE: How to narrow the bar code?

You should be increasing the value before the "h" to get a smaller barcode. Of course we are assuming that it is a scalable font.

Print out a typeface list to see what is available and the appropriate PCL code to print it.

Is this a soft font or a font DIMM?

Jim Asman

RE: How to narrow the bar code?

BTW the "h" and the "v" are conflicting parameters.  The value for "h" is the characters/inch, the value for "v" is the point size.  "h" is for a fixed-width font, such as Courier, signified by the "0p" (not proportional).  "v" would be used for a proportional font.  In any case, the actual font used, 24700T, is the key to your problem.  As jlasman posited, is it a scalable font?

RE: How to narrow the bar code?

No, the h and v are NOT necessarily conflicting. While what you say is generally true, sometimes BOTH are used to clarify the desired selection. Look at the "line printer" selection string in the PCL font list generated by a LaserJet that has the font internally.

Consider that a barcode at any given pitch may need to be printed taller or shorter depending on the requirement. If we only have the h to specify the size, then we have no way of selecting a different depth. This is why the v is needed in this case.

DansDad will explain, smile

Jim Asman

RE: How to narrow the bar code?

Thanks Jlasman and Webrabbit for taking time to discuss my question. As I said before, I am totaly new with PCL. I'm working with CICS and need to print in very small labels. Yes Jim you are right, the value before the h determines how tall the bar displays. I tried that before. Yet, my problem is how to print the bar code field in a narrower space. I need to condense it. I will try tomorrow by playing with the value in front of the v. It won't print in a particular printer, but in diferent HP Laser Jets that will have a special chip adapted. I guess that's the DIMM right?

RE: How to narrow the bar code?

No, the value before the "h" determines the width or the pitch as we call it; i.e., how many characters per inch.

What printer are you using? Is the font built in, or is it a downloaded soft font?

Understand that the PCL string you are sending to the printer is a font SELECTION string. It in no way creates the font but simply tells the printer what you want. If the desired font is available that is what you will get; otherwise, the printer will substitute according to predefined priorities.

If there is not a suitable narrower barcode available, then there is NO PCL code that is going to help.

What barcode symbology is this?

Jim Asman

RE: How to narrow the bar code?

jlasman, I was not aware that PCL supported variable aspect ratios.  I know that Postscript does, I have written code to use computed aspect ratios in that language.  From area4486's decription of what happened to the barcode, I would guess that perhaps the font does support a variable aspect ratio.  Your suggestion of increasing the h value should then work.

RE: How to narrow the bar code?

It isn't working Webrabbit, but the problem resides in my environment. I am new around here and learned that someone else was trying to condense the bar code and they couldn't. Jim I'm printing my test document in an HP LJ 4050, yet this document will print in a variety of 4 or 5 printers (all of them HP LJ) which have dapted with a chip to print bar coded labels, so I guess that's the DIMM... If I find my way to make it work, I'll let you guys know. I'm having fun here trying to make it work! Thanks a lot.

RE: How to narrow the bar code?

Do you know what type of barcode it is?  UPC, Code39, etc.?

RE: How to narrow the bar code?

To find out which type of font you have available, do as Jim suggested, and print a PCL Typeface List from (one or more of) the target printer(s).

How to do this will vary slightly from device to device: many LaserJet printers have front panel menu systems via which such a printout can be initiated (usually via a 'Test' or 'Information' menu).

The printout should show which fonts are available, and should distinguish between 'locations': ROM-resident, DIMM fonts and downloaded soft fonts.

For each font, the list should show a 'skeleton' of the required font selection sequence.

If the indicated sequence shows SPECIFIC 'h' (pitch) AND 'v' (height) values, then the font is a fixed-pitch bitmap font, and is available only in the one size suggested by the given values; I'd expect the 'p' (spacing) value to be 0 (fixed-pitch).

If the sequence shows a SPECIFIC 'v' (height) value, then the font is almost certainly a proportionally-spaced bitmap font, and is again available only in the one size suggested by the given value; I'd expect the 'p' (spacing) value to be 1 (proportionally-spaced).

Otherwise, if the 'h' or 'v' value is represented by a 'placeholder' shaded box, this indicates that the font is scalable:
- if the 'p' (spacing) value is 0 (fixed-pitch), then the list should show that an 'h' (pitch) value (in characters-per-inch units) is appropriate;
- if the 'p' (spacing) value is 1 (proportionally-spaced), then the list should show that a 'v' (height) value (in (1/72 inch) point units) is appropriate.

The font selection sequence ({esc}(9Y{esc}&a124C{esc}(s0p06h09v24700T), which was originally quoted, implies that the font is a bitmap font - and is hence only available in that one size; the {esc}&a124C part is for horizontal cursor-positioning, and nothing to do with font selection.

IF the font IS scalable, then you will be able to select different sizes using 'h' or 'v' values (depending on whether the font is fixed-pitch or proportionally-spaced); any supplied, but non-relevant 'h' or 'v' value (as appropriate) will be stored in the printer's font select table, but otherwise ignored.

You may find that changing the size of a scalable font results in a barcode which is the required width, but is not tall enough; in this case, just repeat the data after adjusting the cursor position to the same horizontal value, but a larger vertical value.

As regards the comment about aspect ratios: you cannot vary the aspect ratio of a PCL5 font.

As webrabbit indicates, you can vary text aspect ratios with PostScript (but then PostScript is quite complex and powerful: more like a procedural programming language).

PCL6 also allows different 'scale' values to be set for vertical and horizontal scaling of text characters; but I wouldn't advise that you think of using this language unless you want to totally rewrite your print application.  

RE: How to narrow the bar code?

Hi all, I stopped playing with 'h' and 'v' since it wasn't giving me the results I was looking for. Jim you had a point, I'm using DIMM. I checked a DIMM manual and they use different parameters to modify non human readable text (bars).
This is the explanation I found:
A valid PCL escape sequence to select a barcode is like the following:
24670T Symbology: code 39, not encoding spaces before/after data
4p Readable text below bars, without start/stop chars(*)
102h Caption text in Univers Regular
40v Bars height: 40 points 40/72=0.555 inches
40*2.54/72=1.41 cm
10,30b Thin bars are 10 dots wide, thick bars are 30 dots wide
10,30s Thin spaces are 10 dots wide, thick spaces are 30 dots wide
Of course I'm not using code 39, I am using 24700T symbology (which I still don't know how it is technically called, and I had to adjust the bars and white spaces to my own convenience.
Thank you DansDadUK, Jim, and Webrabbit for your help.  

RE: How to narrow the bar code?

The quoted sequence is NOT valid PCL, so it must be some sort of proprietary extension, understood only by your special DIMM chips.

A full standard PCL5 font selection sequence, for the primary font, is of the following format:


ID is the symbol set identifier (e.g. 0N, 19U,9Y)
#p indicates fixed or proportional Spacing
#h#v selects required Pitch and/or Height (as explained earlier)
#s indicates required Style (0=Upright; 1=Italic; etc.)
#b indicates required Stroke Weight (0=Regular; 3=Bold; etc.)
#T indicates required Typeface identifier.

The printer attempts to match the supplied characteristics to those of fonts it has resident (on ROM, DIMM, etc,) and chooses the one with the closest match; the characteristics have a priority order (as indicated in the above skeleton) although they don't have to be supplied in that order.

RE: How to narrow the bar code?

The sequence DansDad explains is working for me when I want to print human readable text e.g. "Bank Name: XYZ" Now, to print the customer account number as scanner readable text(or bar code), I have to use #,#b#,#s for bars and whites width -at least with this chip-. Yes you may be right, it must be an extension just for DIMMs.

Jim I tried the 4p, and the efect is as follows:
If the report prints the value '987654321' in bar code, then underneath the bars it will print the human readable text '987654321'.

RE: How to narrow the bar code?

Normally, the "p" parameter value is only one (1) or zero (0).  You are saying that for that particulare barcode, a value of 4 for this parameter means to print the human readable text underneath the bars.  That sort of makes sense.  

As for


#,#b#,#s for bars and whites
I don't understand what you mean.  Is this the barcode font which allows the human readable text underneath, or is it something else?

RE: How to narrow the bar code?

Remember that my initial question was how to narrow the bars.
Well, #,#b#,#s for bars and whites means what I quoted above:
#,#b as in
10,30b Thin bars are 10 dots wide, thick bars are 30 dots wide
10,30s Thin spaces are 10 dots wide, thick spaces are 30 dots wide
That's how we should manipulate the width of bars and white spaces in between bars until we get the width we want and also have them print sharp enough to be readable to the scanner.

RE: How to narrow the bar code?

Where does this code fit in.  Is it the "printed" data?

RE: How to narrow the bar code?

That's the data I need to present in bar code. I place it right before the field.

RE: How to narrow the bar code?

Instead of 10 & 30, try something like 7 & 21.  From your discription, that just might do the trick.

RE: How to narrow the bar code?

I'm done with this project already. Anyway, yes the 10 and 30 were modified in order to print the bars in a proportional scale (my labels are very small). Thanks all for helping.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close