Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   var byteArray = Base64Binary.decodeArrayBuffer(base64ContentFile);
  2.             getFS();
  3.  
  4.             function getFS() {
  5.                 window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
  6.             }
  7.  
  8.             function gotFS(fileSystem) {
  9.                 fileSystem.root.getDirectory("myFiles", { create: true, exclusive: false }, gotDir, fail);
  10.            
  11.             }
  12.  
  13.             function gotDir(dirEntry) {
  14.                 dirEntry.getFile(billName, { create: true, exclusive: false }, gotFile, fail);
  15.             }
  16.  
  17.             function gotFile(fileEntry) {
  18.                 fileEntry.createWriter(function (writer) {
  19.                    
  20.                     writer.onwrite = function (evt) {
  21.                         console.log("success");
  22.                     };
  23.                    
  24.  
  25.                     writer.write(byteArray);
  26.                     window.open( fileEntry.toURL(), getTarget(), "location=no,hidden=no,closebuttoncaption=Close,enableViewportScale=yes");
  27.                 }, function (error) {
  28.                     console.log(error);
  29.                 });
  30.             }
  31.  
  32.             function fail() {
  33.                 console.log('pdf fail function called');
  34.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement