Hi Lou,
One thing I always recommend for PCL programming is to always senc a soft reset ESC:'E' to the printer prior issuing any further changes. This will reset the printer to the configured defaults that you have set via the control panel. Also recommend sending a reset at the end of each job which will cause the printer to flush and print the remnants of its buffer and eject the last page.
The following is a quick and dirty and there are more elegant and complicated ways to do this but I hope it is useful to you. If you want to format each line then prepend the format code to the text.
e.g. print BOLD:'this is bold text':NOBOLD:'this is normal text'
Cheers,
Peter
* Set output to the desired filename in &HOLD& (printfile.txt)
* Change the SETPTR command to suit your own printing environment
cmd = 'SETPTR 0,132,66,0,0,3,NHEAD,BRIEF,NOEJECT,NFMT,BANNER printfile.txt'
execute cmd capturing output
* Define the codes to use. Source more from a google search for 'PCL6 Commands Reference'
ESC = char(27)
SOFTRESET = ESC:'E'
PORTRAIT = ESC:'&l0O'
LANDSCAPE = ESC:'&l1O'
FIXEDWIDTH = ESC:'(s0P'
PROPORTIONAL = ESC:'(s1P'
BOLD = ESC:'(s3B'
NOTBOLD = ESC:'(s0B'
IBMPCCHARSET = ESC:'(10U'
6LPI = ESC:'&l6D' ;* line printer lines per page
10CPI = ESC:'(s10H' ;* 10 characters per inch across the page
EJECTPAGE = ESC:'&l0H'
* Direct output to the print spooler
printer on
print SOFTRESET
* Set for line printer
print LANDSCAPE:IBMPCCHARSET:6LPI:10CPI
pageCount = 1
lineCount = 1
bNoMore = @false
jobHeading = 'some heading as at '
print jobHeading:timedate():' ':pageCount
loop until bNoMore do
* read/obtain stuff to print and format into a line
line = 'stuff to print'
print line
lineCount += 1
* check here if any more to print
* if no more to print then bNoMore = @true
if lineCount > 66 then
print EJECTPAGE
pageCount += 1
print jobHeading:timedate():' ':pageCount
lineCount = 1
end
repeat
print SOFTRESET
printer off ;* turn off spooler output
printer close ;* close the print file
* At this point there will be a file in &HOLD& called printfile.txt that
* can be reassigned via the spooler to send to your PCL6 printer
* Or it can be distribute via your favourite transport mechanism (sendmail, sftp, scp, awscli etc)
------------------------------
Peter Cheney
Developer and Systems Superstar
Firstmac
Brisbane Qld Australia
------------------------------
Original Message:
Sent: 04-14-2024 13:52
From: lou tur
Subject: U2 BASIC code example for PCL 6 interface
Looking for U2 BASIC coding example for PCL 6 interface. Thanks Lou
------------------------------
lou tur
Senior Sales Engineer
Rocket Internal - All Brands
St Petersburg FL US
------------------------------