Skip to content

Instantly share code, notes, and snippets.

@krolow
Created February 24, 2012 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krolow/1900711 to your computer and use it in GitHub Desktop.
Save krolow/1900711 to your computer and use it in GitHub Desktop.
wkhtmltopdf php
<?php
var_dump(exec('xvfb-run /usr/bin/wkhtmltopdf http://google.com /var/www/yep.test.' . time()));
$test = array(
array('pipe', 'r'),
array('pipe', 'w'),
array('pipe', 'w'),
);
$process = proc_open('/usr/bin/wkhtmltopdf http://google.com /var/www/yep.test.' . time(), $test, $pipes);
fwrite($pipes[0], $html);
fclose($pipes[0]);
$pdf = stream_get_contents($pipes[1]);
$errors = stream_get_contents($pipes[2]);
fclose($pipes[1]);
$return_value = proc_close($process);
var_dump($errors);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment