I have an azure function that convert html file to pdf using the module pdfkit python.
Here is the shell script of deployment where I install wkhtmltopdf and it is successfull. The dependancy is installed in the location 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
Here is my azure function code which generate 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)
After deploying the function, When tested, it showing following error
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
What I am missing here? Thank you