Created
March 28, 2018 14:37
-
-
Save destinydriven/26ab2df5c8bfc635fba21b187397b8f0 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
We need to write a little shell script to wrap wkhtmltopdf in xvfb. Make a file called wkhtmltopdf.sh and add the following: | |
xvfb-run -a -s "-screen 0 1024x768x24" wkhtmltopdf "$@" | |
Move this shell script to /usr/local/bin, and set permissions: | |
sudo chmod a+x /usr/local/bin/wkhtmltopdf.sh | |
Check to see if it works once again: run | |
/usr/local/bin/wkhtmltopdf.sh http://www.google.com test.pdf | |
Now just ensure that your Plugin configuration for CakePdf looks like this: | |
$config['CakePdf'] = array( | |
'engine' => 'CakePdf.WkHtmlToPdf', | |
'binary' => '/usr/local/bin/wkhtmltopdf.sh', | |
'pageSize' => 'legal', | |
); | |
The CakePdf script should be calling your script (*.sh rather than the binary file directly) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment