Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var viewer = $('#viewer1').pccViewer(options);
- var viewerControl = viewer.viewerControl;
- // Instead of breaking the existing button we're going to create a new text button
- $("div.pcc-tab-pane.pcc-open > div.pcc-pull-right > button.pcc-icon.pcc-icon-download").parent().append("<button id=\"myNewButton\">My New Button</button>")
- // Custom Download Button EventListener
- $("#myNewButton").on("click", function(event) {
- // Pull the filename from the query string
- var filename = (window.location.search).substring((window.location.search).indexOf("=") + 1);
- // Create conversion request object
- var conversionRequest = viewerControl.requestDocumentConversion({ "filename": filename.substring(0, filename.indexOf(".")), targetExtension: "pdf" });
- // conversionRequest EventListeners
- conversionRequest.then(function success(response) {
- console.log("Success");
- $("#myNewButton").text(response);
- }, function failure(response) {
- console.log("Failure");
- $("#myNewButton").text(response);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement