I find wkhtmltopdf very difficult to work with, for instance the official documentation is just a man [1].
I discovered the project Weasyprint[2] a few months ago. I find it easier to use, and very powerful when using Python. You can define a custom loader to inject images or styles generated on the fly for instance.
There are still some missing features compared to wkhtmltopdf, such as defining a custom footer and header, but it's a very promising project.
Since you mention Python, I have found pdfkit[1] to be a pretty good wrapper for wkhtmltopdf. I have a document generation engine that uses it dozens of times a day. Worst part is that wkhtmltopdf in the Ubuntu repos is still compiled (when last checked) without some patch that allows it to run headlessly. I built from source, which was not too difficult.
I discovered the project Weasyprint[2] a few months ago. I find it easier to use, and very powerful when using Python. You can define a custom loader to inject images or styles generated on the fly for instance.
There are still some missing features compared to wkhtmltopdf, such as defining a custom footer and header, but it's a very promising project.
[1] https://wkhtmltopdf.org/usage/wkhtmltopdf.txt
[2] https://github.com/Kozea/WeasyPrint/