How to read the pdf data from the url and show pdf content in html in ionic3?

#1

Hi to all,
I have to load the data from the pdf URL In the pdf content of the chapter detail I have tried sanitizer but it’s not working for me I have got cannot get/null in the HTML section .tell me any another way to read the data of pdf URL and show in HTML.i have used bypassSecurityTrustResourceUrl for read pdf but got null.

getChapterDetail() {

//postMethod for post data in the API.....
this.service.postMethod1(this.service.baseurl()+'syllabus_details').then(data => {
  if(data.status == 1) {
      this.syllabusDetail = data.data.syllabus_data[0];

      //
       var pdfLink = this.sanitizer.bypassSecurityTrustResourceUrl(this.syllabusDetail.subject_data);
       console.log('dddd' +pdfLink);

     // this.showPdf(this.syllabusDetail.subject_data);

  }  
},error => {
  console.log(error)

});
}
//html section where we have to display pdf content
 <iframe [src]="pdfLink" width="100%" height="100%" frameborder="0" ></iframe>  

#2

Hello,
is there a restriction to use one of the many pdf viewers like https://www.npmjs.com/package/ng2-pdf-viewer ?

Best regards, anna-liebt

#3

Ok sir i will try above link.Sir it is working in ionic3 actually i got a different URL every time from API.