Bill Golden
asked on
Modifying a PCL Control String
I have a DOS-based program that sends the following two strings to the printer depending on the report being printed:
NORMAL---024 27 38 108 55 46 52 67 27 38 97 54 76 27 40 115 49 51 72 27 38 107 49 49 72
CONDENSE-027 27 38 108 55 46 52 67 27 38 97 53 76 27 40 115 49 54 46 54 72 27 38 107 54 46 56 72
I want the change the regular Courier font that is selected by the string to the Courier Bold font.
(At the time, the programmer did not understand how to invoke anything but the two standard Courier fonts which I believe are Courier 10 (regular) and Courier 16.66 (small). So, one of the strings also slightly condenses the Courier 10 spacing. Any help to change that function to a slightly smaller text, which I think is possible, would be helpful as well.
(If you have an idea about the second part, I'll ask it in a separate question.)
NORMAL---024 27 38 108 55 46 52 67 27 38 97 54 76 27 40 115 49 51 72 27 38 107 49 49 72
CONDENSE-027 27 38 108 55 46 52 67 27 38 97 53 76 27 40 115 49 54 46 54 72 27 38 107 54 46 56 72
I want the change the regular Courier font that is selected by the string to the Courier Bold font.
(At the time, the programmer did not understand how to invoke anything but the two standard Courier fonts which I believe are Courier 10 (regular) and Courier 16.66 (small). So, one of the strings also slightly condenses the Courier 10 spacing. Any help to change that function to a slightly smaller text, which I think is possible, would be helpful as well.
(If you have an idea about the second part, I'll ask it in a separate question.)
The PCL snippets translate as follows (assuming that I've managed to transcribe your decimal codes correctly):
Decimal codes from NORMAL---024:
Decimal codes from NORMAL---024:
27 38 108 55 46 52 67 27 38 97 54 76 27 40 115 49 51 72 27 38 107 49 49 72
PCL:<Esc>&l7.4C Vertical Motion Index (7.4/48 inches)
<Esc>&a6L Left Margin (column 6)
<Esc>(s13H Primary Font: Pitch (13 characters per inch)
<Esc>&k11H Horizontal Motion Index (11/120 inches)
Decimal codes from CONDENSE-027:27 38 108 55 46 52 67 27 38 97 53 76 27 40 115 49 54 46 54 72 27 38 107 54 46 56 72
PCL:<Esc>&l7.4C Vertical Motion Index (7.4/48 inches)
<Esc>&a5L Left Margin (column 5)
<Esc>(s16.6H Primary Font: Pitch (16.6 characters per inch)
<Esc>&k6.8H Horizontal Motion Index (6.8/120 inches)
A few comments:
The decimal codes 51 and 54 are not setting the font stroke weight (i.e. they are not selecting Bold or Extra Black).
The Left Margin sequences set the left margin in terms of columns; the width of each column is set to whatever is the current Horizontal Motion Index (HMI) value.
The current HMI value will either be the default value set on the printer itself, or as a result of a previous font select or set HMI sequence in the current session.
The select (primary) font pitch sequences will select a font with the requested size (in terms of character-per-inch), but only if the current font is a fixed-pitch font.
They will also set the current HMI to that pitch value.
They will also set the current HMI to that pitch value.
The current font value will either be the default value set on the printer itself, or as a result of a previous font select sequence in the current session.
Most LaserJet printers only provide three fixed-pitch fonts: Courier and Letter Gothic (which are both scalable fonts) and Line Printer (which is a bitmap font, only available in one fixed size).
The set HMI sequences (re-)set the current HMI.
The select (primary) font pitch sequences are only part of a full font selection sequence set; I'll provide examples of full sets in the next post.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
DansDadUK,
I hate to admit it but I was around when this program was rewritten in the late 80s and sort of remember the teeth gnashing that went into this printer string. Part of the problem was writing a printer string which would work on all the early LaserJets. (Of course this is no longer an issue.)
Secondly, we are using fixed fonts since this program prints financial statements and other columnar documents.
So, if I understand the sequencing order, I would use your example string (modified for stroke weight) in lieu of the 27 40 115 49 51 72 string currently being used?
I hate to admit it but I was around when this program was rewritten in the late 80s and sort of remember the teeth gnashing that went into this printer string. Part of the problem was writing a printer string which would work on all the early LaserJets. (Of course this is no longer an issue.)
Secondly, we are using fixed fonts since this program prints financial statements and other columnar documents.
So, if I understand the sequencing order, I would use your example string (modified for stroke weight) in lieu of the 27 40 115 49 51 72 string currently being used?
Yes, although you may want to change the settings (Example 2 selects the Courier Bold font with a size of 18 cpi, using the ISO-8859-1 encoding) if that isn't exactly what you want.
And you may want to move the Left Margin sequence to follow the font select and set HMI sequences, rather than before them - that rather depends on what width you want each of the 'left margin' columns to be.
Or you could instead insert an additional 'set HMI' sequence (with an appropriate value) in front of the 'Left Margin' sequence, in order to define a column-width before setting the margin.
And you may want to move the Left Margin sequence to follow the font select and set HMI sequences, rather than before them - that rather depends on what width you want each of the 'left margin' columns to be.
Or you could instead insert an additional 'set HMI' sequence (with an appropriate value) in front of the 'Left Margin' sequence, in order to define a column-width before setting the margin.
>> ... we are using fixed fonts ...
But if a full font selection sequence (as per my examples) is not included in the sequences sent to the printer, you are relying on the default font set via the printer's front panel menus (or equivalent) - and what's to stop someone changing that?
>> ... Of course this is no longer an issue ...
The cheaper (host-based) LaserJet printers don't understand PCL (or even plain ASCII) so be aware of the capabilities of your target devices.
>> ... I hate to admit it but I was around when this program was rewritten in the late 80s ...
My computer knowledge started in July 1970.
But if a full font selection sequence (as per my examples) is not included in the sequences sent to the printer, you are relying on the default font set via the printer's front panel menus (or equivalent) - and what's to stop someone changing that?
>> ... Of course this is no longer an issue ...
The cheaper (host-based) LaserJet printers don't understand PCL (or even plain ASCII) so be aware of the capabilities of your target devices.
>> ... I hate to admit it but I was around when this program was rewritten in the late 80s ...
My computer knowledge started in July 1970.
Have you had any success with the modified sequences?
ASKER
Modifying the control string inside of one of the output files caused the program to die on startup. So I resorted to modifying the string in the source code and recompiling the program. Unfortunately someone had failed to transfer the compiler to any of the new workstations and we had to find a backup copy. I'm hoping the backup contains the latest CMNs files. (It is a big program, about 55,000 lines in two dozen overlays, written in CB80. The compiler doesn't want to run on a Windows 7 machine because it needs FCBS and I'm not sure of the proper syntax on a Win7 platform - and if I remember correctly wants to compile only on a FAT32 hard drive.) I have an older XP machine at home and will setup a D drive for the source code which I have and run the compiler on C which is the environment the compiler want to run in.
Hoping to try it out this weekend.
Hoping to try it out this weekend.
Good luck!
ASKER
Found the compiler and got the FCBS command working. I finally located the printer selection string in the source code.
Looks like I'm going to need more help.
What follows is the source code in the compiler that creates the HEX strings:
^[&l7.4C^[&a6L^[(s10H^[&k1 1H>
^[&l7.4C^[&a5L^[(s16.6H^[& k6.8H
I am a little confused as to how to proceed!
Looks like I'm going to need more help.
What follows is the source code in the compiler that creates the HEX strings:
^[&l7.4C^[&a6L^[(s10H^[&k1
^[&l7.4C^[&a5L^[(s16.6H^[&
I am a little confused as to how to proceed!
ASKER
I had the wrong lines of code. It should be...
^[&l7.4C^[&a6L^[(s13H^[&k1 1H>
^[&l7.4C^[&a5L^[(s16.6H^[& k6.8H
^[&l7.4C^[&a6L^[(s13H^[&k1
^[&l7.4C^[&a5L^[(s16.6H^[&
On the (reasonable) assumption that ^[ is your editor's method of displaying the non-graphic Escape control-code character (the character with decimal code 27, or hexadecimal 1B), your sequences translate as follows:
The last character (>) in sequences 1 and 3 is a text character.
<Esc>&l7.4C Vertical Motion Index (7.4/48 inches)
<Esc>&a6L Left Margin (column 6)
<Esc>(s10H Primary Font: Pitch (10 characters per inch)
<Esc>&k11H Horizontal Motion Index (11/120 inches)
>
<Esc>&l7.4C Vertical Motion Index (7.4/48 inches)
<Esc>&a5L Left Margin (column 5)
<Esc>(s16.6H Primary Font: Pitch (16.6 characters per inch)
<Esc>&k6.8H Horizontal Motion Index (6.8/120 inches)
<Esc>&l7.4C Vertical Motion Index (7.4/48 inches)
<Esc>&a6L Left Margin (column 6)
<Esc>(s13H Primary Font: Pitch (13 characters per inch)
<Esc>&k11H Horizontal Motion Index (11/120 inches)
>
<Esc>&l7.4C Vertical Motion Index (7.4/48 inches)
<Esc>&a5L Left Margin (column 5)
<Esc>(s16.6H Primary Font: Pitch (16.6 characters per inch)
<Esc>&k6.8H Horizontal Motion Index (6.8/120 inches)
The last character (>) in sequences 1 and 3 is a text character.
... and you can do your own decodes (if you have a modern Windows system) using the PRN File Analyse tool in the free PCL Paraphernalia application, available via http://www.pclparaphernalia.eu ; the companion Print Languages tool provides lists of PCL escape sequences if you just want to look up the name of a sequence manually.
... and the following link provides a brief history of the PCL language, and links to the PCL Technical Reference manual, and also to other PCL5 & PJL manuals:
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=bpl04568
Be aware that some of the manuals (in PDF format) are multi-megabyte downloads.
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=bpl04568
Be aware that some of the manuals (in PDF format) are multi-megabyte downloads.
Have you had any success, or do you need more specific advice?
Or are you still making your way through the referenced manuals and tools?
Or are you still making your way through the referenced manuals and tools?
ASKER
I think I am going to need more specific advice.
>> I think I am going to need more specific advice
Just what is it that you don't understand about the previous advice?
>> ... I want the change the regular Courier font that is selected by the string to the
>> Courier Bold font. ...
So, in your source code, just change the string:
^[&l7.4C^[&a6L^[(s13H^[&k1 1H
to
^[&l7.4C^[&a6L^[(s0p13h0s3 b4099T^[&k 11H
I've not included the 'select symbol set' part of the font selection, on the assumption that you're only printing plain ASCII text, but you may need to specify one (to over-ride the default set on the printer, or elsewhere) if you are using extended-ASCII characters, or have problems with currency symbols, etc.
Just what is it that you don't understand about the previous advice?
>> ... I want the change the regular Courier font that is selected by the string to the
>> Courier Bold font. ...
So, in your source code, just change the string:
^[&l7.4C^[&a6L^[(s13H^[&k1
to
^[&l7.4C^[&a6L^[(s0p13h0s3
I've not included the 'select symbol set' part of the font selection, on the assumption that you're only printing plain ASCII text, but you may need to specify one (to over-ride the default set on the printer, or elsewhere) if you are using extended-ASCII characters, or have problems with currency symbols, etc.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=bpl02705
Scroll to the bottom and try different codes for Style, Stroke weight and Typeface.
Your string seems to be specific for your printer, so it would help if you tell which printer you have. But you may try changing these values:
NORMAL---024 27 38 108 55 46 52 67 27 38 97 54 76 27 40 115 49 51 72 27 38 107 49 49 72
51 = BOLD
CONDENSE-027 27 38 108 55 46 52 67 27 38 97 53 76 27 40 115 49 54 46 54 72 27 38 107 54 46 56 72
54 = Extra Black