Wkhtmltopdf: how to use it?

I want to be able to create and save a PDF version of a PHP page. I found out that wkhtmltopdf is the most recommended on Stackoverflow: http://code.google.com/p/wkhtmltopdf/

However, I have no knowledge of Shell or binary data; I only know HTML and PHP.

Can anyone CLEAR the manual on how to get a php page to generate a PDF using wkhtmltopdf (using only FTP and PHP)?

+3


source to share


1 answer


Have you read the wiki section of the project homepage? It has an IntegrationWithPhp page. Hope it will be.

Read the comments to learn how to use the class found on the wiki:



$html = file_get_contents("http://www.google.com");
//echo $html;
$pdf = new WKPDF();
$pdf->set_html($html);
$pdf->render();
$pdf->output(WKPDF::$PDF_EMBEDDED,'sample.pdf');

      

+3


source







All Articles