This release adds CSS custom properties, real block boxes and long-word wrapping. It also fixes a round of table, table-of-contents and chart bugs, and renders long documents with far less memory and time. The PDF output of the speed and memory work is byte-for-byte identical to 0.2.22.
🎉 New
- CSS custom properties:
--name: valueandvar(--name, fallback)work anywhere a value goes, including shorthands,@page,@frameand@font-face(#743). - A block's box goes round everything it holds: a
<div>with padding, a border or a background draws one box around its text, tables and inner blocks, and the box is cut cleanly at a page break. The border is no longer copied onto every paragraph and - Long words wrap:
overflow-wrap: break-word/anywhere(andword-wrap) break a wors a URL or a hash, andthis works on links.word-break: break-allis supported (#339). - Table sizing:marmargin: 0 autoapply to tables, and a CSSwidthon ais read (#386). A table with anauto` margin shrinks toon a table is honoured(#562). - **Links to other filesd other relative linksbecome real links (#660).
- Block height: a bld, and an empty blockwith a border or background is drawn.
- Charts: they read an entry per series via
seriesNames/seriesColors.💪🏼 Improvements
- Less memory, and faster. Peak memory for long documents drops to about 40% of what it was: 10,0tead of 371 MB, and a256-row table 14 MB instead of 26 MB. Rendering is 10–39% faster: each word is measured once, a paragrar width, and the parsedHTML is released before layout.
- CSS warnings name the file, a
<style>blockor astyleattribute (#780). - Headings inside table s appear in
<pdf:toc>. - Images Pillow refuses for their size are reported the same way
max_image_pixelsrepor
🐛 Bug fixes
- A `<link rel="stylesheropped.
- Named
@pagerules gave the first page the wrong size, and a leading<pdf:nexttemplate>cous template (#455). - Right-to-left tables of contents drew their page numbers over the titles, and long entries shrank #664).
- Cell padding was applied twice, and a table margin indented the text inside its cells (#386).
- Translucent backgrounds (
#rrggbbaa) were painted twice behind each line of text. - Chart options
barWidth,barSpacing,fontNameandstrokeColorcrashed or were ignored. - List markers fall back to a font that has their characters. ZapfDingbats and Symbol glyphs are no lon
page-break-inside: avoidon a single paragraph did nothing, and a heading could be left alone at t- A truncated or corrupt image no longer aborts the conversion.
- The
heightattribute
📘 Documentation
- The Django `link_callb Django (#548).
- New docs on
overflow-wrap,word-break,-pdf-word-wrap(#532), links, custom properties, posit tools/perfnow measures memory, leaks and large documents.
Full notes: https://xhtml2pdf.readthedocs.io/en/latest/release-notes.html