Mandar Shinde

Mandar Shinde

  • NA
  • 423
  • 115.6k

Regarding converting base64 string to pdf in Angular 8.

Oct 22 2019 3:22 AM
Dear all,
I hope you are doing well. I was developing one component using Angular 8 and ASP .Net MVC with REST Api.
I have generated one pdf using ASP .Net and I am returning array as base64 string to that component.
I have used following code to convert that base64 string to pdf is : 
 
  1. let html = '';  
  2. html += "<html>";  
  3. html += '<body style="margin:0!important">';  
  4. html += '<embed width="100%" height="100%" src="data:application/pdf;base64,' + result + '" type="application/pdf" />';  
  5. html += "</body>";  
  6. html += "</html>";  
  7. setTimeout(() => {  
  8.    const win = window.open(''"_blank");  
  9.    win.document.write(html);  
  10. }, 100);  
above code works on desktop but could not able to run same code for tablet or mobile devices.
Please let me know solution on this problem.
Thanking you in advance.
Regards. 
 
 
 
 
 

Answers (2)