├── blank.html
├── Procfile
├── .buildpacks
└── index.php
/blank.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: sh boot.sh
2 |
--------------------------------------------------------------------------------
/.buildpacks:
--------------------------------------------------------------------------------
1 | https://github.com/heroku/heroku-buildpack-php.git
2 | https://github.com/benweet/heroku-buildpack-wkhtmltopdf.git
3 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 | array("pipe", "r"), // stdin is a pipe that the child will read from
22 | 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
23 | 2 => array("file", "/dev/null", "w") // stderr is a file to write to
24 | );
25 |
26 | $process = proc_open('/app/bin/fakesu -c wkhtmltopdf -L 25 -R 25 -T 25 -B 25 --page-size '.$pageSize.' --header-html /app/www/blank.html --header-spacing 5 --footer-html /app/www/blank.html --footer-spacing 5 --javascript-delay 2000 - -', $descriptorspec, $pipes);
27 |
28 | if (is_resource($process)) {
29 | $input = fopen('php://input', 'r');
30 | while (!feof($input)) {
31 | fwrite($pipes[0], fread($input, 8192));
32 | }
33 |
34 | fclose($pipes[0]);
35 | echo stream_get_contents($pipes[1]);
36 | fclose($pipes[1]);
37 |
38 | $return_value = proc_close($process);
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------