wkhtmltopdf, 0.12.6, Warning: Blocked access to file

Alpha TAN picture Alpha TAN · Jun 11, 2020 · Viewed 8.7k times · Source

When upgrade wkhtmltopdf to 0.12.6, it came to such messages and the image did not show in the target pdf:

    Warning: Blocked access to file /path/to/bpa_product_layering.png

BTW, the same source html file works well with 0.12.5

Answer

Alpha TAN picture Alpha TAN · Jun 11, 2020

This is caused by the change of default behavior in version 0.12.6 of wkhtmltopdf. wkhtmltopdf disables local file access by default now. It could be solved by adding the command line parameter

--enable-local-file-access

or the combination

--disable-local-file-access --allow <path>