DocumentPicker example


Listed below is a snippet of code that can be used in the index.html file to implement the DocumentPicker API functionality.

var picker = new launchbox.DocumentPicker();

// Optionally, configure the picker to pick documents only from the device library...
picker.source = "library";
// ...or try to capture new document using a camera...
picker.source = "capture"; 

​// Optionally, filter out document types which you are interested in...
picker.type = ["image", "video"];
// ...or...
picker.type = "audio";

// Optionally, provide some parameters:
picker.imageParams = {saveToLibrary : true, quality : 60};
picker.videoParams ...

// Finally, pick a document...
picker.pick()
     .then(function(fileEntry) {
         // If document is picked successfully, you obtain an
         // instance of the File API 'FileEntry' object here.
         // You can open it using the launchbox.DocumentViewer API or 
         // upload it to the server using launchbox.FileTransfer API.
     })
     .catch(function(error)) {
         // Error handling.
     });

Related topics

Public API reference
DocumentPicker
Legal notice | Copyright © 2019 and Confidential to Pegasystems Inc. All rights reserved
Pega Community | Feedback
Advanced...