How to print a HTML or TEXT file from within an ATEasy application

Knowledge Base Article # Q200180

Read Prior Article Read Next Article
Summary How to print a HTML/TEXT file from within an ATEasy application
One method of printing a HTML file from within an ATEasy application is to use the ALog control. This can be done as follows:

1. Create a form and uncheck the form Visible property.
2. Place an ALog control in the form and set it's PlainText property to False for HTML or True for text file printing.
3. Create a public procedure with one parameter that contains the location and name of the HTML file to be printed.
4. The procedure should load the form in Modeless mode, set the logPrint.LocationURL to the HTML file location, call logPrint.PrintLog and then return.

The example that accompanies this KB article is called In the example the form used to print the HTML file is called PrintHTMLForm. The public procedure used to call the form and print the file is called PrintHTML(). The same code can be used to print TEXT (log) files. The procedure code is as follows:

! Declare a PrintHTMLForm form variable called frmPrintHTML

Load frmPrintHTML, False, 0  !Load the PrintHTML form
DoEvents()   !Process all pending operations
frmPrintHTML.logPrint.LocationURL=sFile  !Set the URL of the file to be printed

!Wait for the file to be loaded
while frmPrintHTML.logPrint.ReadyState <> alogReadyStateComplete

frmPrintHTML.logPrint.PrintLog()  !Print the file
Unload frmPrintHTML
frmPrintHTML= Nothing

For more information about how to select a printer for printing refer to Q000090
Article Date 12/15/2009 9:01:36 AM     Updated: 4/16/2014 3:53:05 PM
Keywords HTML, TEXT, ATEasy, Print

0 ratings | 0 out of 5
Read Prior Article Read Next Article