1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// service downloadPrintFile(id: number): Observable<Blob>{ return this.http.get(`downloadurl` + id,{ responseType: 'blob' }); } // compoment function onClickPrint(ids: any, fileName: string) { this.loader = true; this.Service.downloadPrintFile(ids).subscribe( (blob: any | Blob) => { const blobUrl = URL.createObjectURL(blob); const iframe:any = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = blobUrl; document.body.appendChild(iframe); iframe.contentWindow.print(); }); setTimeout(() => { this.loader = false; }, 4000); } |
Leave a reply