使用的 wkhtmltopdf wkhtmltox-0.12.6-1.centos7.aarch64.rpm
转换的时候wkhtmltopdf 报错信息:
Warning: Blocked access to file /home/xxx/apache-tomcat-8.5.47/webapps1/xxx/WEB-INF/classes/images/service/logo_zr.png
Warning: Blocked access to file /home/xxx/apache-tomcat-8.5.47/webapps1/xxx/WEB-INF/classes/images/service/level2.png
Warning: Blocked access to file /home/xxx/apache-tomcat-8.5.47/webapps1/xxx/WEB-INF/classes/images/service/over_zr.png
Warning: Failed to load /home/xxx/apache-tomcat-8.5.47/webapps1/xxx/WEB-INF/classes/static/css/service/pdf.css (ignore)
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
解决方案:
添加:这个两个参数 --enable-local-file-access --allow 而且要放在 wkhtmltopdf 命令之后其他命令之前。
========================================================================================
如果centos7上安装了wkhtmltox-0.12.5-1.centos7.x86_64.rpm,则可以不用添加 这个两个参数 --enable-local-file-access --allow