[Vuejs]-How to display a PDF generated with express/pdfkit in browser from api-endpoint

0👍

In your express app: res.setHeader('Content-Type', 'application/pdf');

In your frontend just open the link "manually" like clicking on an anchor: <a href="{url to pdf}" target="_blank">click me</a>

The pdf should open in a new tab if your browser supports that, else it will be downloaded.

Edit: for clarification: window.open expects a url as first parameter, not the content of a pdf.

Leave a comment