BCX Printer Procedures
PRINTER OPEN statement
LPRINT statement
PRINTER CLOSE statement
Purpose: LPRINT prints directly and only to LPT1. Anything that you can PRINT and FPRINT, you can also LPRINT. The PRINTER OPEN statement must precede LPRINT and PRINTER CLOSE follow to close the printer port.
Syntax: PRINTER OPEN LPRINT comma separated expressions PRINTER CLOSE Parameters:
|
A simple LPRINT demonstration:
PRINTER OPEN FOR INTEGER i = 1 to 50 LPRINT "This is line number ", i , ". BCX matures again!" NEXT LPRINT CHR$(12) ' Form Feed(eject from paper printer) PRINTER CLOSE
PRINTER EJECTPAGE statement
Purpose: The PRINTER EJECTPAGE statement notifies the printer that the application has finished writing to a page. This statement is used to tell the printer to eject the page. The PRINTER OPEN and LPRINT statements must precede PRINTER EJECTPAGE and PRINTER CLOSE follow to close the printer port.
Syntax: PRINTER OPEN LPRINT comma separated expressions PRINTER EJECTPAGE PRINTER CLOSE Parameters:
|
Here is a second method to print to a printer. BCX opens a connection to the printer using a handle to PRN, a standard printer communications device. The data then is output to the printer using a PRINT statement. LPT1 should also work instead of PRN.
Here is a simple example for sending data to the default printer.
DIM i OPEN "PRN" FOR OUTPUT AS fp1 FOR i = 1 TO 60 PRINT #fp1,"This is line number" , i NEXT PRINT #fp1,CHR$(12) 'CHR$(12) is Form Feed Character CLOSE fp1