javascript - PDF in iframe showing title as 'Anonymous' -
i using angular2. getting pdf response blob backend api. pdf showing fine in iframe showing title 'anonymous'. can please guide?
html code:
<iframe id="showpdfiframe" allowtransparency="false" title="testpdf" width="100%" height="800" [attr.src]="datalocalurl" type="application/pdf"></iframe> pdf.component.ts
pdfdownload: any; protected datalocalurl: saferesourceurl; ngoninit() { this.requestoptions = this.createrequestoptions(); this.requestoptions.responsetype = responsecontenttype.blob; this._pdfmodelservice.showpdf(this.requestoptions) .subscribe( (res) => { this.pdfdownload = res; this.datalocalurl = this.domsanitizer.bypasssecuritytrustresourceurl(window.url.createobjecturl(res)); }, err => { console.log(err); }) } pdfmodelservice.ts
showpdf(options?: requestoptions): { return this._http.get(this.endpoints.showpdf.uri, options) .map( (res) => { return new blob([res], { type: 'application/pdf' }) }); } see below image 'anonymous' showing 
note: backend api gives bytes cast in blob.
have tried providing title in options:
showpdf(options?: requestoptions): { return this._http.get(this.endpoints.showpdf.uri, options) .map( (res) => { return new blob([res], { type: 'application/pdf', title: 'testpdf' }) }); }
Comments
Post a Comment