Created
October 22, 2014 03:30
-
-
Save lfalmeida/bbf6a7836ddeb3d1b956 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/* Dependencias instaladas com composer | |
{ | |
"require" : { | |
"knplabs/knp-snappy": "*", | |
"h4cc/wkhtmltopdf-amd64": "0.12.x", | |
"h4cc/wkhtmltoimage-amd64": "0.12.x" | |
} | |
} | |
*/ | |
require_once 'vendor/autoload.php'; | |
use Knp\Snappy\Pdf; | |
$snappy = new Pdf('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'); | |
$name = md5(rand()); | |
header('Content-Type: application/pdf'); | |
header('Content-Disposition: attachment; filename="' . $name . '.pdf"'); | |
echo $snappy->getOutput('http://getbootstrap.com/css/'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment