I have a website now and I want to create a button on it to convert this page to PDF. Is there any code to make this happen? I cannot find it on the internet.
So I want to have a button and when I press on it it converts the page to a .PDF file.
I do not want to use a third party website to generate the PDF's. I want to use it for internal purposes to generate files with PHP. So I need the code what can make a PDF for each page.
The fastest way to convert an open web page to PDF is to use the Adobe PDF toolbar. If you have the toolbar installed in your browser, simply select the Convert To PDF tool. Give your new PDF file a name, select Save, and voila — the conversion is done.
The Adobe PDF Maker toolbar is normally located in the upper left-hand corner, just under the Standard toolbar. If you don't see the button, click View -> Toolbars -> Acrobat PDFMaker. Note that there are two conversion buttons, the “Convert to Adobe PDF” button is on the left.
I use wkhtmltopdf - works very well - http://code.google.com/p/wkhtmltopdf/ there is a PHP wrapper
Updated based on comments below on usage :
How to use the integration class:
require_once('wkhtmltopdf/wkhtmltopdf.php'); // Ensure this path is correct !
$html = file_get_contents("http://www.google.com");
$pdf = new WKPDF();
$pdf->set_html($html);
$pdf->render();
$pdf->output(WKPDF::$PDF_EMBEDDED,'sample.pdf');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With