Is there any way to use Python to create PDF documents from HTML/CSS/Javascript, without introducing any OS-level dependencies?
It seems every existing solution requires special supplemental software, but upon reviewing PDF formatting specifications and HTML/CSS/Javascript rendering, there doesn't appear to be a reason why a Python solution can't exist without them. Some solutions come close, such as pyppeteer, but it still leans on a headless Chrome installation locally. These dependencies mean that microservices can't be leveraged, even though PDF generation would otherwise seem to be a viable use case for them.
While similar questions have come up many times over on SO, there doesn't appear to have been a viable technique shown without having to install specialized dependencies on the OS.
Some similar questions which routinely recommend wkhtmltopdf
or are otherwise out of date (e.g., moving PDF printing support outside of Chrome is dead now):
- How to convert webpage into PDF by using Python
- How to convert a local HTML file to PDF using Python in Windows
- HTML to PDF conversion using Chrome pdfium
- How does Chrome render PDFs from HTML so well?
- Convert a HTML/CSS/Javascript file to PDF using Python?
If I've somehow missed a viable approach, please feel free to mark this as a duplicate with my thanks!
from Creating PDFs from HTML/Javascript in Python with no OS dependencies
No comments:
Post a Comment