我有一个azure函数,它使用模块pdfkit python将html文件转换为pdf。
下面是部署的shell脚本,我在其中安装wkhtmltopdf,它是成功的。依赖性安装在usr/local/bin/wkhtmltopdf位置
echo "Starting Installation of wkhtlmtopdf for disclosure document generation..."
export DEBIAN_FRONTEND=noninteractive
apt update
apt install wget
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb -y
chmod -R a+rwx /usr/local/bin/wkhtmltopdf这是我生成pdf的天蓝色函数代码
options = {
'enable-local-file-access': None,
'page-size': 'Letter',
'margin-top': '0.75in',
'margin-right': '0.75in',
'margin-bottom': '0.75in',
'margin-left': '0.75in',
'encoding': "UTF-8",
'custom-header': [
('Accept-Encoding', 'gzip')
],
'no-outline': None
}
config = pdfkit.configuration(wkhtmltopdf='/usr/local/bin/wkhtmltopdf')
pdfkit.from_file('index.html',
'output.pdf',
options=options,
configuration=config)在部署函数之后,当测试时,它会显示以下错误
No wkhtmltopdf executable found: "/usr/local/bin/wkhtmltopdf" If this file exists please check that this process can read it or you can pass path to it manually in method call, check README. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf我在这里错过了什么?谢谢
https://stackoverflow.com/questions/72332464
复制相似问题