Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Last active January 2, 2016 14:19
Show Gist options
  • Save tvlooy/8316286 to your computer and use it in GitHub Desktop.
Save tvlooy/8316286 to your computer and use it in GitHub Desktop.
wkhtmltopdf with php test
<?php
// Tips:
// prepend with xvfb-run to wrap call in virtual x-server (if wkhtmltopdf version is old and no X is found)
// -O landscape (to turn page 90 deg)
// --post requestType genpdf (to post params, is repeatable)
// --footer-right "[page]/[topage]"
// read man whktmltopdf
$command = '/usr/local/bin/wkhtmltopdf -q http://' . $_SERVER["SERVER_NAME"];
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="website.pdf"');
echo `$command -`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment