Getting PDF error 135 when opening with Adobe
See original GitHub issueHave the simplest python script possible using the WeasyPrint tutorial. I’m using the latest versions of all libraries involved as I just set up everything for the first time.
Python code is:
from weasyprint import HTML, CSS HTML('http://weasyprint.org/').write_pdf('weasyprint-website.pdf')
When opening the pdf with adobe it tells me it wasn’t all readable and detected a problem, error 135. I can view the pdf in any web browser. So if I print to pdf from the web browser and reopen then it works, just can’t open direct after WeasyPrint creates the pdf from python. Any suggestions on how to troubleshoot this?
I’m integrating all this into an automation app that emails out reports to executives so the manual print to pdf work around for testing won’t work for me in production.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
This bug is caused by a bug in Cairo 1.17.4: https://gitlab.freedesktop.org/cairo/cairo/-/issues/449
Cairo 1.17.4 is not a stable versions and suffers from many bugs. Using the latest version of Cairo instead (1.16.0) fixes this problem.
Also note that the current
master
branch doesn’t use Cairo anymore.Having the same issue, the full error is “There was an error processing a page. There was a problem reading this document (135).”. Additional information reads “Dictionary keys must be direct name objects.”. A more minimal HTML producing this issue follows:
I haven’t tried downgrading Cairo yet, but I thought I would provide more information about the error along with a minimal test case.