以PDF格式打开我的php页面

I have a button on my page that links to the report.php page. What I want is that instead of clicking the button and see the php page, to click the button and open this report.php page as a PDF one.

Is this possible? How can I do it?

You can generate PDF and allow user to download it (if browser supports inline PDF display it will look as you want). Try mPDF. It generates PDFs from HTML and CSS.

Ofc its possible, you define headers and make a recommended file name istead of the extension php

<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('original.pdf');
?>

first example found on php.net

http://php.net/manual/en/function.header.php

assuming of course that the file your generating is compatible with pdf, you can find alot of pdf generators online but i would recommend using http://phpclasses.org

You can try this, HTML to PDF Converter. Convert your HTML to PDF and then display on screen, Here are examples.