You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
no proper support for Python 3 (the developers seem unwilling to work with anyone on this)
requires a long list of C dependencies (including reportlab)
broken support for using many features of HTML/CSS such as images and links
once you get around all of the above, the resulting PDF typically isn't an accurate conversion of the input
wkhtmltopdf is a command-line application for generating PDFs off HTML pages, and supports a wide range of features that would be useful for Cartridge users. It uses the excellent WebKit browser engine for rendering.
I propose switching to my Python wrapper around wkhtmltopdf, pywkhtmltopdf. The code changes would be minimal and users could immediately start using more advanced features of HTML/CSS in the invoice template than they could before. Existing templates should work fine, though the specific layout and fonts may change slightly with the change in rendering engine.
Some work still needs to be done to pywkhtmltopdf - namely a test suite. I have opened an issue for that at sjkingo/pywkhtmltopdf#1 and should be able to knock that over in the next day or two.
One question comes to mind: since the library depends on a static binary that needs to be downloaded and installed somewhere on the PATH, how should we handle this initial setup? It would be best if the user has to do nothing - perhaps the setup.py script in pywkhtmltopdf can do this on install of the library? Obviously would need to ensure the correct binary is downloaded (Linux/Darwin/Windows, x86/x86_64 etc), but I'm sure some logic using import platform should be able to handle this.
Currently we use
xhtml2pdf.pisa
to generate the PDF invoice in cartridge/shop/views.py#L391.This has many drawbacks:
reportlab
)wkhtmltopdf is a command-line application for generating PDFs off HTML pages, and supports a wide range of features that would be useful for Cartridge users. It uses the excellent WebKit browser engine for rendering.
I propose switching to my Python wrapper around wkhtmltopdf, pywkhtmltopdf. The code changes would be minimal and users could immediately start using more advanced features of HTML/CSS in the invoice template than they could before. Existing templates should work fine, though the specific layout and fonts may change slightly with the change in rendering engine.
Some work still needs to be done to
pywkhtmltopdf
- namely a test suite. I have opened an issue for that at sjkingo/pywkhtmltopdf#1 and should be able to knock that over in the next day or two.One question comes to mind: since the library depends on a static binary that needs to be downloaded and installed somewhere on the
PATH
, how should we handle this initial setup? It would be best if the user has to do nothing - perhaps thesetup.py
script inpywkhtmltopdf
can do this on install of the library? Obviously would need to ensure the correct binary is downloaded (Linux/Darwin/Windows, x86/x86_64 etc), but I'm sure some logic usingimport platform
should be able to handle this.What are your thoughts @stephenmcd?
The text was updated successfully, but these errors were encountered: