-
-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weasyprint 0.41 generating PDFs that don't convert nicely to PNG #550
Comments
I've reproduced your error using cairo 1.14.x (stable) and <1.15.4 (unstable) versions, but not with cairo >=1.15.4. I suppose it's a subtle bug in cairo's PDF backend that's been fixed with cairo's huge changes about generated PDF files in 1.15.4. I think that the bug was here from the beginning but is now triggered by the use of pdfrw since 0.41. As the bug is not triggered by other PDF readers (I've tried at least Google Chrome and Poppler's-based Evince), it may even be a bug in GhostScript (used by ImageMagick's Unfortunately, there's nothing I can easily do to fix that. Finding the root of the problem may take days, fixing it may take weeks, and having the fix upstream may take years (see #339 for example). Moreover, fixing cairo's stable branch when the unstable branch has already been fixed more than a year ago looks like a lot of wasted time 😢. As always with cairo, the easy solution is to use the unstable version (it's not unstable, trust me 😉). Cairo 1.15.8 is packaged for Debian testing, installing it instead of 1.14.x will probably work as the API didn't change much. |
Oh, there's another easy solution: you can use (And it's cool to know that UK's government is using WeasyPrint to generate letters 😄.) |
@leohemsted Can I do anything else for you? |
@jonlesser I've found that a bug has been fixed about that in Ghostscript 9.21 (see #615). Feel free to reopen this issue if it doesn't fix your problem. |
Hey, I've got a problem with weasyprint 0.41 where PDFs it generates have errors that make imagemagick break when trying to convert it to a PNG.
I've got a debian stretch docker container, and I call weasyprint inside it to generate a PDF, and then pass that PDF into imagemagick to create a png. imagemagick prints the following warning:
That's just a warning, it creates the image - however, it's an incomplete image, missing an embedded image from within the PDF. The PDF itself looks fine.
I've created a little test here:
Run the docker container, and grab the file out of it.
eg
docker build . -t weasytest && docker run -it -v ~/dev/weasytest:/real-world -t weasytest cp letter.png /real-world/letter.png && open letter.png
And the resulting image doesn't have a logo. If we edit the dockerfile to pin weasyprint to 0.40, then the image renders fine with the logo.
Can anyone advise on things that might be going on here?
The text was updated successfully, but these errors were encountered: