Sanjana Tayde
Sanjana Tayde

Reputation: 31

How to store pdf file on Local Storage Root Directory in Ionic 2

I want to create pdf file using pdfmake and store this pdf on the local root storage directory. new folder should be parallel to other folders like android ,bluetooth. I have given folder list below.

which method will work on this?

I have tried some method of file native like-externalDataDirectory,dataDirectory from http://ionicframework.com/docs/native/file/

|- .IdeaDesktopHD

|- .lelauncher

|- .magic

|- .powercenterhd

|- Alarms

|- Android

|- Audio

|- Bluetooth

|- Contact

|- data

|- DCIM

|- Document

|- Download

|- googleota

|- legc

|- LenovoReaper

|- LesyncDownload

|- Movies

|- MyFavorite

|- Notifications

|- Others

|- Pictures

|- Podcasts

|- powercenterhd

|- Ringtones

|- SHAREit

Any idea which method or function i should use ?

Upvotes: 2

Views: 1036

Answers (1)

manish kumar
manish kumar

Reputation: 4692

try out this

downloadImage(url: string) {

this.fileTransfer.download(encodeURI(url),"file:///storage/emulated/0/folderName/file.pdf")
  .then((
     console.log('
  }, (error) => {
           console.log('error occured');
          });
    }

Upvotes: 1

Related Questions