Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var byteArray = Base64Binary.decodeArrayBuffer(base64ContentFile);
- getFS();
- function getFS() {
- window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
- }
- function gotFS(fileSystem) {
- fileSystem.root.getDirectory("myFiles", { create: true, exclusive: false }, gotDir, fail);
- }
- function gotDir(dirEntry) {
- dirEntry.getFile(billName, { create: true, exclusive: false }, gotFile, fail);
- }
- function gotFile(fileEntry) {
- fileEntry.createWriter(function (writer) {
- writer.onwrite = function (evt) {
- console.log("success");
- };
- writer.write(byteArray);
- window.open( fileEntry.toURL(), getTarget(), "location=no,hidden=no,closebuttoncaption=Close,enableViewportScale=yes");
- }, function (error) {
- console.log(error);
- });
- }
- function fail() {
- console.log('pdf fail function called');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement