How to download and show a pdf file from remote site?

I have a web service that when is called returns a pdf file in a row format.

For example, calling the URL:

I have the file as the response:


Which is the best way to manage these raw data with Ionic3 ?
I’d like to show the downloaded file to the customer.

Thank you very much


you can use this plugin

It seems that it allows you to open only local files:
File Opener: This plugin will open a file on your device file system with its default application.

yes you are right so you have to download your file using file transfer plugin

this will download your file in local memory and you just have to give local path to file opener plugin
that’s it !!:sweat_smile:

here is working code :slight_smile:

extToMimes = [
    { ext: 'jpeg', MType: 'image/jpeg' },
    { ext: 'jpg', MType: 'image/jpeg' },
    { ext: 'png', MType: 'image/png' },
    { ext: 'doc', MType: 'application/msword' },
    { ext: 'docx', MType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
    { ext: 'xls', MType: 'application/' },
    { ext: 'xlsx', MType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' },
    { ext: 'gif', MType: 'image/gif' },
    { ext: 'pdf', MType: 'application/pdf' }

 download(name) { //name : any file name
    const fileTransfer: FileTransferObject = this.transfer.create();
    const url = yourserverul + name;, this.filePlug.dataDirectory + name).then((entry) => {, this.getMimeByExt(name))
        .then(() => console.log('File is opened'))
        .catch(e => console.log('Error opening file', e));
    }, (error) => {


  getMimeByExt(name: any) {
    var extention = name.split('.').pop();
    for (let i = 0; i < this.extToMimes.length; i++) {
      const element = this.extToMimes[i];
      if (element.ext == extention) {
        return element.MType;

Thank you very much


At the end I’ve used this code using DocumentViewer:

  openRemoteFileByUrl(fileUrl, content_type='application/pdf'){
    const transfer = this.transfer.create();
    let path = null;
    if ('ios')) {
      path = this.file.documentsDirectory;
    } else if ('android')) {
      path = this.file.dataDirectory;
    }, path + 'myfile.pdf').then(entry => {
      let url = entry.toURL();
      this.document.viewDocument(url, content_type, {});

It works, however I’ve seen that the use of FileTransfer is deprecated.
For now I’ll use it the same, but I’ll look for a different way of downloading the file.


am working on a similar issue can yu help me on this