Adam Strudwick
Adam Strudwick

Reputation: 13129

wkhtmltopdf: how to use it?

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

However, I don't have any Shell or binary knowledge; I only know HTML and PHP.

Could anyone CLEARLY guide me on how to get a php page generate a PDF document using wkhtmltopdf (using only FTP and PHP)?

Upvotes: 3

Views: 10670

Answers (1)

Janis Veinbergs
Janis Veinbergs

Reputation: 6988

Did you read wiki section of the project homepage? It has IntegrationWithPhp page. Hope that thelps.

Read comments to see how to use the class thats found in 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');

Upvotes: 3

Related Questions