Prints a string on the current active printer and returns the current virtual column number within the printer object.
Lprint p$
x = LPos(y)
x:integer
y:dummy value
Prints the string plus a CRLF on the printer of the Printer object. This command allows the printer to be used as a line printer.
A new page is automatically generated at the end of the printable area.
SetPrinterByName "Microsoft XPS Document Writer"
Output = Printer
FontSize = 12
FontName = "courier new"
Printer.StartDoc "Test"
Printer.StartPage
Lprint "Hello"
Trace LPos(0) // Returns 1 due to the implied CRLF added by LPrint
Lprint "Hello ";
Trace LPos(0) // Returns 7 due to the semi-colon cancelling the CRLF
Lprint "John"
Trace LPos(0) // Returns 1 again due to the implied CRLF added by LPrint
Printer.EndPage
Printer.EndDoc
Debug.Show
Lprint is synonymous to
Output = Printer
You can use Lprint without the using of StartDoc and StartPage; if needed Lprint creates itself, as well as EndPage and EndDoc.
SetPrinterByName "Microsoft XPS Document Writer"
Lprint "This is a test"
Printer.ForeColor = RGB(255, 0, 0)
Lprint "This is a test"
Printer.ForeColor = RGB(0, 255, 0)
Lprint "This is a test"
Printer.ForeColor = RGB(0, 0, 255)
Lprint "This is a test"
Printer.ForeColor = RGB(255, 255, 0)
Lprint "This is a test"
Printer.ForeColor = RGB(255, 0, 255)
Lprint "This is a test"
Printer.ForeColor = RGB(0, 255, 255)
Lprint "This is a test"
The printer is not initialized before StartDoc. Since Lprint implicitly executes a StartDoc, the printer can be initialized by Lprint "";
However, as can be seen from the above example, by initialising the printer with LPrint, the fontsize to pixel ratio remains as per the screen rather than the printer and the resulting print is miniscule. This can only be remedied by inserting Printer.Fontsize statement which can not be done before the output has been switched to the printer (otherwise an 'Unspecified Error' is raised). To get around this problem, the following lines should be placed before the first LPrint statement:
Lprint ""; // The semi-colon keeps the vitual cursor at the top-left of the screen
// or just use Output = Printer
Printer.FontSize = 10
{Created by Sjouke Hamstra; Last updated: 12/10/2014 by James Gaite}