The PrintHTML API method is illustrated in several samples to demonstrate printing of a remote document. The method PrintHTML() implements a queue and caches printing parameters (including printer to use and so on) - documents are downloaded and once the download is complete, the document is printed.
PrintHTML() is a fire and forget method and if anything goes wrong no one will know other than nothing has appeared at the printer. The PrintHTMLEx API method provides for monitoring the progress of the job and notification of errors.
PrintHTMLEx() is PrintHTML() with information
The only difference between the APIs is the addition of the callback function and callback data. Internally, the implementation of PrintHTML() calls PrintHTMLEx API . PrintHTML() retained for compatibility with production code but we recommend using PrintHTMLEx() in new code.
Note that the ScriptX.Add-on method OwnQueue API should not be called when using PrintHTMLEx() as the user may navigate away from the page without warning and the callback target will be lost!
function log(txt) ( console.log(txt); } // usable as the callback function for PrintHTMLEx() or BatchPrintPDFEx() // function monitorPrint(status, statusData, myData) { switch (status) { case 0: // will not occur through callback, this is an onpage call log("Job: " + myData + " will be queued"); break; case 1: log("Job: " + myData + " has been queued, " + statusData); break; case 2: log("Job: " + myData + " has started"); break; case 3: log("Job: " + myData + " has started downloading url: " + statusData); break; case 4: log("Job: " + myData + " has downloaded: " + statusData); break; case 5: log("Job: " + myData + " is printing"); break; case 6: log("Job: " + myData + " has completed"); break; case 7: log("Job: " + myData + " has been paused"); break; case 8: log("Job: " + myData + " is printing a PDF document: " + statusData); break; case -1: log("Job: " + myData + " has encountered an error: [" + statusData + "]"); break; case -2: log("Job: " + myData + " is being abandoned"); break; default: log("Job: " + myData + " unknown status: " + status); break; } } function printDocument(sUrl,sJobData) { MeadCo.ScriptX.Printing.PrintHTMLEx(sUrl,false,monitorPrint,sJobData); }