Reference Guide
Reference Guides / JavaScript API / Events / RegisterOnDocumentPrinted
In This Topic
    RegisterOnDocumentPrinted
    In This Topic
     RegisterOnDocumentPrinted

    This function allows you to trigger a function of your own when the document print event is fired.

    RegisterOnDocumentPrinted: function (docuViewareID, callback)

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance.
    callback
    The function you want to execute on event.

    Return Value

    1 if error.

    Example of usage

    This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load.

    function RegisterOnDocumentPrintedOnDocuViewareAPIReady() {
        if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
            DocuViewareAPI.RegisterOnDocumentPrinted("DocuVieware1", function () { console.log("printed"); });
        }
        else {
            setTimeout(function () { RegisterOnDocumentPrintedOnDocuViewareAPIReady() }, 10);
        }
    }
    document.addEventListener("DOMContentLoaded", function () {
        RegisterOnDocumentPrintedOnDocuViewareAPIReady();
    }, false);