View pdf in another browser tab with php

Question:

Good afternoon people,

Next, I created a quote form in php and I request that the user, when visiting my website, can request the quote and send it to my database. So I would like that, as soon as he clicks send (Remembering that when I send I redirect to another page in java script) I can already open a general budget in pdf format in a new browser tab that will already be in one of my pages. folders on the website. can anybody help me?

Answer:

Use this code, which will open the file in the browser itself. Preferably use Google Chrome.

header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=nome.pdf");
@readfile('files/nome.pdf');
Scroll to Top
AllEscort