How to download pdf using pdfmake mobile in ionic 4?

This is my version of the file, file-opener, and cordova plugin

    "@ionic-native/file": "^5.26.0",
    "@ionic-native/file-opener": "^5.26.0",
    "cordova-plugin-file": "6.0.2",
    "cordova-plugin-file-opener2": "3.0.1",

this is the code for downloading

createPDF(){
   //some codes


    //create pdf
    this.pdfObj = pdfMake.createPdf(pdf_content);
    this.downloadPdf();
  }

    downloadPdf() {
    console.log('downloading pdf...');
    try {
      if (this.plt.is('cordova')) {
        this.pdfObj.getBuffer(function (buffer) {
          let utf8 = new Uint8Array(buffer);
          let binaryArray = utf8.buffer;
          this.saveToDevice(binaryArray, "WeeklyReport.pdf")
        });
      } else {
        this.pdfObj.download()
        this.showDownloadToast();
      }
    } catch (error) {
      this.showAlert('There is insufficient data to create report');
    }

  }

Running the app on web is fine and can download the pdf but when I run it on my device. It doesn’t work anymore. So I tried downgrading the file and file-opener to 4.20.0 and it still doesn’t work. So it’s like this

    "@ionic-native/file": "^4.20.0",
    "@ionic-native/file-opener": "^4.20.0",
    "cordova-plugin-file": "6.0.2",
    "cordova-plugin-file-opener2": "3.0.1",

Then I get errors regarding bootstrap when I downgraded. Can anyone help me how to fix this? What versions should I install or the right way to do it?

Edit: the version of pdfmake is

  "pdfmake": "^0.1.65"

Source: New feed
Source Url How to download pdf using pdfmake mobile in ionic 4?