Weasyprint: Don't draw patterns for empty page backgrounds

Created on 30 Jan 2019  Â·  6Comments  Â·  Source: Kozea/WeasyPrint

We're having an issue when printing PDFs with software that uses Apache PDFBox. We opened a ticket with them and they claim that there is a problem with how WeasyPrint uses transparent backgrounds. Can this be addressed in WeasyPrint?

https://issues.apache.org/jira/browse/PDFBOX-4448

Most helpful comment

@liZe thanks for the patch!

Before 17cd8e9:

  • 😢 Apache PDFBOX takes 11 seconds, > 1GB heap

After 17cd8e9:

  • 😀 Apache PDFBOX takes 1 second, 37MB heap

Upgraded to master using:

pip3 install git+git://github.com/Kozea/WeasyPrint@master

All 6 comments

The PDF stuff is created by - - - Cairo :-1:

This issue is a duplicate of #238, but we may find a workaround for the particular case of empty backgrounds.

The PDF stuff is created by - - - Cairo

Well, it's probably WeasyPrint's fault here :wink:.

@Tontyna You'll be happy to know that fixing this bug is made complicated because of … a new bug in Cairo.

@thasmin This "bug" is now closed, as we don't draw empty patterns for empty page backgrounds anymore (see 17cd8e9).

It doesn't mean that this problem won't happen with other documents. The bug in Java Print Services can happen as soon as there's a transparent layout to draw. But the bug is not in WeasyPrint anymore :wink:.

@liZe thanks for the patch!

Before 17cd8e9:

  • 😢 Apache PDFBOX takes 11 seconds, > 1GB heap

After 17cd8e9:

  • 😀 Apache PDFBOX takes 1 second, 37MB heap

Upgraded to master using:

pip3 install git+git://github.com/Kozea/WeasyPrint@master

Great job finding and fixing this "bug". That was really quick. We appreciate the work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeffgabhart picture jeffgabhart  Â·  3Comments

ivanprice picture ivanprice  Â·  3Comments

whitelynx picture whitelynx  Â·  5Comments

Tontyna picture Tontyna  Â·  4Comments

Daniyal-Javani picture Daniyal-Javani  Â·  3Comments