Hi All,
Visual Basic Code printing bold text direct on the printer.
I am using the Open file command in visual basic to print text direct on the printer.
Here’s the sample code
Open “LPT1” for output as #1
Print #1, “This was sent to printer”
Close #1
The program works but I want it in bold. I am using EPSON LX-300 dot matrix printer.
Please help! I need this to print a receipt.
I don’t want to use the printer control.
Visual Basic Code printing bold text direct on the printer.
Visual Basic Code printing bold text direct on the printer.
This will be done through the escape Code sequence set by the printer manufacture. You must have a copy or manual of your printer for you to know the escape code sequence supported by your printer.
Dot matrix printers vary on codes when it comes to escape code sequence.
I have some copy of codes here for NLQ printer’s version and I tried this codes works on EPSON dot matrix printers.
Here’s how:
Printer Escape Code:
[Esc]!char(n)
[Esc] = char(27)
Where n,
0 = PICA mode
1 = Elite mode
4 = condensed mode
8 = emphasized mode
16 = double strike mode (bold)
17 = ELITE/double strike mode
20 = condensed/double strike
24 = emphasized/double strike mode
32 = enlarge mode
33 = ELITE/enlarge mode
36 = condensed/enlarge mode
40 = emphasized/enlarge mode
48 = double strike/enlarge
49 = ELITE/double strike/enlarged
52 = condense./double strike./enlarge
56 = emphasized./double strike./enlarge
To apply the command in your code:
Open “LPT1” for output as #1
Print #1, “This was sent to printer – normal”
Print #1, chr(27) & “!” & chr(16) & “This was sent to printer – bold” & chr(27) & “!” & chr(0)
Close #1
The code chr(27) & “!” & chr(16) = set the printer to double strike mode or bold.
The code chr(27) & “!” & chr(0) = set the printer to pica mode (normal mode).