angular download blob pdf
getPDF(){
this.apiService.getPDF(this.invoiceId)
.subscribe(
(data: Blob) => {
var file = new Blob([data], { type: 'application/pdf' })
var fileURL = URL.createObjectURL(file);
// if you want to open PDF in new tab
window.open(fileURL);
var a = document.createElement('a');
a.href = fileURL;
a.target = '_blank';
a.download = 'bill.pdf';
document.body.appendChild(a);
a.click();
},
(error) => {
console.log('getPDF error: ',error);
}
);
}
Also in JavaScript:
- javascript onload
- access to xmlhttprequest at angular 8
- javascript validate date
- mock sqs.sendMessage node js
- javascript click on all links
- jquery scroll to top of div animate
- document.queryselector picks first or last
- update object within object by id js
- how to remove last index of array in javascript
- output event angular
- js change button text
- webpack css not shoud be empty
- how to hide header in react navigation
- binary to ascii javascript
- reload page javascript
- d3 v6
- sum elements in list with same name js
- javascript getcontext
- html video tag autoplay not working
- get the first word of a string javascript
- vuejs use set to prevent duplicates
- square brackets vs curly brackets javascript
- Javascript compare two dates
- transition event listener does not work