Print HTML ActiveX DLL

• Prints and Print Previews HTML from either a URL or HTML string


The Print HTML ActiveX DLL provides a simple way for VB6, VBA, and VFP developers to print and print preview HTML from either a URL or HTML string. The component will alson accurately render HTML5 content.

Usage

After adding a reference to the DLL (PrintHTML.dll)

1. To print preview a URL

    Dim oPrint As New PrintHTML.clsPrintHTML
   
    With oPrint
   
        .basedocument = "https:/zoople.tech"
        .PrintPreviewDoc
       
    End With

2. To print a HTML string value

    Dim oPrint As New PrintHTML.clsPrintHTML
   
    With oPrint

        .StyleSheetText = "BODY {color: GREEN; font-family: arial;} H1 {color: RED; font-family: Courier;}"
        .DocumentHTML = "<h1>Print Preview</h1><div style='text-align: center'>Content text here.</div>"

        .PrintDoc
       
    End With

API

Properties

LicenseKey

String

Sets / Gets the current license key for each instance of the DLL being used.

BaseDocument

String

Defines the URL to be printed. For example;

https://google.com/

file:///C:/testfolder/test.html

To print from a HTML string leave this value empty or assign vbNullString

StyleSheetText

String

Additional CSS Style Sheet information to be included.

For example;

oPrint.StyleSheetText = “BODY {font-family: Arial} H1 {color: #ab12ed}”

DocumentHTML

String

When printing a HTML string, the HTML string to be printed.

Timeout

Long – default value = 30

The time (in seconds) to wait before cancelling printing when accessing a URL.

RenderHTML5

Boolean – default value = True

Allows for the rendering of HTML5 in print jobs

Methods

PrintPreviewDoc

Displays a print preview form for the print job. Allows for layout manipulation.

PrintDoc

Displays a print dialog.

Events

ErrorOccured (number As Long, description As String)

Raised on an error printing.

"2001", "PrintDoc:Page Timed Out" – page load timeout (refer Timeout property)

“1003”, "clsPrintHTML:PrintDoc" – general error