News

Latest version of WeasyPrint is v0.36, released on February 25, 2017 (changelog).

WeasyPrint 0.36

WeasyPrint 0.34, 0.35 and 0.36 have been released.

New features:

  • #407: Handle ::first-letter.
  • #423: Warn user about broken cairo versions.

Bug fixes:

  • #411: Typos fixed in command-line help.
  • #410: Fix AssertionError in split_text_box.
  • #398: Honor the presentational_hints option for PDFs.
  • #399: Avoid CairoSVG-2.0.0rc* on Python 2.
  • #396: Correctly close files open by mkstemp.
  • #403: Cast the number of columns into int.
  • Fix multi-page multi-columns and add related tests.

WeasyPrint 0.33

WeasyPrint 0.33 has been released.

New features:

  • #393: Add tests on MacOS.
  • #370: Enable @font-face on MacOS.

Bug fixes:

  • #389: Always update resume_at when splitting lines.
  • #394: Don’t build universal wheels.
  • #388: Fix logic when finishing block formatting context.

WeasyPrint 0.32

WeasyPrint 0.32 has been released.

New features:

  • #28: Support @font-face on Linux.
  • Support CSS fonts level 3 almost entirely, including OpenType features.
  • #253: Support presentational hints (optional).
  • Support break-after, break-before and break-inside for pages and columns.
  • #384: Major performance boost.

Bux fixes:

  • #368: Respect white-space for shrink-to-fit.
  • #382: Fix the preferred width for column groups.
  • Handle relative boxes in column-layout boxes.

Documentation:

  • Add more and more documentation about Windows installation.
  • #355: Add fonts requirements for tests.

WeasyPrint 0.31

WeasyPrint 0.31 has been released.

New features:

  • #124: Add MIME sniffing for images.
  • #60: CSS Multi-column Layout.
  • #197: Add hyphens at line breaks activated by a soft hyphen.

Bux fixes:

  • #132: Fix Python 3 compatibility on Windows.

Documentation:

  • #329: Add documentation about installation on Windows.

WeasyPrint 0.30

WeasyPrint 0.30 has been released.

WeasyPrint now depends on html5lib-0.999999999.

Bux fixes:

  • Fix Acid2
  • #325: Cutting lines is broken in page margin boxes.
  • #334: Newest html5lib 0.999999999 breaks rendering.

WeasyPrint 0.29

WeasyPrint 0.29 has been released.

Bug fixes:

  • #263: Don’t crash with floats with percents in positions.
  • #323: Fix CairoSVG 2.0 pre-release dependency in Python 2.x.

WeasyPrint 0.28

WeasyPrint 0.28 has been released.

Bug fixes:

  • #189: white-space: nowrap still wraps on hyphens
  • #305: Fix crashes on some tables
  • Don’t crash when transform matrix isn’t invertible
  • Don’t crash when rendering ratio-only SVG images
  • Fix margins and borders on some tables

WeasyPrint 0.27

WeasyPrint 0.27 has been released.

New features:

  • #295: Support the ‘rem’ unit.
  • #299: Enhance the support of SVG images.

Bug fixes:

  • #307: Fix the layout of cells larger than their tables.

Documentation:

  • The website is now on GitHub Pages, the documentation is on Read the Docs.
  • #297: Rewrite the CSS chapter of the documentation.

WeasyPrint 0.26

WeasyPrint 0.26 has been released.

New features:

  • Support the empty-cells attribute.
  • Respect table, column and cell widths.

Bug fixes:

  • #172: Unable to set table column width on tables td’s.
  • #151: Table background colour bleeds beyond table cell boundaries.
  • #260: TypeError: unsupported operand type(s) for +: ‘float’ and ‘str’.
  • #288: Unwanted line-breaks in bold text.
  • #286: AttributeError: ‘Namespace’ object has no attribute ‘attachments’.

WeasyPrint 0.20: Border radius

WeasyPrint 0.20 has been released with new features and bug fixes.

  • Add support for border-radius.
  • Feature #77: Add PDF metadata from HTML.
  • Feature #12: Use html5lib.
  • Tables: handle percentages for column groups, columns and cells, and values for row height.
  • Bug fixes:
    • Fix #84: don’t crash when stylesheets are not available.
    • Fix #101: use page ids instead of page numbers in PDF bookmarks.
    • Use logger.warning instead of deprecated logger.warn.
    • Add font-stretch in the font shorthand.

WeasyPrint 0.16: PDF zoom and bug fixes

A small release this time.

A new zoom parameter on PDF output can change the ratio between CSS length units and PDF units. The various CSS units however still have the same relative ratios: a CSS pixel is always one 96th of an inch. This can be a work-around for using an existing fixed-width CSS layout on various page sizes.

A few bugs in WeasyPrint were fixed and some in pycairo were worked around. This restores compatibility with Debian Squeeze and other distributions that still use broken versions of pycairo.

Changelog for 0.16.

WeasyPrint 0.15: More API, more docs, more fixes

0.15 is (finally!) out. This one is light in CSS features, but Sphinx-based documentation as well as a new API with low-level access to individual pages.

Backward-incompatible change: the HTML.get_png_pages() method is gone, it was ridiculously specific compared to the new API. It can be reproduced like this:

def get_png_pages(document):
    """Yield (png_bytes, width, height) tuples."""
    for page in document.pages:
        yield document.copy([page]).write_png()

Changelog for 0.15.

WeasyPrint 0.13: PyGTK compatibility

0.13 will fall back on PyGTK if PyGObject 3 is not available. This enables WeasyPrint to run and pass its tests on Debian Squeeze (the current stable, as of this writing.)

Hopefully this will make WeasyPrint easier to install on more platforms such as OS X. Testers wanted!

WeasyPrint 0.12: border-collapse and Flask-WeasyPrint

WeasyPrint 0.12 is out.

This release adds support for the collapsing border model of tables, through the border-collapse property. Previously, table borders were always separated. This new model is incompatible with table headers and footers: with border-collapse: collapse, <thead> and <tfoot> elements are treated like normal <tbody> groups and are not repeated on each page.

On an unrelated note, 0.12 also adds the URL fetcher hook to the public API. It allows to control or override how WeasyPrint accesses HTTP or other URLs for HTML documents, CSS stylesheets, and images.

Flask-WeasyPrint is a new extension that makes use of an URL fetcher to integrate WeasyPrint in a Flask application.

WeasyPrint 0.11: floats, Acid2 and unprefixing

WeasyPrint 0.11 is out.

It has not been long since 0.10, but the point of this release is to finally merge the support for floats and clear that we have had for a while in an experimental branch.

With this (and countless other bug fixes), WeasyPrint now passes the Acid2 test! See the details or try it yourself:

weasyprint http://www.webstandards.org/files/acid2/test.html acid2.pdf
weasyprint http://www.webstandards.org/files/acid2/test.html acid2.png

And now for something completely different, the image-rendering, transform, transform-origin and size properties are unprefixed. The prefixed form (eg. -weasy-size) is ignored but gives a specific warning.

You will need to change your stylesheets if you used any of these with a prefix.

As usual, the details of less visible changes are in the changelog.

WeasyPrint 0.8, tinycss and cssselect

Some new features as usual. The big one is automatic layout for tables. Roughly, columns will get their width determined by the amount of content.

Other important but more underlying changes are tinycss and cssselect. tinycss is a new CSS parser I wrote from scratch as a smaller and faster alternative to cssutils. You can read more about it on my blog. As to cssselect, I took over its maintenance after extracting it from lxml. It now supports most Level 3 selectors and can be extended more easily.

WeasyPrint 0.4 to 0.7; BSD license

I’ve been neglecting this “news” section for a while, and a lot has happened since then.

Versions 0.4 to 0.7 of WeasyPrint have brought many new features. The big ones are Python 3 support, page headers and footers with page counters, justified text, 2D transforms, and better page break control. The list of missing CSS 2.1 features is shrinking visibly.

Features aside, and perhaps more importantly, the project is now BSD-licensed starting from 0.7.1. (I did not bother to re-release the previous version with the new license, but just ask if you need them.) This less restrictive license will hopefully bring more users.

By the way, the project’s mailing-list is now up and running.

WeasyPrint 0.3: SVG images and generated content

New WeasyPrint release. The big features in 0.3 are SVG images and generated content with the :before and :after pseudo-elements. As usual, everything is in the changelog.

To use the latest and greatest WeasyPrint, you’ll need to upgrade cssutils to 0.9.8 and install CairoSVG.

Tables in WeasyPrint!

I just released WeasyPrint 0.2, now with tables!

This new version also has other minor new features and bug fixes. See the changelog for details.

WeasyPrint 0.1 is released

WeasyPrint finally got its first release! It’s a rendering engine for HTML and CSS that produces PDF.

This 0.1 release has support for basic CSS2.1 without tables, floats or absolute positioning. However it can already be useful for documents with a “simple” layout.

Grab it, use it, hack it: