0

I'm recieving a pdf as ResponseEntity<> that its a call I must do from a java api with the following endpoint link that I checked it works in Postman http://localhost:8093/api/recibirPDF (I can see the pdf ins postman), this endpoint is a file it's a pdf file, what i'm trying to do it's display this pdf in a new tab so the client could download it

I checked these:

But is not working for me I would need a guide on how to approach I have the resquest like this in the service:

    recibirPDF(): any{
    return this.httpClient.get(`${this.baseURL + '/recibirPDF'}`, {responseType: 'application/pdf'}).subscibe(
    //TODO (receive pdf so i can show it in a new tab)
data => console.log('request done')
    );
    }

When I launch the app it works without errors even the console.log('request done')

francesco14
  • 143
  • 1
  • 8

1 Answers1

0

You don't need to make any http call. Simply by using below code should open a new tab.

window.open(url, '_blank').focus();

Akash Veer
  • 160
  • 2
  • 14