I am using an azure function to create pdf of html data sent to an azure storage account queue, while the entire solution works on my device, I had assumed that I can substitute the need of pdfkit’s wkhtmltopdf dependency with a package such as https://pypi.org/project/py3-wkhtmltopdf/ which basically clones the files of python3-wkhtmltopdf.
As of now, I am stuck at installing the wkhtmltopdf package in a way such that pdfkit works without needing to go for containerization of the code. (https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-custom-container?tabs=core-tools%2Cacr%2Cazure-cli&pivots=azure-functions) It will increase the development time substantially.
If anyone has managed to use pdfkit or any other alternative without the need of installing binaries, or if you have successfully installed wkhtmltopdf such that it works with pdfkit without using binaries please share how you did it.
2
Answers
The Azure Functions architecture is tricky and based on various answers using python's os package, I found a way to understand the version of the Debian os and de-packaged / unpacked the .deb file for the latest wkhtmltox (which was still outdated in comparison to the version) but this time around the backward compatibility actually kicked in.
PS. I know this is not the ideal solution and I am looking into other libraries that are still active, containerization as pointed out above and more. This is a solution that worked for me but for anyone reading this in the future, please opt for containerization from the start! or use another package to avoid heavy development costs like I had to.
AFAIK, the wkhtmltopdf need binary file. Yes you need to containerize code as it needs the binary file.
While doing in local i use below code :
I do agree with @K J, text conversion is easy but not with png/jpeg.