Hi Sandeep,

in an app I do this to display a pdf generated by the backend (via ireport).
Hope this will help,
Regards 
Arnaud.

Service:
loadCertificate(trainee?: Trainee) {
this.loading$.next(true);
const url = !!trainee ? `${this._url}?trainee=${trainee.login}` : this._url;
this._log.debug('CertificateService loadCertificate', url);
const headers = new HttpHeaders();
const options = { responseType: 'blob' };
return this._httpClient.get(url, { headers, responseType: 'blob' }).pipe(
tap(result => this._log.debug('result', result)),
tap(() => this.loading$.next(false)),
shareReplay()
);





Component:

this._certificateService.loadCertificate(this.trainee).subscribe(cert => {
const fileURL = URL.createObjectURL(cert);
window.open(fileURL, '_blank');
});

On Thursday, 25 June 2020 23:37:15 UTC+2, sandeep...@gmail.com wrote:
>
> Hi,
>
> I would like to show the PDF in my html. I am getting the pdf file in 
> base64 format and it is part of attribute in json. eg  in my ts file I am 
> saving in one variable say 
>        pdf = atob(this.contentElements)
>
> Here atob methods decode the pdfe and stores in the pdf object. When I 
> retrieve 
>   {{pdf}} in html then I dont get the result. But it works fineor 
> application/xml file.
>
> I tried to display pdf diretly from assetfolder as per online example , it 
> worked but , I am not sure how it works in my situation.
>
> Any pointer u have.
>
> By the way this forum has helped me to build the concept quickly and the 
> help I received from my previous post was really good.
> Thanka a lot in advance.
> Regards
> Sandeep Shukla
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/791b03a4-bde3-426f-86dc-4a89d7517d25o%40googlegroups.com.

Reply via email to