Description This function returns a list of all thumbnails of a multipage document in a JSON objects. The thumbnail images are encoded as base64 string. The application is a JavaScript Promise. Below is a sample structure how to chain multiple functions in JavaScript Promise. the application is similar to PanoramaAPI.getThumbnailJSON
var fileName = PanoramaAPI.fileName;
if (fileName != "") {
         PanoramaAPI.getAllThumbnailJSON().then(function (data) {
            if (data == null) {
                htm = "Error to retrive Thumbnail"
                $("#divToBindThumbnails").html('<p class="api-error">' + htm + '</p>');
            }
            else {
                var dataObj = JSON.parse(data);
                var htm = "";
                $.each(dataObj.ThumbnailList, function (index, value) {
                    var thumbListArr = value;
                    $.each(thumbListArr, function (index, value) {
                        htm += '<li id="pageid_' + thumbListArr.ThumbPage + '"><img id="thumbpageid_' + thumbListArr.ThumbPage + '" src="data:image/png;base64,' + thumbListArr.Thumbnail + '"/><br/>' + thumbListArr.ThumbPage + '</li>'
                        return false;
                    });
                    $("#divToBindThumbnails").html('<ul>' + htm + '</ul>');
                });
                highlightThumbnail();
            }
            }).catch(function (error) {
              console.log("Error Message:", error);
           });
        } 
Syntax PanoramaAPI.getThumbnailJSON()
Parameters NA
Returns GetThumbnailResult:JavaScriptObject { "GetThumbnailResult": { "ThumbnailList": [{ "Thumbnail": "Base 64 string of the thumbnail", "ThumbPage": 1, "Message": null, "errorStatus": false, "errorType": null }], "Message": "CAD_Thumbnail", "CurrentPageNumber": 1, "TotalPageNumber": 1 } }

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment