I am trying to create pdf file using FPDF.
What I right now have is an HTML page with various lines of data and a print button next to it. When someone clicks Print
You should open a new page using tag with your PHP page print.php with your variables.
In the PHP page, add headers
// Send Headers
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="myPDF.pdf');
// Send Headers: Prevent Caching of File
header('Cache-Control: private');
header('Pragma: private');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
Try to play with header header('Content-type: application/force-download'); to download automatically your file.
You could also display your PDF data like if the file has been saved readfile('original.pdf');