Skip to content
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

Don't draw patterns for empty page backgrounds #780

Closed
thasmin opened this issue Jan 30, 2019 · 6 comments
Closed

Don't draw patterns for empty page backgrounds #780

thasmin opened this issue Jan 30, 2019 · 6 comments
Milestone

Comments

@thasmin
Copy link

thasmin commented Jan 30, 2019

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

@Tontyna
Copy link
Contributor

Tontyna commented Jan 30, 2019

The PDF stuff is created by - - - Cairo 👎

@thasmin thasmin closed this as completed Jan 30, 2019
@liZe
Copy link
Member

liZe commented Jan 30, 2019

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 😉.

@liZe liZe reopened this Jan 30, 2019
@liZe
Copy link
Member

liZe commented Jan 30, 2019

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

@liZe liZe closed this as completed in 17cd8e9 Jan 30, 2019
liZe added a commit that referenced this issue Jan 30, 2019
Cairo doesn't add links on empty pages, so we need to draw something on each
page in tests. This bug shouldn't happen with real life documents.

This issue appeared while fixing #780. Before that, empty pages were not empty
as they had at least an empty SVG drawn on the background.

See https://gitlab.freedesktop.org/cairo/cairo/issues/357
@liZe liZe added this to the 45 milestone Jan 30, 2019
@liZe liZe changed the title PDFs cause memory spikes in Apache PDFBOX Don't draw patterns for empty page backgrounds Jan 30, 2019
@liZe
Copy link
Member

liZe commented Jan 30, 2019

@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 😉.

@tresf
Copy link

tresf commented Jan 31, 2019

@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

@thasmin
Copy link
Author

thasmin commented Jan 31, 2019

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

netbsd-srcmastr referenced this issue in NetBSD/pkgsrc Feb 21, 2019
Version 45
----------

Released on 2019-02-20.

WeasyPrint now has a `code of conduct
<https://github.com/Kozea/WeasyPrint/blob/master/CODE_OF_CONDUCT.rst>`_.

A new website has been launched, with beautiful and useful graphs about speed
and memory use across versions: check `WeasyPerf
<https://kozea.github.io/WeasyPerf/index.html>`_.

Dependencies:

* Python 3.5+ is now needed, Python 3.4 is not supported anymore

Bug fixes:

* `798 <https://github.com/Kozea/WeasyPrint/pull/798>`_:
  Prevent endless loop and index out of range in pagination
* `767 <https://github.com/Kozea/WeasyPrint/issues/767>`_:
  Add a ``--quiet`` CLI parameter
* `784 <https://github.com/Kozea/WeasyPrint/pull/784>`_:
  Fix library loading on Alpine
* `791 <https://github.com/Kozea/WeasyPrint/pull/791>`_:
  Use path2url in tests for Windows
* `789 <https://github.com/Kozea/WeasyPrint/pull/789>`_:
  Add LICENSE file to distributed sources
* `788 <https://github.com/Kozea/WeasyPrint/pull/788>`_:
  Fix pending references
* `780 <https://github.com/Kozea/WeasyPrint/issues/780>`_:
  Don't draw patterns for empty page backgrounds
* `774 <https://github.com/Kozea/WeasyPrint/issues/774>`_:
  Don't crash when links include quotes
* `637 <https://github.com/Kozea/WeasyPrint/issues/637>`_:
  Fix a problem with justified text
* `763 <https://github.com/Kozea/WeasyPrint/pull/763>`_:
  Launch tests with Python 3.7
* `704 <https://github.com/Kozea/WeasyPrint/issues/704>`_:
  Fix a corner case with tables
* `804 <https://github.com/Kozea/WeasyPrint/pull/804>`_:
  Don't logger handlers defined before importing WeasyPrint
* `109 <https://github.com/Kozea/WeasyPrint/issues/109>`_,
  `748 <https://github.com/Kozea/WeasyPrint/issues/748>`_:
  Don't include punctuation for hyphenation
* `770 <https://github.com/Kozea/WeasyPrint/issues/770>`_:
  Don't crash when people use uppercase words from old-fashioned Microsoft
  fonts in tables, especially when there's an 5th column
* Use a `separate logger
  <https://weasyprint.readthedocs.io/en/latest/tutorial.htmllogging>`_ to
  report the rendering process
* Add a ``--debug`` CLI parameter and set debug level for unknown prefixed CSS
  properties
* Define minimal versions of Python and setuptools in setup.cfg

Documentation

* `796 <https://github.com/Kozea/WeasyPrint/pull/796>`_:
  Fix a small typo in the tutorial
* `792 <https://github.com/Kozea/WeasyPrint/pull/792>`_:
  Document no alignement character support
* `773 <https://github.com/Kozea/WeasyPrint/pull/773>`_:
  Fix phrasing in Hacking section
* `402 <https://github.com/Kozea/WeasyPrint/issues/402>`_:
  Add a paragraph about fontconfig error
* `764 <https://github.com/Kozea/WeasyPrint/pull/764>`_:
  Fix list of dependencies for Alpine
* Fix API documentation of HTML and CSS classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants