Reference Guide
Reference Guides / JavaScript API / Actions / Document / LoadFromBase64
In This Topic
    LoadFromBase64
    In This Topic
     LoadFromBase64

    This asynchronous function allows you to load a document into the DocuVieware™ viewer from a file content encoded in base64 string.

    LoadFromBase64: function (docuViewareID, fileData, fileType, fileName, success, error)

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance you want to load the document in.
    fileData
    The base64 string that contains the document content data.
    fileType
    A string that contains the document file MIME type, for instance "application/pdf" for a PDF document.
    fileName
    A string that contains the document file name.
    success
    A function that will be executed upon success.
    error
    A function that will be executed upon error.

    Example of usage

    This code loads a document from base64 encoded document in a DocuVieware™ instance.

    var fileData = "iVBORw0KGgoAAAANSUhEUgAAAKkAAABDCAIAAABoaLKcAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAJOgAACToAYJjBRwAAAKCSURBVHhe7ZpPjoMgHIXnILOc07DyLC48i4lHMR5Fb9CFcWFMmnT6B6EoRXCi4rz35bcZ80CmnyC1ft0IKnSPC93jQve40D0udI8L3eNC97jQPS50jwvd40L3uNA9LnSPC93jQve4bO2+6cXP5fteSV/LQ3bqqnvEfi6iGOQhzZAmz06cJYqrjL/wPrUkND+huZZFJ5JWjefZVSuyvmzMgcVCPO6L8VPLZu5VJ+6aNNzNfTPkmal8XkmXNzIeDSdz36ZZ96nySsYl+7jXY5MlknFIkzVgvjIdzLncr7OynXtDfJtWFrV19Z65pJML9EjoXhF8lmuudyFdKQ9aGVIZW0zuCd0rQvPj5vQ+45fv5arziKY+3SvC8m+Tfj5gG2U25oP+iw2he0VYXi/jvvNYrxORLPt0rwjKrxCp+ve5R+zBbu6dX88e5VhClzvpLQK2dK+v1IDLMXyp2Jb93HuXy/3HsnyadL8A3SvWuZ+P9iN6ewjmfukDPdf9nvPeA7rXKPdoe73/5f5v+3x+xzM5mXst0ncSr1oqNoXuFWF5ffP2+3VOb/Si+TWP7hWBef2M1mcND3r4vxN0r1idv1c2uJqYSXnweOheEX4WPeZHq660Tei66rT4WHZ5L87l3v1gePLqhE+r9yah+Sfl9G2tVqjw9N09+8VxHCdz76zJKXxavTcJzY+YM9tewn1TOIZ43I+7odXv6c4uGo9WxqhC8wZ11adZK4we7n92aRGh9RdbuyfxQve40D0udI8L3eNC97jQPS50jwvd40L3uNA9LnSPC93jQve40D0udI8L3eNC97jQPS50jwvd40L3uNA9LnSPC93jQve40D0udI/K7fYLKhpvPPRA4B4AAAAASUVORK5CYII=";
               
                
    DocuViewareAPI.LoadFromBase64("DocuVieware1", fileData, "image/png", "image.png",
          function () { console.log("success"); },
          function () { console.log("error"); }
       );
                
                

    Return Value

    1 if error, 0 if success.