DocumentPicker example


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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var picker = new launchbox.DocumentPicker();
 
// Optionally, configure picker to pick documents only from device library ..
picker.source = "library";
// .. or try to capture new document using camera ..
picker.source = "capture";
 
// Optionally, filter out document types which you are interested in ..
picker.type = ["image", "video"];
// .. or ..
picker.type = "audio";
 
// And optionally provide some parameters :
picker.imageParams = {saveToLibrary : true, quality : 60};
picker.videoParams ...
 
// And finally pick document ..
picker.pick()
     .then(function(fileEntry) {
         // If document is picked successfully here you obtain
         // instance of File API 'FileEntry' object.
         // You can open it using launchbox.DocumentViewer API or
         // upload it to server using launchbox.FileTransfer API.
     })
     .catch(function(error)) {
         // Error handling.
     });

Related topics

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