Created
November 28, 2012 13:24
-
-
Save benfavre/4161262 to your computer and use it in GitHub Desktop.
Wkhtmltopdf php example
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 | |
ini_set('memory_limit', '210000M'); | |
$command = "wkhtmltopdf-i386 --redirect-delay 100 --disable-smart-shrinking --print-media-type --margin-bottom 0mm --margin-left 0mm --margin-right 0mm --margin-top 0mm --dpi 96 'http://elwglobalarmour.com/shop/military-assault-vest/' /var/www/clients/carteweb.jeanstalaven.fr/www/2012_PDFHD/pdf-james.pdf"; | |
exec($command); | |
$file = "/var/www/clients/carteweb.jeanstalaven.fr/www/2012_PDFHD/pdf-james.pdf"; | |
$pdf = file_get_contents($file); | |
header('Content-Type: application/pdf'); | |
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 | |
header('Pragma: public'); | |
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past | |
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); | |
header('Content-Length: '.strlen($pdf)); | |
header('Content-Disposition: inline; filename="'.basename($file).'";'); | |
ob_clean(); | |
flush(); | |
echo $pdf; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment