Prints either specified HTML text or the HTML document specified by the URL, using the current printing settings in the same session context. The method is asynchronous. It returns before the document is downloaded and printed.
Important note: The HTML to be printed must not be ‘ScriptX-enabled’ - it must not contain an object tag referencing the ScriptX object nor script code that uses that object. Attempting to print HTML (either specified HTML text or a document specified by url) that contains the ScriptX object can lead to strange errors and failure of the entire printing process, including causing Internet Explorer to stop responding.
PrintHTML may be used to organize a printing queue in a separate process, in which case the current window may be closed without waiting for pending downloads to complete. See OwnQueue for more details.
printing.PrintHTML(url[, prompt = false])
Returns false if printing with a prompt and the user cancels the printing.
(String) URL/HTML text to print:
|prompt||[Optional] (Bool) Specifies whether or not the user should be prompted before the download is queued|
Support for "Modern" standards (aka Edge where "Edge" is the IE 11 definition).
Version 8.2 introduces the following:
When printing a downloaded document if the host document is in IE 11 edge mode then printHtml() will be enabled to print modern content. If the document does not print properly then change the host document to use an older document mode and printHtml() will then use the pre ScriptX 8 way of working, alternatively:
The use of pre ScriptX 8 behaviour can be forced using the url4:// pseudo protocol.
When printing dynamic content using the html:// pseudo protocol then the pre ScriptX way of working will be used unless the dynamic content starts with <!DOCTYPE html>, or:
- The support of modern standards can be forced using the html5:// pseudo protocol.
- The use of pre ScriptX 8 behaviour can be forced using the html4:// pseudo protocol.
Please note that all jobs in a queue will use the same mode of working. The mode can be changed if the queue is empty. The PrintHtmlEx callback on a job being queued will report the mode of the queue.
The following simple but complete example shows how to print an externally-located document:
The following example illustrates dynamic creation of the HTML to be printed:
Also check out a ScriptX print HTML sample.