Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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);
        }
      );
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: Making font weight bold by passing value in React.js 
Javascript :: javascript format number with commas 
Javascript :: how to define emojis from your server in discord.js 
Javascript :: regex select string between two strings 
Javascript :: javascript add spaces to string 
Javascript :: how to access child img src in jquery 
Javascript :: Check if local storage is used or empty 
Javascript :: jquery innerhtml 
Javascript :: express js redirect to url 
Javascript :: redirect link javascript 
Javascript :: pick random value from array 
Javascript :: select first 3 letters js 
Javascript :: javascript create image 
Javascript :: input change event in javascript 
Javascript :: javascript regex escape forward slash 
Javascript :: select tag onchange 
Javascript :: check if input is touched react 
Javascript :: document get element by id style 
Javascript :: react get current date yyyy-mm-dd 
Javascript :: js absolute value 
Javascript :: graphql float 
Javascript :: send data through routes in react 
Javascript :: extract number from string 
Javascript :: how to add two elements in one path in react router v6 
Javascript :: javascript check if element is overflowing 
Javascript :: javascript open new window 
Javascript :: check if over 18 javascript 
Javascript :: jquery datetimepicker example code 
Javascript :: sort array by date 
Javascript :: number pyramid javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =