Tuesday, January 31, 2012

Printing Directly to LPT port

'Open the port

Open "LPT1" For Output As #1

'Once opened, you can print directly to it
Print #1, "Your text"

'then, you have to close the port:

Close #1

for printing italics, bolds, etc, you must send special characters to the printer, according to the printer's ascii code. For example:

'To print small caps

print #1, chr(15) & "the text"

'to print Bold caps:

print #1, chr(27) & "E"

YOU CAN USE THE NEXT CODES FOR IBM PRINTERS:

Bold_on=27,69|27,71|27,73,1|27,73,2|27,95,1|27,95,49
Bold_off=27,70|27,72|27,120,0|27,120,48|27,95,0|27,95,48
Italics_on=27,52|27,73,11
Italics_off=27,53
Underline_on=27,45,1|27,45,49
Underline_off=27,45,0|27,45,48
Normal_Width=18|27,18|27,73,0|27,87,0|27,87,48|20
Condensed=15|27,15
Double_Width=27,87,1|27,87,49|14
Double_Height=27,119,1|27,119,49
Normal_Height=27,84|27,119,0|27,119,48
Ignore_Chars=27,120,0|27,120,48|27,80,1|27,80,0
Cpi12=27,58|27,73,1
Cpi14=27,16,2
Cpi15=27,103
Cpi20=27,16,4
Superscript=27,83,0|27,83,48
Subscript=27,83,1|27,83,49

No comments:

Post a Comment