Printing from Caché Terminal - is there any way to send bold characters to the Windows default printer?
I'm converting a DTM system to Caché and trying to use the Caché Terminal as the UI. I've come across and removed some DTM formatting for printed text that does not do anything in Caché (actually, it caused errors). The printed output to the default Windows printer ("|PRN|") has been working and the printed documents in text-only format look fine. I am testing on a low-end HP laser printer and a Brother laser. The client has done a print test to his own older HP laser from his Caché instance and the text renders fine. Come to find out the client needs the bolding of certain text within printed output (not the entire document - certain words). This would be the only format change to the printed text. I cannot find a way to accomplish the limited bolding and send it to the printer. Any ideas? And if you might ask why I didn't address potential formatting issues in my requirements notes, well, that would be the same question I'm currently asking myself.
Thanks for any suggestions.
John
Hi John,
I think you can do it using mnemonics:
Probably the printer will not understand this, but you can define another mnemonic for the printer, sending the correct escape sequence to it
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_intro#GIOD_intro_definemnemomic
and then use the |PRN| device with your mnemonic:
For example, if printer is PCL you should send:
Hi
I am not sure if this will work for you, I can make a word bold by adding the terminal escape sequence $C(27)_"[1m"
W $C(27)_"[0m"_"This is not bold. "_$C(27)_"[1m"_" This is bold."_$C(27)_"[0m"_" This is not bold again. "_$C(27)_"[4m"_" This is underscore."_$C(27)_"[0m"
I hope it helps
Stelios
Thanks to Manel Trèmols and Stylianos Chalkiotis. This does not work. I can get bolding to work in a terminal emulator like PuTTy, but when I send to the default Windows printer, "|PRN|", the characters that are used to indicate bolding come through as those characters. Nothing is bold. A friend and former colleague with decades of MUMPS and Caché experience said this: "It almost sounds like the BOLD/Not BOLD stuff was probably a custom macro of some kind in DTM that permitted this capability. If you can look into what DTM does when it sees the BOLD command; there must be something for it to interpret it. You may need to tweak the SMP setting to get this to work." If anyone reading this knows the "trick" that DTM did to pass BOLD/NOT BOLD, please let me know.
Thanks.
There is no default %PCL.int as mnemonics for PCL printing in Caché.
So according to the link
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_intro#GIOD_intro_definemnemomic
you have to write it yourself.
But before this interesting exercise find a document on the control codes for your "low-end HP laser printer and a Brother laser"
Your description is just to vague to google for it. you depend on the type an level of PCL.
I tried and got 2.46 million hits on bold printing for Brother Laser.
This one looked useful but I didn't read all 531 pages and I don't know your printer version.
https://www.brother.com.au/pdf/support/controlcodes/PCL_Tech_Manual.pdf
This looked most useful:
Esc(s#B (27)(40)(115)#(66) <1Bh><28h><73h>#<42h>
This command designates the stroke weight of the primary font.
Esc)s#B (27)(41)(115)#(66) <1Bh><29h><73h>#<42h>
This command designates the stroke weight of the secondary font
# is an integer between –7 and 7. A value of 0 signifies a medium stroke weight, negative numbers signify
thin or light stroke weights and positive numbers signify bold stroke weights.
If you select a light or bold stroke weight the command will only have an effect if the font is available in one of the three font locations.
that means you should try first if your printer is covered:
set bold2on=$c(27,41,115)_7_$c(66)
set bold1off=$c(27,40,115)_0_$c(66)
set bold2off=$c(27,41,115)_0_$c(66)
;; let's test it
open prt use prt write #
write !,"test1 " , bold1on, "text with bold1on ", bold1off, "text with bold1off",!
write !,"test2 " , bold2on, "text with bold2on ", bold2off, "text with bold12off",!
write # close prt
from the description, it is not clear if 7 and 0 are characters or if this are binaries.
you may need to replace it with $c(7) and $c(0).
once you know the codes you may decide how to make use of it.
Hi John,
My sample was using PCL but I don't know what printer are you using.
First thing should be to know what escape sequence do you need to send to the printer for to get bold.
Escape sequences are different if printer is HP, Epson, etc...
My suggestion is to check first doing an open printer, use printer, write escape sequence text, close printer if printer is doing bold.
After to get the correct escape sequence, you can write a mnemonic routine for to get bold in terminal, printer1, etc.. without change your code.
You will need different mnemonic routines for different printer types.
Hope this helps
Manel