1

I am using as below:

<a [href]="pdfSrc" target="_blank" download="pdfName">Download</a>

whereas pdfSrc is coming from API response and it is a minio link.
If I use sample .pdf file target="_blank" is opening, but when I use minio link it is opening the pdf in the current tab.

I want to open minio link pdf in a new tab, I am unable to do it with minio link.

Jack T
  • 315
  • 1
  • 6
  • 18
Mayuri More
  • 216
  • 2
  • 12

2 Answers2

4

Try creating a method in component to open pdf in new window somthing like

pdfSrc='http://www.africau.edu/images/default/sample.pdf';

 download(){
    var redirectWindow = window.open(this.pdfSrc, '_blank');
    redirectWindow.location;
 }

And then call this method on href click

<a (click)="download()" download="pdfName">Download</a>

Stackbliz demo

jitender
  • 10,238
  • 1
  • 18
  • 44
0

If you're using razor helper functions you can code it this way also:

<a href="@Url.Content("pdfName")" target="_blank"</a>

Ken King
  • 11
  • 3