Last active
January 2, 2016 14:19
-
-
Save tvlooy/8316286 to your computer and use it in GitHub Desktop.
wkhtmltopdf with php test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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