WeasyPrint v56: Beta Time
WeasyPrint v56 is the next major version of WeasyPrint. We released a beta, you can give it a try and help us to have a nice stable major release! This version brings two new features and improves another one. Let’s see what we got!
Bitmap Fonts and Better line-clamp
Support
Thanks to the financial support of Expert Germany,
WeasyPrint has now a better support of line-clamp
and supports bitmap fonts 🎉.
Bitmap Fonts
You can now use your favorite OpenType bitmap (otb) fonts in your documents.
If you use rasterizer tools, like Poppler or Ghostscript, you’ll get pixel-perfect rendering ✨!
line-clamp
improvements
line-clamp
is a shorthand property for three different properties: max-lines
,
block-ellipsis
and continue
.
These properties are helpful to limit blocks height and to prevent strange layouts if the content is larger than expected. You can read our article to know more about it.
One of the limitations we had is that the max-lines
didn’t work with nested blocks,
which means you can limit the number of lines of a div
block
for example, but if this div
has some p
tags
inside, it wouldn’t work.
But now, this limitation is over! max-lines
works with nested tags. You can limit
your div
blocks with tons of other blocks inside, or your ul
blocks
with list items inside, or whatever you need 😊.
PDF/A Support
Thanks to the financial support of Blueshoe, you can generate PDF/A documents 🎉.
PDF/A is a version of PDF specialized for archiving and long-term conservation purposes.
Several conformance levels exist with different requirements. WeasyPrint supports:
- A-1b
- A-2b
- A-3b
- A-4b.
Each level of conformance hasn’t the same requirements about how and what has to be store in the document itself and which PDF version is needed.
How to generate PDF/A document?
To generate PDF/A document with WeasyPrint, a new option has been added:
--pdf-variant
. You can set the variant you need among pdf/a1-b
,
pdf/a2-b
, pdf/a3-b
and pdf/a4-b
.
You may also need to set an identifier to your generated document. You can do that
with the --pdf-identifier
option.
How to set PDF version?
As PDF/A conformance levels require different PDF version, a new option has been added
to set it: --pdf-version
. The default version is 1.7.
How to set custom metadata?
For archiving purpose, you may need to have custom metadata in your documents.
To do that, you add them in your HTML file with the
meta
tag.
When generating the PDF, use the --custom-metadata
option.
The generation of PDF/A document is experimental and the generated PDFs aren’t guarenteed to be valid. Don’t hesitate to open a new issue if you encounter problem with it 😉!.
What Are the Next Steps?
The next step is yours! Don’t hesitate to try this beta and report bugs you may find 🪲.
The one after is to fix the reported bugs and release a nice WeasyPrint version 56.
Thanks again to Expert Germany and Blueshoe for sponsoring these features. It has been a real pleasure to work with them!
Have fun with this beta 💜.