Fix wkhtmltopdf bugs

The wkhtmltopdf library does not work with the latest version of alpine. To
workaround this, a known working image based on an older alpine image is pulled
in and relevant libraries copied to the target image.

The `snappy` package required a few updates to support this, including setting
the wkhtmltopdf binary path explicitly and to enable access to local files
(disabled by default).
This commit is contained in:
2024-05-01 17:03:14 -07:00
parent 5e1cb0d8b4
commit a47c7b3d98
3 changed files with 167 additions and 7 deletions
+56
View File
@@ -0,0 +1,56 @@
<?php
$pdfPath = '/usr/bin/wkhtmltopdf';
$imagePath = '/usr/bin/wkhtmltoimage';
return [
/*
|--------------------------------------------------------------------------
| Snappy PDF / Image Configuration
|--------------------------------------------------------------------------
|
| This option contains settings for PDF generation.
|
| Enabled:
|
| Whether to load PDF / Image generation.
|
| Binary:
|
| The file path of the wkhtmltopdf / wkhtmltoimage executable.
|
| Timout:
|
| The amount of time to wait (in seconds) before PDF / Image generation is stopped.
| Setting this to false disables the timeout (unlimited processing time).
|
| Options:
|
| The wkhtmltopdf command options. These are passed directly to wkhtmltopdf.
| See https://wkhtmltopdf.org/usage/wkhtmltopdf.txt for all options.
|
| Env:
|
| The environment variables to set while running the wkhtmltopdf process.
|
*/
'pdf' => [
'enabled' => true,
'binary' => $pdfPath,
'timeout' => false,
'options' => [
'enable-local-file-access' => true
],
'env' => [],
],
'image' => [
'enabled' => true,
'binary' => $imagePath,
'timeout' => false,
'options' => [
'enable-local-file-access' => true
],
'env' => [],
],
];