Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                     var viewer = $('#viewer1').pccViewer(options);
  2.                    
  3.                     var viewerControl = viewer.viewerControl;
  4.                    
  5.                     // Instead of breaking the existing button we're going to create a new text button
  6.                     $("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>")
  7.                    
  8.                     // Custom Download Button EventListener
  9.                     $("#myNewButton").on("click", function(event) {
  10.                         // Pull the filename from the query string
  11.                         var filename = (window.location.search).substring((window.location.search).indexOf("=") + 1);
  12.                        
  13.                         // Create conversion request object
  14.                         var conversionRequest = viewerControl.requestDocumentConversion({ "filename": filename.substring(0, filename.indexOf(".")), targetExtension: "pdf" });
  15.                        
  16.                         // conversionRequest EventListeners
  17.                         conversionRequest.then(function success(response) {
  18.                             console.log("Success");
  19.                             $("#myNewButton").text(response);
  20.                            
  21.                         }, function failure(response) {
  22.                             console.log("Failure");
  23.                             $("#myNewButton").text(response);
  24.                         });
  25.                     });
  26.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement