NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #2052 most downloaded on PyPI
PDF generator using HTML and CSS
Latest stable
0.2.28
Last release 28 days ago
25 Oct 2026
Ships unpredictably
gaps range from 8 days to 1.5 years
Nearly every release is documented
notes for 36 of 36 stable releases
Nothing withdrawn
no release was ever pulled
16 years old
44 releases · first in 2011
Drag across the ruler to compare, or tap a release to open it.
Output for print shops: @page { bleed: 3mm; marks: crop cross } grows the page around its trim size, with a TrimBox and a BleedBox , backgrounds that
🎉 New
@page { bleed: 3mm; marks: crop cross } growsTrimBox and a BleedBox,device-cmyk() and cmyk() colours in CSS, written to the PDF inpdfx={"profile": ..., "condition": ...}, or--pdfx-profile on the command line, adds the output intent, XMP@font-face takes OpenType fonts with PostScript (CFF) outlines, andfonts extra, pip install 'xhtml2pdf[fonts]'. The first source ofsrc list that loads is used; the rest are fallbacks.🐛 Bug-Fixes
UniCNS-UCS2-H. Viewers thatbackground shorthand is read as thebackground: rgb(10.5, 0, 0) was taken for an image.@font-face by its .pfb file is embedded,.afm beside it, as one named by its .afm already was.list-style-image is drawn as vectors. It was rasterised with📘 Documentation
guide/printing.Your coding agent can read these notes before it upgrades. Set up the MCP server →
CSS counters and generated content: ::before and ::after with content (strings, counter(), counters(), attr()), and counter-reset and counter-incremen
🎉 New
::before and ::after with
content (strings, counter(), counters(), attr()), and
counter-reset and counter-increment. Headings can be numbered from
the stylesheet, 1., 1.1, 1.2, and the numbers appear in the
table of contents and the PDF outline as well. Fixes :issue:112.overflow and text-overflow: a line wider than a block whose
overflow is not visible is cut at the block's edge, and
text-overflow: ellipsis ends it with "…". With white-space: nowrap
this gives a one-line cell or block that ends in an ellipsis. The line
used to run on past the block, over whatever came next. Fixes
:issue:698.<pdf:insertpdf src="annex.pdf" pages="1-3"/> inserts the pages of an
existing PDF where it is written, each in its own size. They are numbered
and counted with the rest of the document, so <pdf:pagecount> and the
table of contents include them. Fixes :issue:551.🐛 Bug-Fixes
<h2>, or
goes from <h1> to <h3> -- no longer repeats a heading in the PDF's
outline for every level it skipped. Each entry goes under the nearest
heading before it with a lower level, or at the top with none, as in a
browser's document outline.encrypt with an owner password
only comes out unencrypted, as it always has: the background is merged in
by writing the document again, which cannot reapply the encryption. That
now logs a warning saying so, instead of happening silently.-pdf-keep-in-frame-mode on the cell still asks
for the old behaviour. Fixes :issue:402.<ol start="abc"> or <td colspan="x">, logs a warning and is
ignored, as a browser does. It raised ValueError and the whole
conversion failed. (:pr:851)| Thanks to the following people on GitHub for contributing to this release:
| RavSinghChandan, who made a bad integer attribute a warning instead of
a failed document (:pr:851).
🎉 New
::before and ::after withcontent (strings, counter(), counters(), attr()), andcounter-reset and counter-increment. Headings can be numbered from1., 1.1, 1.2, and the numbers appear in the112.overflow and text-overflow: a line wider than a block whoseoverflow is not visible is cut at the block's edge, andtext-overflow: ellipsis ends it with "…". With white-space: nowrap698.<pdf:insertpdf src="annex.pdf" pages="1-3"/> inserts the pages of an<pdf:pagecount> and the551.🐛 Bug-Fixes
<h2>, or<h1> to <h3> -- no longer repeats a heading in the PDF'sencrypt with an owner password-pdf-keep-in-frame-mode on the cell still asks402.<ol start="abc"> or <td colspan="x">, logs a warning and isValueError and the whole851)| Thanks to the following people on GitHub for contributing to this release:
| RavSinghChandan, who made a bad integer attribute a warning instead of
a failed document (:pr:851).
and inside a block with a border, a padding, a background or a width, a table cell or a flex item show their number. They came out blank, leaving the
🐛 Bug-Fixes
<pdf:pagenumber> and <pdf:pagecount> inside a block with a
border, a padding, a background or a width, a table cell or a flex item
show their number. They came out blank, leaving the space: This file has pages.<canvas type="graph"> written amid the text of its block is drawn,
with the text before and after it. The text before it was read as part
of the chart's JSON, so the chart was dropped and its JSON printed.horizontalline chart takes its categoryAxis, the way a bar chart
does: the colour of the axis and the angle and colour of its labels were
ignored.🧹 Cleanup
Apache-2.0, which
setuptools 77 and later ask for; building the package no longer warns
about the licence table and classifier.Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.25...v0.2.26
pyHanko is no longer installed with xhtml2pdf. Signing a PDF needs the signing extra, which all includes: pip install xhtml2pdf[all] installs what a p
⚠️ Important notes
pyHanko is no longer installed with xhtml2pdf. Signing a PDF needs the signing extra, which all includes: pip install xhtml2pdf[all] installs what a plain install did before. Without it, asking for a signature raises an ImportError that names the extra, rather than writing an unsigned PDF. Fixes 809 and 755.
🎉 New
-pdf-frame-pages: last paints a Static Frame on the last page only, and not-last on every page but the last: a signature block or a closing footer at the end of a document of any length. See format_html. Fixes 105.
-pdf-frame-align: bottom puts a block at the bottom of the page it lands on, and moves it whole to the bottom of the next page when it does not fit: a signature at the foot of the last page. See format_html. Fixes 429.
<pdf:resetpagenumber value="1"/> starts the page numbering again on the page it falls on, for the headers and footers, <pdf:pagenumber> in the flow and the table of contents. Fixes 461.
🐛 Bug-Fixes
Conversions in different threads of a process no longer swap fonts. Two documents converted at once could come out with the bold or italic of a family missing, or drawn with another document's file, with no error. A process now converts one document at a time; see the Python API reference for converting in parallel with processes.
Two documents that name a font-family the same and embed different files each draw with their own, also one after the other. The second used to be drawn with the first one's file, with a warning.
Every image is drawn with its own pixels again. Since 0.2.23 a document with several PNGs (or GIFs, or any image other than a JPEG) drew each of them as the first one: a logo and two charts came out as three logos. Fixes 848.
An inline element with padding or a border right after a <br/> no longer fails the render with IndexError: string index out of range when its text starts with whitespace, such as  . Fixes 849.
A non-breaking space at the start of a line after a <br/> is kept, as a browser keeps it: <br/>  text is indented by two spaces, not one.
The top and bottom margins of a <div> (or any block without padding, a border or a background) are kept when what it holds are paragraphs or other blocks with margins of their own. The block's margin goes above its first child and below its last, collapsing with theirs to the larger one as in a browser; a <div style="margin-bottom: 1in"> around a <p style="margin: 0"> used to leave no room at all. Text directly inside such a block no longer repeats the block's margins above and below every paragraph of it, and a block's vertical margins are no longer inherited by the blocks inside it. Fixes 310.
<pdf:pagecount> written in the flow, outside a static frame, shows the number of pages of the document. On the pages laid out before the last one it showed how many pages there were so far: Page 1 of 1 on the first page of two.
padding on <body> or <html> is room around the page content, given once: the sides indent every block and the tables in the flow, the top is room above the first block. Every paragraph used to draw it again, so a body with padding: 20px spread its lines down the page. Fixes 728.
A <canvas type="graph"> chart takes the margins and the padding of the block around it, its own margins when it is display: block, and the text-align of its block: text-align: center centres it. It was always put at the left edge, flush against what came before and after. Fixes 693.
width on a <div>, a <p> or any other block is applied: a length, or a percentage of the block that contains it, as the width of its content box. margin: 0 auto centres the block and margin-left: auto puts it on the right. A block always took the whole width of the frame. Fixes 545.
Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.24...v0.2.25
Parentheses, brackets, «» and the other mirrored characters face the right way in right-to-left text: (א) used to be drawn )א(. Bracket pairs now take
🐛 Bug-Fixes
Parentheses, brackets, «» and the other mirrored characters face the right way in right-to-left text: (א) used to be drawn )א(. Bracket pairs now take the direction of what they enclose, as a browser lays them out, and the invisible bidi controls (U+2066–U+2069, U+202A–U+202E, the marks U+200E, U+200F, U+061C) are no longer drawn as boxes.
A simple signature with a ca_chain – the first example in Encryption and signing – signs. The chain was read and parsed, then handed to pyHanko as file names, and every such signature failed with “expected str, bytes or os.PathLike object, not Certificate”.
A pkcs11 signature that names its token with token_label works with pyHanko 0.37, which removed open_pkcs11_session(token_label=...); the label now goes through token_criteria.
A table row that fits no page – such as a row with a long text in a narrow column that would fit a page alone but not under the repeated header – is cut between pages and goes on under the header, instead of stopping the whole render with LayoutError: ... too large on page. Content wider than the cell does not stop the cut either. A row crossed by a rowspan still fails as before.
A long table in a document with pdf:pagecount or pdf:toc no longer keeps every part of it already drawn until the end. Each part that went on to the next page was remembered, with the rest of its table, to be undone between passes; it is remembered weakly now. A 500-row report peaked at 58 MB instead of 166 MB, with the same PDF.
Right-to-left text is put in the order it is drawn one line at a time, after the lines are broken, instead of one fragment at a time before. A paragraph of several lines had its last words on its first line, and an entity (—, «) or an inline tag such as < b > in the middle of a sentence split it into halves that came out the wrong way round. The text itself now keeps the order it was written in, so the PDF outline and the document title are no longer stored reversed.
Dashed and dotted borders on table cells are drawn dashed and dotted. The squared line ends a table border is stroked with closed up every gap, so they always came out as solid lines.
⚠️ Deprecation
🧹 Cleanup
Full Changelog: v0.2.23...v0.2.24
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, an
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.
--name: value and var(--name, fallback) work anywhere a value goes, including shorthands, @page, @frame and @font-face (#743).<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 andoverflow-wrap: break-word / anywhere (and word-wrap) break a wors a URL or a hash, andthis works on links. word-break: break-all is 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).seriesNames / seriesColors.<style> blockor a style attribute (#780).<pdf:toc>.max_image_pixels repor@page rules gave the first page the wrong size, and a leading <pdf:nexttemplate> cous template (#455).#rrggbbaa) were painted twice behind each line of text.barWidth, barSpacing, fontName and strokeColor crashed or were ignored.page-break-inside: avoid on a single paragraph did nothing, and a heading could be left alone at theight attributeoverflow-wrap, word-break, -pdf-word-wrap (#532), links, custom properties, posittools/perf now measures memory, leaks and large documents.Full notes: https://xhtml2pdf.readthedocs.io/en/latest/release-notes.html
Released: 2026-10-07
🎉 New
CSS custom properties. --name: value is declared and inherited like any property, and var(--name) or var(--name, fallback) reads it anywhere a value goes, shorthands included; @page , @frame and @font-face read the ones declared for :root or html . A var() used to drop its declaration, with “cannot evaluate: var()” ( #743 ).
overflow-wrap: break-word (or anywhere , or word-wrap , its old name) breaks a word wider than its line – a URL, a hash – into pieces that fit, and works on an inline element such as <a> . word-break: break-all is -pdf-word-wrap: CJK under its standard name. A long word used to run off the page ( #339 ).
<a href="other.pdf"> opens that file, next to the PDF, and any other relative href is a link with the reference as written. They used to be no link at all ( #660 ).
margin-left and margin-right on a <table> narrow it, on every page it is split across, and margin: 0 auto centres it; a CSS width on a <table> is read, and wins over the attribute ( #386 ).
A <table> with an auto margin and no width of its own is as wide as its content, each column as wide as what it holds, and is centred or aligned in what is left; it used to fill the frame. A height on a <table> is its minimum, shared among the rows; it was ignored ( #562 ).
A block’s box goes round all it holds. A <div> (or any block) with a padding , a border or a background draws it once, around its text, tables and inner blocks, which are laid out inside its padding. Its border and padding used to be copied onto every paragraph, and onto the table, its rows and cells, so a bordered <div> round a table drew the border round the table and each cell, and a box round each paragraph. A page break inside the block cuts the box, with no edge at the cut, and a heading inside it still reaches the table of contents ( #627 , #386 ).
A block’s CSS height is the least its content area takes; it was read only for images, cells, flex items, barcodes and positioned boxes. An empty block with a border or a background is drawn, padding and borders tall, so a bordered empty <div> is a rule and one with a height is a spacer.
A bar or line chart reads valueAxis : valueMin , valueMax , valueStep , forceZero , the grid and the label format, so bars can start at zero. Its legend has an entry per series, named by the new seriesNames and coloured by the new seriesColors , which also gives a fourth series a colour of its own; the legend used to be empty, and a colorNamePairs written in the JSON is now kept.
💪🏼 Improvements
Less memory, and faster. A long document peaks at about 40% of the memory it used to: 10,000 paragraphs at 142 MB rather than 371 MB, a 256-row table at 14 MB rather than 26 MB. A fragment of text holds only what its element changed, not all of its 93 attributes, and the parsed HTML is released before the PDF is laid out rather than after. Rendering is 10-39% faster: each word is measured once per document, a paragraph’s lines are broken once per width however often a table or frame asks, and frames, paragraphs and styles copy themselves directly. The PDF that comes out is the same, byte for byte.
A warning about a stylesheet names it: its path or URL, <style> block 2 , or the style attribute of <p> ( #780 ). That includes the warnings about properties xhtml2pdf does not implement and values it cannot evaluate, now one line per source, and a property in a style attribute, such as opacity , is reported too; it used to be dropped without a word.
"@page body" with a pdf:nexttemplate before any content warns that the template it names begins on the second page: @page body is the unnamed @page by its name.
An image Pillow refuses to open for its size is refused as max_image_pixels refuses one, and every pixel refusal names its image; it was a traceback, or “an image”.
A heading inside a table cell or a -pdf-keep-in-frame-mode block has its entry in pdf:toc , as it had in the outline; a header row a split table repeats counts once.
🐛 Bug-Fixes
A <link rel="stylesheet"> after a <style> was dropped with “Ignoring @import after the first rule”.
A stylesheet with only named @page rules: the first page took the size of the last of them, and a pdf:nexttemplate before any content could not reach it, so the first page was always the default one. Each @page now starts from the unnamed one’s size, and a leading pdf:nexttemplate names the first page’s template when there is no unnamed @page ( #455 ).
The page numbers of a right-to-left table of contents were drawn under a point, over the titles, and its levels were not indented. They are drawn on the left, and the levels indented from the right ( #664 ).
A table of contents entry whose title filled its last line left its page number no room, in either direction, and the number shrank to under a point. The title’s last word moves to the next line instead, and the number keeps its size ( #664 ).
The text of a cell in a <table> with a margin-left or margin-right was indented by that margin as well, and squeezed into a cell that much narrower; inside a block with a margin it was indented by the block’s, though the table was not. A cell’s text starts at the cell ( #386 ).
A cell’s padding was applied twice, by the cell and again by its text, so a cell with padding: 6pt had its text 12pt in from each side, and rows that much taller.
A pdf:toc inside a block with a box was drawn below an empty box. It is drawn inside it ( #627 ).
overflow-wrap on a link did not break it when text was glued to it, as in <a>…</a>. or (<a>…</a> . It breaks within the link, and the glued text stays with it ( #339 ).
A background with an alpha, #rrggbbaa , was painted twice behind each line of text, and the text over it came out as translucent as the background.
barWidth or barSpacing in a chart’s JSON ended the conversion with a TypeError; fontName raised unless it was the internal name of the face, and now takes a font-family; a line chart’s strokeColor was dropped.
A list’s number was drawn in the first family of its font-family list, blank if that face had no digits and without a warning. It takes the first family that has its characters, and says so if none does.
Every dingbat in ZapfDingbats, and the Greek mu, Delta and Omega in Symbol, were reported as characters no font could draw.
page-break-inside: avoid did nothing on a block of one paragraph, and a heading with page-break-after: avoid before a block kept whole was left alone at the foot of the page. Both stay together now.
A truncated or corrupt image ended the conversion with an OSError when it was drawn. It is left out with a warning, and a list falls back to its ordinary marker.
The height attribute of a <td> or <th> was never read; only the CSS height set a row’s height. The attribute sets it too, a bare number in points as for width , and the CSS property still wins.
📘 Documentation
tools/perf measures memory ( bench.py --memory ), what repeated renders leave behind ( --leak ) and large documents ( --large ); profile.py is profile_doc.py , as on Python 3.13 the old name hid the standard profile module and the script could not start.
The Django link_callback example works on a current Django: it hands finders.find a name rather than a URL, copes with STATIC_URL = "static/" and resolves a bare file name against BASE_DIR ( #548 ).
-pdf-word-wrap is explained, as are overflow-wrap and word-break ( #532 ).
The HTML reference has sections on links and on custom properties, and says what the first page of a document is, @page body included; the page-template example works as written.
The reference says how to put an absolutely positioned box on the page it is written on, and no longer says a block’s background is painted paragraph by paragraph; the graphics guide documents valueAxis , seriesNames and seriesColors .
CSS positioning. position: relative, absolute and fixed now work, with top/right/bottom/left and z-index. An absolute box is placed from its positione
CSS positioning. position: relative, absolute and fixed now work, with top/right/bottom/left and z-index. An absolute box is placed from its positioned ancestor, so you can put text over an image. A fixed box repeats on every page, and a negative z-index paints under the flow. These properties used to be ignored (#449, #566, #638).
Safer rendering of untrusted HTML. ResourceAccessPolicy.server() turns on a full set of limits in one call:
max_local_bytes and max_image_pixels, checked before an image is decodedRenderLimitErrorPage breaks. page-break-before/after/inside: avoid and the CSS 3 break-* properties are supported (#27).
color: transparent and hex colours with alpha (#rgba, #rrggbbaa) (#811)<tr> no longer aborts the document (#323); <thead>/<tbody>/<tfoot> backgrounds are painted (#806); a rowspan stops at the end of its group (#470)rem is relative to the root font size (#726)<pdf:pagenumber/> alone in its block now prints (#670)<a href="#x"> links to any id="x" (#615); an image inside a link is clickable (#491)@page margins combined with a content @frame (#303, #765)-pdf-keep-in-frame-mode is read from the <td> (#220)xhtml2pdf - - writes a valid PDF to stdout (#464); the debug log no longer dumps the source document (#92)ParaFrag.clone behaves in your processReportLab 4.4.9 is now the minimum (it was 4.0.4). The <pdf:toc> support has needed 4.4.9 since 0.2.19, so any document with a <pdf:toc> already failed on older versions. CI now also tests this minimum version.
Full notes: https://xhtml2pdf.readthedocs.io/en/latest/release-notes.html
Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.21...v0.2.22
Released: 2026-10-07
🎉 New
CSS positioning. position: relative moves a block without moving anything around it. position: absolute takes an element out of the flow into a box of its own, placed from its positioned ancestor – text over an image in a relative block – or, with none, from the first page’s area, as a browser does. position: fixed repeats the box on every page. Boxes are painted over the flow in z-index order, and under it with a negative z-index . position , top , right , bottom , left and z-index used to be ignored ( #449 , #566 , #638 ).
page-break-*: avoid. page-break-after: avoid keeps a block with what follows it, page-break-before: avoid keeps what came before with it, and page-break-inside: avoid moves a block to the next page whole when it does not fit. break-before , break-after and break-inside , the CSS 3 names, are read as the same properties ( #27 ).
<a href="#x"> links to any element with id="x" , not only to an <a name="x"> ( #615 ).
An image inside <a href> is a link ( #491 ).
The hex colours with an alpha channel, #rgba and #rrggbbaa , are read ( #811 ).
💪🏼 Improvements
ResourceAccessPolicy(max_local_bytes=...) bounds local files and data: URIs, which were read whole whatever their size; a local file is refused from its size on disk. Off by default.
ResourceAccessPolicy(max_image_pixels=...) refuses an image from the pixel count in its header, before it is decoded. Off by default.
A render can be bounded as a whole: max_resources , max_total_bytes , max_fetch_seconds (a deadline on one fetch that a server dripping a byte at a time cannot outlast), max_render_seconds , max_document_bytes and max_depth . The last three abandon the render with the new RenderLimitError . All are off by default.
ResourceAccessPolicy.server() turns every limit on at once, with values meant for rendering untrusted HTML; the security guide lists them and has a checklist for deploying on a server.
ResourceAccessPolicy(allow_remote_pdf_backgrounds=False) refuses a PDF page background that was fetched or written inline.
The temporary files of a render are made in a directory of its own, 0700, removed as a whole when the render ends, and no longer logged at warning level.
Only an image that may be SVG is handed to svglib; a JPEG or a PNG used to go through the SVG parser first, and was taken for a raster once it had failed.
🐛 Bug-Fixes
Importing xhtml2pdf no longer changes how reportlab’s own Paragraph clones its fragments. ParaFrag.clone was replaced for the whole process, so an application also using reportlab directly lost a fragment’s bullet, and the inline image or anchor of one cloned with changes. The behaviour is kept for xhtml2pdf’s own fragments, now a subclass.
A signing input – ca_chain , a CRL, an OCSP response – outside the document’s directory was refused by the document’s resource policy, and the signature then failed with an unrelated TypeError . They are read as the caller’s own files, signature["policy"] can confine them, and one that cannot be read is a ValueError that names it.
trust_roots , extra_trust_roots and other_certs in a signature’s validation_context were loaded from ca_chain instead of from their own files, and were dropped when there was no ca_chain .
A PDF page background that pypdf could not read aborted the render; it is logged and left out.
color: transparent came out black. The text is drawn with no ink now, and color: #0000 no longer aborts the document ( #811 ).
An empty <tr></tr> at the end of a table aborted the document with reportlab’s “N rows in data but N-1 row heights”. An empty row now has no height, as in a browser, in the middle of a table too ( #323 ).
A background-color on <thead> , <tbody> or <tfoot> was ignored ( #806 ).
A rowspan reaching past the end of its <tbody> pushed the next group’s cells one column to the right; it stops at the end of its group, as HTML says ( #470 ).
A grey PNG with an alpha channel came out as a black box ( #349 ).
rem was relative to the element’s own font size; it is relative to the root’s ( #726 ).
pdf:pagenumber/ or pdf:pagecount/ alone in a frame, cell or paragraph printed nothing ( #670 ).
A margin on @page together with a content @frame made the story overprint itself on the first page and never reach the next. The margins only make the content frame when no @frame is one ( #303 , #765 ).
-pdf-keep-in-frame-mode on a <td> holding a block was read from the block, not from the cell ( #220 ).
The bullets and numbers of a right-to-left list were drawn on the left. They are drawn on the right, in visual order, and the default stylesheet indents a :dir(rtl) list from the right ( #663 ).
On Windows, the drive letter of a path such as C:\docs\a.html was taken for a URL scheme, and every relative image, stylesheet and font of the document was looked for in the wrong place ( #447 ).
xhtml2pdf - - wrote its progress message into the PDF on stdout and then failed writing the PDF; the PDF goes to stdout alone and the message to stderr ( #464 ).
The debug log no longer repeats the whole source document ( #92 ).
📘 Documentation
The Python reference says that default_css replaces the predefined CSS rather than adding to it, and how to extend it ( #735 ).
The HTML reference lists page-break-inside and the break-* properties.
The HTML reference describes position , its offsets and z-index , and what differs from a browser.
The security guide has a checklist for deploying on a server and lists the limits ResourceAccessPolicy.server() turns on.
The signatures guide says how the signing inputs are read, how to confine them with signature["policy"] , and what pyHanko fetches from the network on its own.
⚠️ Deprecation
ReportLab 4.4.9 is now the lowest version required. xhtml2pdf has needed it since 0.2.19 – the table of contents uses TableOfContents ’ notifyKind (4.2.2) and Canvas.setNamedCB (4.4.9) – while still declaring 4.0.4, so with 4.0.4 to 4.4.7 installed every document with a pdf:toc failed. The lowest version is now tested as well.
🧹 Cleanup
Importing xhtml2pdf no longer sets reportlab’s rl_settings.warnOnMissingFontGlyphs , a process-wide change that never took effect anyway.
The PDF producer is set with Canvas.setProducer and the font registry is queried with getRegisteredFontNames() , reportlab’s public API, instead of private attributes.
A contract test covers every reportlab import and private attribute xhtml2pdf relies on, and fails on an import that is not registered; CI runs a py3.10-rlmin leg with the lowest supported reportlab.
Release 0.2.18: ReportLab 5, Python 3.10–3.14, and a browser conformance oracle for CSS by @luisza in https://github.com/xhtml2pdf/xhtml2pdf/pull/834
Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.18...v0.2.21
Released: 2026-09-26
🎉 New
Rounded corners. border-radius and its four longhands, with one to four values, the / form for elliptical corners, lengths and percentages of the box. Blocks, flex containers and items, inline blocks, inline boxes, images, tables and table cells are rounded: the background and its image are clipped to the curve, and the border follows it, a thick side tapering into a thin one through the corner as in a browser. A block split between pages is rounded at both ends of each part; a flex box, an inline box or a table cut by a line or page break is square at the cut. A background-color with a radius on a <span> is drawn as one rounded box, which is how a pill badge is written. See the Rounded corners section of the HTML reference for what differs from a browser.
Selectors Level 4. :not() with a list of selectors, :is() , :where() , :has() ( p:has(> img) , h2:has(+ p) ), and :nth-child(2 of .x) / :nth-last-child() with of . Before, the argument of each was read as a value and the whole rule was dropped without a word. Also [type=text i] and s , :lang() , :dir() , :scope , :link and :any-link , and the form states :checked , :default , :disabled , :enabled , :required , :optional , :read-only , :read-write and :placeholder-shown , all read from the document as written. dir="auto" matches neither :dir(ltr) nor :dir(rtl) . The form states only select: a disabled or readonly field is still editable in the PDF. As in a browser, [type=text] selects type="TEXT" : HTML’s type , lang , dir , rel and the other attributes it lists compare ignoring case on HTML elements, unless the selector says s .
🐛 Bug-Fixes
dir="auto" is no longer reported as a wrong value of dir ; the element keeps the direction it inherits.
Pseudo-class specificity. A pseudo-class counted as a type rather than a class, so div p:first-child lost to .x p .
A space before the ] of an attribute selector, [type=text ] , no longer drops the rule.
A stray } no longer hangs the parser. Since 0.2.18 a } with
no open block at the top of a stylesheet – one that closes a rule twice,
as the stylesheet svc.webspellchecker.net serves does – made pisa.CreatePDF loop forever: the malformed-rule skip hands a leading } back for an enclosing block to close, and at top level nothing
consumed it. The } now joins the next rule’s prelude and that rule
is dropped with its whole block, as CSS Syntax 3 specifies. The block of
an at-rule the parser does not support ( @keyframes , @supports )
is skipped to its matching } rather than parsed as a stylesheet,
which read that } as a stray one and hung the same way. A } inside a quoted string, as in content: "}" , does not end that block.
An at-rule the parser does not support and that has no block, such as @layer base; , is skipped instead of raising a TypeError that aborted the whole document.
Invalid CSS is dropped, not fatal. As CSS Syntax 3 says, what the parser cannot read is now skipped and the rest of the stylesheet applies: an at-rule up to its ; or through its block, a declaration up to its ; . Until now only a malformed selector was recovered from; anything else raised out of pisa.CreatePDF and the document was lost. That covered a malformed @import , @namespace or @charset , @media or @page with no block, an at-rule the parser skips ( @keyframes ) inside @media or @page , and a broken inline style , such as width: calc(1px . An invalid declaration – !ie , the *font hack, color: red;; – used to take the whole rule with it; now only the declaration goes. The end of a stylesheet closes any block still open, so p { color: red applies.
unicode-range no longer aborts the document. It raised an IndexError – and every @font-face Google Fonts serves has one.
Attribute selectors. [attr^=v] , [attr$=v] and [attr*=v] work; ^= used to raise out of the document. [lang|=GB] no longer matches lang="en-GB" : |= is a prefix up to a - . And elements that differ only in an attribute a rule selects by, such as a <p title="a"> next to a <p title="b"> , are styled each on its own: the style cache ignored attributes and gave the second one the first one’s style.
Text past Latin-1 in CSS strings. font-family: "宋体" was not read as a string at all, '宋体' kept its quotes in the font name, and content: "a宋" lost its rule.
inherit works. It was ignored on every property: the parent’s
value was found and then an error raised anyway. border-radius accepts it too.
Sibling selectors. h1 + p coloured every paragraph after the heading, and h1 ~ p and p + p none: siblings shared the style cache’s entry, as with attributes above.
An @import after another rule is ignored, as CSS 2.1 requires, and a selector with a namespace prefix no @namespace declared drops its rule. |p selects only elements in no namespace; it matched any.
Paragraphs are as tall as they are drawn. With a font whose ascent and descent pass 1.2em – Noto Sans, Nunito Sans, Roboto – and a line-height over 1.2, a paragraph was measured about a point per line shorter than it was drawn: the next block ran over its last lines, and a paragraph split at a page break ran past the bottom margin. Lines holding an inline block did the same. Measuring now uses the drawing’s own formula, so text that overlapped moves down to where it belongs.
An inline box nested in another is no longer covered by the outer one’s background, which used to be painted last.
⚠️ Deprecation
CSSParser.parse() and parseInline() no longer raise CSSParseError on invalid CSS: what cannot be read is skipped and logged as a warning. CSSParseError lost setFullCSSSource() and its fullsrc , inline , srcFullIdx and ctxsrcFullIdx attributes, which held the whole stylesheet.
The attribute operators &= , != and <> , which no CSS specification defines, drop their rule.
Thanks to the following people on GitHub for contributing to this release:
Chaitu5210 , whose rounded-corners branch was the starting point, and rafalbielicki-netizen , who found and fixed the stray } hang.
CSS flexbox. display: flex lays the element's children out in a row or a column, following CSS Flexible Box Layout Module Level 1: flex-direction, fle
🎉 New
display: flex lays the element's children out in a
row or a column, following CSS Flexible Box Layout Module Level 1:
flex-direction, flex-wrap, flex-flow, justify-content,
align-items, align-self, align-content, gap/row-gap/
column-gap, flex-grow, flex-shrink, flex-basis, flex,
order, min-/max-width/height on the items and margin: auto. Before this display: flex fell through to inline and the
children ran into their parent's text. See the Flexbox section of the
HTML reference for what is and is not supported.display: inline-block. A box inside the line of text, with its
own width, height, padding, border and background, placed by
vertical-align like an inline image. Form controls -- <input>,
<select>, <textarea> -- are inline blocks by default and sit in
the line instead of each closing the paragraph it was in.padding, a border, a
background-image or side margins is drawn as a box around its text,
in the line: the padding widens the line, the box is painted under the
words, and one cut by a line break or a page break goes on from the
next line without an edge at the cut. Before this, padding and borders
on a <span> were ignored.font-family list is matched per character, as CSS says it is.
The first family that existed used to draw everything, so a document
naming a Latin face first lost every character that face had no glyph
for: ěščřžýáíéí came out ■š■■žýáíéí, the boxes being exactly the
letters Helvetica lacks. font-family: Helvetica, MySans now reaches
MySans for those and leaves the rest where it was, and
font-family: "Noto Sans Devanagari", "Noto Sans" gives a Devanagari
subset font the Latin it does not carry. A character no family on the
list has is reported, by character and by the fonts tried.dir="rtl" or
with <pdf:language name="arabic"/> now turns the document round
rather than only reshaping its text: paragraphs are aligned to the right
unless text-align says otherwise, and a table's columns run from the
right, so the first <td> of a row is its rightmost cell. Hebrew or
Arabic inside an otherwise left-to-right paragraph is reordered too --
the bidirectional algorithm used to run only on documents that declared
a direction, so a Hebrew word in an English sentence read backwards.💪🏼 Improvements
display now means something: table,
list-item, flow-root, grid and the table-* values are
laid out as block (before, only block and none were looked
at, so display: table on a <div> did not even make it a block),
and a value this library does not know is reported once rather than
silently treated as inline.flex, flex-flow and gap shorthands are expanded, and a
flexbox value this library does not support (align-items: last baseline is drawn as flex-end) is reported once, by value.align-items: baseline and align-self: baseline line flex items
up on the first baseline of their text, the way a browser does; an
item with no text is aligned by its bottom edge. An inline block with
vertical-align: baseline sits on the baseline of its last line of
text rather than on its bottom edge.sans and sansserif were listed, so sans-serif
-- the commonest font-family there is -- matched nothing and arrived at
Helvetica through the fallback. cursive, fantasy, system-ui,
math and the ui-* families are answered too, each with the nearest
base-14 face.font-family that names
nothing the document knows, a @font-face whose src could not be
read, a CJK name ReportLab does not have, and a second @font-face
reusing a family name already embedded in the process from another file
each now say so, naming the family and what was used instead. All four
used to end in Helvetica with nothing in the log, which made a missing
font indistinguishable from a missing glyph.🐛 Bug-Fixes
@font-face could not be converted:
ReportLab's open of the font raised PermissionError/TTFError.
xhtml2pdf wrote the font to a NamedTemporaryFile, kept the handle
open and handed ReportLab the name, and on Windows that handle is an
exclusive share, so the second open could not succeed. A name handed out
for another library to open now belongs to a closed file, removed at the
end of the render instead of on close. The same applies to the canvas a
watermark is drawn on.<span> with padding, a border or a
background -- a display: inline-block, or any form control,
which is an inline block by default, stopped the conversion with
OSError: Cannot open resource ...afm, while looking for faceName=...
in any document whose font came from @font-face. The frag that
carries the box holds no text, so it never passed through the step that
turns a family name into the concrete face registered for it, and an
embedded TTF is registered as <family>_00. A base-14 family happened
to survive because it is registered under its own name.# prefix -- the way to embed
several TTFs that share one internal face name -- was registered with the
# stripped and looked up with it kept, so it was never found and the
text was drawn in Helvetica.bytes ignored the encoding argument. Only a
str source carried the caller's encoding through to the HTML parser;
bytes fell through to the parser's own sniffing, whose last resort is
windows-1252, so UTF-8 bytes came out as mojibake -- a bullet as
• -- however plainly encoding="utf-8" had been passed. Naming
no encoding still leaves the document's own <meta charset> to decide.dir="rtl" on a <div> or a
<p>, or a <pdf:language> naming a right-to-left language, was one
value for the whole file, set by whichever element declared it last and
never put back -- so a single right-to-left paragraph left every table
after it with its columns reversed and every paragraph right-aligned with
its full stop moved to the front. It is bounded by the element that
declares it now, and <pdf:language name=""/> ends it where it says it
does.dir="rtl" reversed each fragment with str[::-1] and its words
twice over, on top of the bidirectional algorithm that had already run, so
the Latin words of a right-to-left document came out backwards -- "and
Latin text" as "dna nitaL txet". A right-to-left line is laid out by
aligning it to the right, not by turning its words around.dir="rtl" and <pdf:language> had its
text put through the reshaper twice, once per fragment and once more over
the whole paragraph, which could leave a NUL in the middle of it.dir on the <html> element was ignored. It was read on <body>,
<div> and <p>, but the root element is where a document usually
declares its direction.<pdf:language name="Arabic"/> did nothing when it was not spelled in
lower case: it reshaped no text, and was excluded from /Lang for being
a language name, so it did neither job.width and height were handed down from a block to everything
inside it, because the frag a child starts from is a clone of its
parent's and neither was ever put back. CSS inherits neither, and in a
flex container it was doing real damage: every item took the
container's own width and height as its own, which made the item's
cross size definite and stopped align-items: stretch from ever
sizing an item to its line.height that was cut between pages
gave both parts the whole height, so the first part no longer fit the
room it was cut for. The height is now shared: the first part takes
what it shows, the second the rest.row-gap was resolved against the container's width.
css-align 8.3 resolves a gap against the container's own content box
in that gap's axis, so a percentage row-gap goes against the
height, and counts as zero when the height is indefinite -- which, for
a container that takes its content's height, it usually is.vertical-align: top and bottom were drawn as text-top and
text-bottom. CSS 2.1 10.8.1 aligns the first pair with the edges of
the whole line box and the second with the parent's content area, so
the four only coincide when nothing else on the line is taller. The
line box is known once the line has been assembled, which is where the
two are now told apart. This reaches inline images too, and an <img>
with no align is aligned bottom, so an image sharing a line with
something taller than itself now sits at the line's bottom edge rather
than a fifth of the font size below the baseline.-pdf-keep-in-frame-mode: shrink -- which measures its content
repeatedly -- shrank every image twice. Images inside a shrunk frame are
now the size the frame's scale gives them.** Documentation**
reference/html documents flexbox and inline blocks: which
properties are read, and where the layout differs from a browser's on
purpose -- inline-flex as block-level flex, align-content
needing a length height, a column without one never wrapping, and
how a container is fragmented at a page edge.guide/fonts is rewritten around what font matching now does: a
font-family list resolved per character, what happens when no family
on it has the character, and the fact that a family the document embeds
beats a built-in alias of the same name -- the guide said the opposite.
Its right-to-left section says what declaring a direction actually turns
round, and how far the Arabic joining goes.Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.19...v0.2.20
SSRF. returned cloud instance credentpback, private, link-local, multicast and reserved addresses are refused by default, on every hop of a redirec by
🔐 Security
SSRF. <img src="http://169.254.169.254/latest/meta-data/"> returned
cloud instance credentpback, private,
link-local, multicast and reserved addresses are refused by default, on
every hop of a redirec by the address it
resolves to.
**Arbitrary file read.worked; local reads are
now confined to the document's own directory, symlinks and .. included.
**Command injection (Cnger goes through a
shell. It is public API and reachable from the CLI's -d argument.
Two ReDoS. An unclntent:"+ 40 backslashes) cost three minutes of CPU, multiplying by eight every four further characters;< cost 23 seconds per
attribute.
**Decompression bomb.*xpanded to 209 MB
resident. Fetched resources now have a 20 MiB limit, checked against
Content-Length, againd against what it
expands to.
Descriptor leak. Aa deleted-but-open inode
behind for the life of the thread.
🎉 New
The document language reaches the PDF catalog as /Lang, from
<html lang="es-CR"> ` — needed by screen
readers and PDF/UA, and never declared before.
Several tables of contoc name="figures" />plus-pdf-toc-name), each with its own typography. A second pdf:toc`
used to fail the whole
Leader fills between a TOC entry and its page number (-pdf-toc-leader:
dots, dashes, `lin
💪🏼 Performance
The CSS cascade no lery property. Dressing
an element cost O(elements × properties × rules) — 30–48% of a render. 800
elements against 800 r-loremipsum`: 408 ms →
224 ms. Output is unchanged.
An embedded font is once per document.
Across 40 real documents in one process, time inside TTFont went from
3.23s to 0s.
🐛 Bug fixes
A list item whose contps its marker —
<li><p>text</p></li>, which is what rich-text editors emit, silently lost
its bullet.
--start-viewer works on Linux; it had been running the macOS open
everywhere that was no
A TOC lays its page numbers out flush right, links each to its heading, and
indents each level; aneportLab's
Placeholder for table of contents into the document.
getSize no longer waa valid percentage.
Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.17...v0.2.19
Released: 2026-09-12
This is primarily a security release. Read Security before upgrading if you convert HTML that anyone but you wrote: the defaults changed, and an application that resolves its assets through link_callback will have to say where they live.
🔐 Security
A rendered document can no longer reach internal network addresses. <img src="http://169.254.169.254/latest/meta-data/"> returned cloud instance credentials from inside the VPC. Loopback, private, link-local, multicast and reserved addresses are refused by default, on every hop of a redirect chain, and a host is judged by the address it resolves to.
A rendered document can no longer read arbitrary files. <img src="/etc/passwd"> worked; local reads are now confined to the document’s own directory, symlinks and .. included.
The PDF viewer is no longer started through a shell. A destination whose name contained shell metacharacters was executed rather than opened (CWE-78). startViewer is public API and reachable from the -d argument of the command line tool.
Public HTTP(S) is unaffected by any of this, and a refused resource is logged rather than fatal. Callers choose their own policy with the resource_policy argument of pisaDocument , with use_policy around a build, or on the command line with --resource-root , --allow-host , --allow-private-networks , --no-remote and --unsafe-resources . See Security .
A stylesheet can no longer hold a worker with a handful of characters. The CSS string and escape patterns each gave the regular expression engine two ways to match the same character, so a string nobody closed backtracked catastrophically: <style>a{content:" followed by 40 backslashes cost three minutes of CPU, and every further four characters multiplied that by eight.
The same for a colour written as an HTML attribute. <td bgcolor="rgb( and 90 digits cost 23 seconds per attribute; the pattern’s three unanchored .*? are gone, and it is matched once rather than twice. A channel above 255 is now clamped, as it already was for a colour the parser hands over as a function.
A conversion that fails no longer leaks a file descriptor. Temporary files were closed at the end of the build, where an exception skipped it, so every document that failed to convert left a descriptor and a deleted-but-open inode behind for the life of the thread.
A fetched resource now has a size limit , 20 MiB by default and max_resource_bytes on the policy. A rendered document names the server it downloads from, and nothing looked at what came back: a 203 KB response declaring Content-Encoding: gzip expanded to 209 MB of resident memory, and twenty <img> like it took the worker. The limit is checked against the declared Content-Length , against the body as it is read, and again against what a gzipped body expands to.
A policy built by hand no longer opens the filesystem. ResourceAccessPolicy ’s base_dir defaulted to None and None meant no confinement, so ResourceAccessPolicy(allowed_hosts=...) – tightening the network rules – silently allowed a document to read any file the process could. base_dir now defaults to the working directory, as default_policy() always did, and base_dir=None denies local reads rather than allowing all of them. allow_local_outside_base=True is how the confinement is lifted, and PERMISSIVE_POLICY and the command line are unchanged.
🎉 New
The document’s language is written to the PDF catalog as /Lang , from <html lang="es-CR"> or <pdf:language name="fr"/> . Screen readers and PDF/UA read the document language from there, and xhtml2pdf never declared it.
A table of contents can fill the gap between an entry and its page number. -pdf-toc-leader takes none (the default), space , dots , dashes , line , or any other string to repeat; <pdf:toc leader="dots" /> sets it for the whole table and a .pdftoclevelN rule for one level. See HTML API .
A document can have more than one table of contents. <pdf:toc name="figures" /> takes only the entries that name it with -pdf-toc-name: figures , so a list of figures or of tables can sit beside the general contents, each with its own fill and typography. An entry belongs to exactly one of them. A second pdf:toc used to fail the whole render. See HTML API .
🐛 Bug-Fixes
A table of contents with no entries printed ReportLab’s internal Placeholder for table of contents into the finished document.
--start-viewer works on Linux. It ran the macOS open everywhere that was not Windows, so it had never done anything there.
A list item whose content is wrapped in a block keeps its marker. <li><p>text</p></li> , which is what rich-text editors emit, lost its bullet or number, and so did every other shape a block inside an item can take: two blocks in one item, an item followed by a nested list, and an item wrapping its text in anything other than <p> or <div> . A wrapped item still hangs under its first line, and <li>text<p>block</p></li> now puts the block on its own line as a browser does.
getSize no longer warns Not a float '100%' for a perfectly valid percentage. The value it returned was already correct.
A table of contents lays its page numbers out flush right, links each one to the heading it names, and indents each level. The numbers used to stop an inch short of the margin, and a long entry ran into its own page number.
💪🏼 Improvements
Resolving CSS no longer scans every rule for every property. Dressing an element cost O(elements x properties x rules), which was 30-48% of a render and grew with the size of the stylesheet. Rules are now filed under the condition an element has to meet, the whole cascade is resolved in one walk per element, and the warning that ran on every attribute lookup moved behind XHTML2PDF_CHECK_CSS_PROPERTIES . A document of 800 elements against 800 rules went from 3649 to 392 ms; test-loremipsum from 408 to 224 ms. What comes out is unchanged.
An embedded font is parsed once per process rather than once per document. Building a ReportLab TTFont reads and parses the whole file – 7 ms for a Latin face, 70 ms for a CJK one, once per declared weight – and ReportLab discarded the result when the name was already registered, so from the second document onwards the work was thrown away on arrival. Across a gallery of 40 real documents rendered in one process, time inside TTFont went from 3.23s to 0s. A process that converts a single file still parses each font once, because it has to.
use_policy around a build is honoured, so a renderer with several entry points can set a resource policy once instead of passing it to every call. The order is the resource_policy argument, then the surrounding block, then the default.
<pdf:toc class="..."> keeps its own classes, so the tag can be styled with pdftoc.compact.pdftoclevel0 . The level classes no longer leak into the rest of the document either.
The vendored copy of ReportLab’s paragraph renderer understands <onDraw> again.
📘 Documentation
New Security page: what to think about when the markup is not yours, the policy options, and how to report a vulnerability.
The Django example in Advanced usage shows the policy that names STATIC_ROOT and MEDIA_ROOT . Without it that example loses every image.
The Python reference documents resource_policy ; the CLI reference documents the five resource flags.
HTML API documents the document language – what <html lang> and pdf:language each do, and which of the two reaches /Lang . Security documents the two ready-made policies, default_policy() and PERMISSIVE_POLICY , and what a refused resource does to a render.
make devsetup builds the development environment in one step: a virtualenv, an editable install with the test , docs and release extras, and the pre-commit hooks. The README told contributors to ask for a build extra, which does not exist; the one that brings in build and twine is release .
🧹 Cleanup
pisaContext.cssAttr is declared in init rather than appearing from the first CSSCollect .
Deprecations: Python 3.8 and 3.9 are no longer supported. The renderpm extra is now an alias for pycairo; ReportLab 5 removed the C renderPM backend a…
Widen the ReportLab constraint to >=4.0.4,<6 and raise the Python floor to 3.10, after validating empirically that ReportLab 5 does not change rendering: references built with one ReportLab major and compared against a render from the other produce zero pixel differences across all 23 testrender fixtures, in both directions and down to the declared 4.0.4 floor. The CI matrix now covers Python 3.10 to 3.14 against both ReportLab majors.
The only behavioural regression in ReportLab 5 is rl_config.trustedHosts=None changing from "every host is trusted" to "no host is trusted", which makes open_for_read refuse every URL and data: URI. That default is deliberate SSRF hardening and is left untouched; PmlImageReader falls back to xhtml2pdf's own fetcher instead.
The ReportLab 5 assessment also surfaced that the rendering comparison could
never fail. CI regenerated the reference from the same commit and the same
ReportLab immediately before comparing, and tox passed --nofail. Removing
--nofail alone would not have helped: ImageMagick compare exits 1 when images
differ and exec_cmd treated that as a fatal error, aborting on the first
differing page before the HTML report was written. A cross-version job now
builds the reference with one ReportLab major and renders with the other, in
both directions.
Bug fixes:
files as a class attribute, so one request's
cleanFiles() closed files another request was still reading.capacity keyword to
getFile() and appended raw bytes where PdfReader needs a file-like object.len(buffer) > capacity is true for any buffer when capacity is negative, so
it spilled to disk immediately -- the default for pisaPDF and pisaContext.if data:, so those files were
never closed by cleanFiles(). Surfaced by the new ResourceWarning in 3.14.Test suite:
Deprecations: Python 3.8 and 3.9 are no longer supported. The renderpm extra is now an alias for pycairo; ReportLab 5 removed the C renderPM backend along with its renderpm extra, so reportlab[renderpm] silently installed nothing there.
testrender compared xhtml2pdf against itself: the reference was produced by the same library, so it caught changes in the output but never told anyone whether that output was right. There was no external reference anywhere in the project, and a CSS bug could therefore live for years without a test noticing.
Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.17...v0.2.18
🎉 New
Support for ReportLab 5. The dependency is now reportlab>=4.0.4,<6 ; both major versions are covered by the CI matrix.
Support for Python 3.14. The CI matrix now covers every supported CPython release (3.10 to 3.14) against both ReportLab majors.
💪🏼 Improvements
PmlImageReader falls back to xhtml2pdf’s own fetcher when ReportLab refuses a resource. ReportLab 5 changed rl_config.trustedHosts=None from “every host is trusted” to “no host is trusted”, so open_for_read now rejects every URL and data: URI by default. That default is deliberate SSRF hardening and is left untouched.
data: URIs are parsed per RFC 2397. The percent-encoded form ( data:image/svg+xml,%3Csvg... ), which is the usual way inline SVG is written, was previously rejected outright; only ;base64, was understood.
HTTP responses now follow redirects (bounded to 5 hops), accept any 2xx status rather than the literal 200 OK reason phrase, close their connection, and log a warning instead of a debug message on failure.
Plain HTTP requests honour the configured http_timeout ; it was previously only applied to HTTPS connections, so plain HTTP could hang indefinitely.
The memoization cache in xhtml2pdf.util is bounded (1000 entries, FIFO) and is cleared at the end of each render. Its keys come from CSS in the rendered document, so it grew without limit in long-running servers.
🐛 Bug-Fixes
@page name:left / @page name:right work. A stray sys.exit() in PmlBaseDoc.handle_nextPageTemplate terminated the calling process, and the vendored PTCycle predated ReportLab’s next_value protocol, so the alternating left/right page feature had never worked. ReportLab’s own PTCycle is used now.
Temporary files are no longer shared between threads. TmpFiles subclasses threading.local but declared files as a class attribute, so one request’s cleanFiles() closed files another request was still reading.
pisaPDF.addFromString() works. It passed an unsupported capacity keyword to getFile() and appended raw bytes where PdfReader needs a file-like object.
pisaFileObject accepts bytes and pathlib.Path , as its type hints always claimed. Both raised AttributeError , which was swallowed into a silent None .
The WSGI middleware produces PDFs. PisaMiddleware.filter wrote PDF bytes into a StringIO , and the response buffer rejected the bytes chunks that PEP 3333 requires applications to yield.
Filter.should_filter is abstract instead of printing headers to stdout and returning None .
Paragraph.getPlainText() works; a misplaced bracket made it join a sequence of one-element lists and raise TypeError on every call.
pisaTempFile(capacity=-1) keeps its buffer in memory, as documented. len(buffer) > capacity is true for any buffer when capacity is negative, so it selected the on-disk strategy immediately – the opposite of the intended behaviour, and the default for pisaPDF and pisaContext .
Temporary files are registered with the cleanup registry even when the resource is empty. Registration sat inside an if data: , so those files were never closed by cleanFiles() and survived until garbage collection (surfaced by the new ResourceWarning in Python 3.14).
pisaTempFile.getFileName() returns the file name instead of None ; name was never assigned when the on-disk strategy kicked in.
The background of <body> now covers the whole page, as CSS 2.1 14.2 requires when html declares no background of its own. It previously painted only the area body’s boxes occupied, leaving the rest of the page white. Found by the new browser comparison; see below.
⚠️ Deprecation
Python 3.8 and 3.9 are no longer supported; the minimum is now Python 3.10.
The renderpm extra is deprecated and now an alias for pycairo . ReportLab 5 removed the C renderPM backend together with its renderpm extra, so reportlab[renderpm] silently installed nothing there. The pure-Python rlPyCairo backend that pycairo installs is what reportlab.graphics.renderPM uses now.
🧹 Cleanup
The test suite no longer reaches the public internet; fixtures are served from a local HTTP server. A dedicated CI job runs the suite with no outbound network at all.
The rendering comparison in CI is load-bearing. References used to be regenerated from the same commit and ReportLab version immediately before being compared, and --nofail suppressed the exit code, so the pixel diff could never fail. A cross-version job now builds references with one ReportLab major and renders with the other, in both directions. A missing reference counts as a difference instead of being silently skipped.
The tox envlist matches the CI matrix again; TOXENV=py3.13 previously matched no environment, so that leg ran no tests. CI asserts the match.
make test-render fails with a clear message when the reference set has not been generated yet, instead of reporting every page as a difference. New make test-render-all target creates the reference and compares in one go.
CI patches whichever /etc/ImageMagick-*/policy.xml exists rather than hardcoding the ImageMagick 6 path.
New testrender/browsercompare.py compares xhtml2pdf’s output against a browser rendering equivalent markup, which is the project’s first external reference: testrender.py compares xhtml2pdf against itself and so cannot say whether the output is correct. Every fixture has a plain HTML/CSS equivalent under testrender/data/browser/ in which the xhtml2pdf-only constructs are expressed with ordinary markup – @frame as absolute positioning, pdf:toc as a hand-written list, pdf:pagenumber as a counter() in an @page margin box. Run it with make test-browser .
New tests for previously uncovered modules: pdf.py , wsgi.py , the pisa CLI, files.py , and reportlab_paragraph.py . A contract test pins every private ReportLab symbol the package imports.
Removed the dead tests/runtests.py harness.
Update import for breaking changes in python-bidi 0.5.0 by @bengosney in https://github.com/xhtml2pdf/xhtml2pdf/pull/767
Full Changelog: https://github.com/xhtml2pdf/xhtml2pdf/compare/v0.2.16...v0.2.17
Released: 2025-02-23
💪🏼 Improvements
Reuse background PDF file over multiple pages
Improve github actions
🐛 Bug-Fixes
fix reDOS CVE in getColor function
Keep GitHub Actions up to date with GitHub’s Dependabot
📘 Documentation
Improve documentation and fixed a lot of typos
Thanks to the following people on GitHub for contributing to this release:
Trupal00p cclauss and kytta-532-better-docs
[ #751 ] Add compatibility for reportlab >= 4.1
🐛 Bug-Fixes
reportlab >= 4.1Thanks to the following people for contributing to this release: @stefan6419846
🐛 Bug-Fixes
reportlab >= 4.1Thanks to the following people for contributing to this release:
@stefan6419846
Released: 2024-06-08
🐛 Bug-Fixes
Add compatibility for reportlab >= 4.1 ( #751 )
Thanks to the following people on GitHub for contributing to this release:
stefan6419846
Thanks to the following people on GitHub for contributing to this release:
Released: 2024-02-08
🐛 Bug-Fixes
Pin reportlab>=4.0.4,<4.1 ( #751 )
Thanks to the following people on GitHub for contributing to this release:
timobrembeck
Bump to v0.2.14
Bump to v0.2.14 (#747)
Released: 2024-01-20
⚠️ Important notes
The pyCairo dependency has been removed to allow the user to define the desired rendering backend individually. If you need to render bitmaps or vector graphic formats, please specify either pycairo or renderpm as extra dependency.
🐛 Bug-Fixes
Remove unintentional packages from wheel ( #736 )
Make pyCairo dependency optional ( #741 )
Fix image rendering with link_callback ( #738 )
Thanks to the following people on GitHub for contributing to this release:
carlsmedstad , timobrembeck
[ #731 ] Fix TypeError on column widths specified as percentages
🐛 Bug fixes
TypeError on column widths specified as percentagesTypeError when formatting width in debug loggingThanks to the following people for contributing to this release: @JanEgner @timobrembeck
Released: 2023-11-09
🐛 Bug-Fixes
Fix TypeError on column widths specified as percentages ( #731 )
Fix TypeError when formatting width in debug logging ( #730 )
Thanks to the following people on GitHub for contributing to this release:
JanEgner , timobrembeck
[ #106 ] Fix page number & page count
🐛 Bug fixes
ZeroDivisionError on broken image files📘 Documentation
🧹 Cleanup
html5lib >= 1.1reportlab >= 4.0.4Thanks to the following people for contributing to this release: @JanEgner @lucasgadams @a-detiste @holtwick @stefan6419846 @timobrembeck
🐛 Bug fixes
📘 Documentation
🧹 Cleanup
html5lib >= 1.1reportlab >= 4.0.4Thanks to the following people for contributing to this release:
@JanEgner @lucasgadams @a-detiste @holtwick @stefan6419846 @timobrembeck
Released: 2023-11-08
🐛 Bug-Fixes
Fix page number & page count ( #106 ) ( #695 )
Fix ZeroDivisionError on broken image files ( #723 )
📘 Documentation
Update README ( #707 )
Modernize Sphinx configuration ( #711 )
🧹 Cleanup
Change print statement to log.exception ( #700 )
Remove Python2 compatibility ( #706 )
Depend on html5lib >= 1.1 ( #705 ) ( #709 )
Depend on reportlab >= 4.0.4 ( #699 ) ( #708 )
Use black code style ( #714 )
Enforce consistent file formatting ( #715 )
Add ruff code linter ( #716 )
Start using type hints & validate them via mypy ( #717 )
Drop support for Python 3.7 (reached end of life on 2023-06-27) ( #718 )
Add support for Python 3.12 (released on 2023-10-02) ( #719 )
Thanks to the following people on GitHub for contributing to this release:
JanEgner , lucasgadams , a-detiste , holtwick , stefan6419846 , timobrembeck
This release only aims to fix issues with pycairo and xhtml2pdf dependencies with reportlab.
This release only aims to fix issues with pycairo and xhtml2pdf dependencies with reportlab.
Released: 2023-06-07
This release only aims to fix issues with pycairo and xhtml2pdf dependencies with reportlab.
🐛 Bug-Fixes
Fix setup.py and requirements dependency to set reportlab>=3.5.53,<4 #688 in #690
Thanks to the following people on GitHub for contributing to this release:
gaurab-10 , jorenham
This is a bug fixes release changes here:
This is a bug fixes release changes here:
Thanks to the following people on GitHub for contributing to this release: @brandonlake-semaphore, @sunpoet
Released: 2023-04-20
🐛 Bug-Fixes
Fix canvas graph issue #614 in #619
🧹 Cleanup
Remove duplicate pypdf entry from setup.py in #619
Thanks to the following people on GitHub for contributing to this release:
brandonlake-semaphore , sunpoet
Text RTL has new implementation but I am not sure if works as required, more works need so use it, for text and let me know if it's works.
Released: 2023-01-30
Important notes
🎉 New
💪🏼 Improvements
Thanks to the following people on GitHub for contributing to this release:
@BergLucas, @matllubos, @timoludwig, @MartinThoma, @charludo, @jorenham
Fix background-image issues with #614 and pull requests with #619
🐛 Bug-Fixes
Released: 2022-06-16
🐛 Bug-Fixes
Fix background-image issues with #614 and pull requests with #619
Fix CSSParseError for minified @font-face definitions #609
Fixed a few typos and grammar mistakes in usage.rst documentation. #610
Thanks to the following people on GitHub for contributing to this release:
MuhammedNihad , timobrembeck , flash716
Add encryption and password protection
🎉 New
🐛 Bug-Fixes
⚠️ Deprecation
xhtml in pisa.CreatePDF support will removed on next releaseXML2PDF and XHTML2PDF will be removed on next release use HTML2PDF instead📘 Documentation
| Thanks to the following people on GitHub for contributing to this release: | @marcelagz for graphics support :)
Remove most of python 2 code and cleanup
Released: 2022-03-11
🎉 New
Set timeout in https options
Add new file manager approach using factory method, now new classes deal with different types of data B64InlineURI, LocalProtocolURI, NetworkFileUri, LocalFileURI, BytesFileUri
rtl languages reversed lines added as a ParaFrag (note: not fully supported yet)
Check if Paragraph has ‘rtl’ attribute (note: not fully supported yet)
Add SVG support
💪🏼 Improvements
Update packages dependencies
Now getColor return None when None is passed ignoring default value, but return default if bool(data) == false
Change test for github workflow using only Linux
Add Python 3.9, 3.10
Switch from PyPDF2 to PyPDF3
Allow call tests using make.
🐛 Bug-Fixes
Fix UnboundLocalError in reportlab_paragraph ( #585 ) ( #586 )
📘 Documentation
Created this release notes section.
Updated the Sphinx version and the sphinx-rtd-theme version
Update package information.
🧹 Cleanup
Drop python 2 support.
Remove most of python 2 code and cleanup
Remove six dependency and update Readme
Remove usage of getStringIO (#590) removed form reportlab
Thanks to the following people on GitHub for contributing to this release:
Roman914 , LeonardoBein , myu20 , myu20 , captn3m0 , audoh-tickitto , Momoumar ,
timobrembeck , fbernhart ,mgodkowicz, anze3db * and *luisza
- Replaced deprecated base64.encodestring with base64.encodebytes #472
Released: 2020-10-08
🎉 New
Added Asian fonts support (Simplified Chinese, Traditional Chinese, Japanese & Korean) #353
Added support for right-to-left writings like Arabic, Hebrew, Persian, Pashto, Urdu and Sindhi. Simply include for example <pdf:language name="arabic"/> #494
💪🏼 Improvements
CSS property letter-spacing now supports float values and relative & absolute units like cm , in , em , % etc. #490
Added unit tests for Asian and right-to-left fonts. #520
🐛 Bug-Fixes
@frame properties like width , right , bottom etc. are now correctly calculated depending on the page orientation and size #499
Fixed support for multiple fonts and unicode #492
Fixed an encoding issue with html5lib #468
Fixed a problem with the border property in h1 to h6 heading tags #466 #495
Fixed compatibility with ReportLab 3.5.X #404 #463
Removed default background-image when no background-image is defined #484
Fixed an issue with different font type that have the same name #381
Fixed a bug that prevented support for Python 3.X #513
testrender test: fixed transparences and included new reference files, (now all tests pass in Travis CI without –failed parameter) #502
0.0 as value for a CSS property now acts the same way as 0 and None #516
⚠️ Deprecation
Removed i and inch as unofficial synonyms for the in unit #516
📘 Documentation
Added new section about Asian font support #505 #520
Added new section about support for right-to-left writings #520
Readme.rst file was updated #507 #512
Added missing changelog entries for earlier releases #478
🧹 Cleanup
Replaced deprecated base64.encodestring with base64.encodebytes #472
Replaced deprecated log.warn() with log.warning() #509
Dropped dependency of nose (outdated & unmaintained) in favor of unittest, which is included in the Python standard library #520
Removed the old nose tests and replaced them with unittest #520
Removed unlicensed .tff font files in our tests folder and replaced them with open source fonts #520
Travis CI and AppVeyor are now testing both against the same ReportLab versions (3.3 to 3.5.X) #520
Thanks to the following people on GitHub for contributing to this release:
ezawadzki , fbernhart , KirilNN , luisza , Mark-Hetherington , parthjoshi2007 , pedroszg , silvio-dp , sj175 , tirkarthi and z4c
Update link_callback documentation. Stylize code lines in documentation. Fixed cgi escape util on setup version. Add test to python 3.7 and 3.8. Fixed
Update link_callback documentation. Stylize code lines in documentation. Fixed cgi escape util on setup version. Add test to python 3.7 and 3.8. Fixed width assignation on fragments. Support urllib in python 3 and python 2. Add em unit support. Repair base64 unscaped string. Fixed urlparse when urls has parameters. Fixed i_rgbcolor support.
Released: 2020-01-18
🎉 New
Add em unit support
💪🏼 Improvements
Added testing for Python 3.7 and 3.8
Added support for urllib in Python 2 and Python 3
🐛 Bug-Fixes
Fixed cgi escape util on setup version
Fixed width assignation on fragments
Repaired base64 unscaped string
Fixed urlparse when urls has parameters
Fixed i_rgbcolor support
📘 Documentation
Updated link_callback documentation
Stylized code lines in documentation
Released: 2018-09-14 Changes were not documented
Released: 2018-09-14
Changes were not documented
Include new python version in test and change requirements to force html5lib to 1.0.1.
Include new python version in test and change requirements to force html5lib to 1.0.1.
This new release has a lot of improvements in python 3 and demos.
This new release has a lot of improvements in python 3 and demos.
Released: 2018-02-16
🎉 New
Added support for Python 3.8
💪🏼 Improvements
Improved table tests
🐛 Bug-Fixes
Forced html5lib to 1.0.1 (old versions of html5lib are not in pip)
Allow for URI-escaped strings in base64 data
🧹 Cleanup
Removed the dependency on httplib2
- Support for a new @page property: background-image
Released: 2018-02-15
🎉 New
Support for a new @page property: background-image
💪🏼 Improvements
Improved Python 3 support
Included new httplib options
🐛 Bug-Fixes
Fix for transparent images in Python 3
⚠️ Deprecation
Removed support for Python 2.3
📘 Documentation
Readthedocs integration
Updated Django demo site
🧹 Cleanup
PEP8 improvements and code cleanups
Dropped the turbogears module
Thanks to the following people on GitHub for contributing to this release:
andreyfedoseev , browniebroke , flupzor and luisza
Released: 2016-11-30 Changes were not documented ## Versions >= 0.1, < 0.2
Released: 2016-11-30
Changes were not documented
Released: 2016-08-16 Changes were not documented
Released: 2016-08-16
Changes were not documented
Released: 2016-08-01 Changes were not documented
Released: 2016-08-01
Changes were not documented
This release is possibly the final release ever of xhtml2pdf, except if someone takes over maintainership. It has Python 3 support, but there are cert
This release is possibly the final release ever of xhtml2pdf, except if someone takes over maintainership. It has Python 3 support, but there are certain bugs also that you can read about in the ~37 unclosed issues.
Avoid exceptions likely to occur systematic to how narrow a text column is #309 - thanks _jkDesignDE_
- Improved six usage, simplifies codebase #288 - thanks citizen-stig
Released: 2016-05-01
Improved six usage, simplifies codebase #288 - thanks citizen-stig
Removed mutable types as default args #287 - thanks citizen-stig
Fix “hangs forever on simple input” #209
Base64 inline <img> works now #281
- Fixed: AttributeError: ‘bytes’ object has no attribute ‘encode’ #265
Released: 2016-04-14
Fixed: AttributeError: ‘bytes’ object has no attribute ‘encode’ #265
Improved tests, added code coverage
This major version bump signals that we have added Python 3 support. Other than that, the project remains largely unchanged.
Released: 2016-01-20
This major version bump signals that we have added Python 3 support. Other than that, the project remains largely unchanged.
Python 3 support
Cleaning up codebase
Github and documentation modernizations
- get css backgrounds and fonts relative to the css file path
Released: 2014-04-27
get css backgrounds and fonts relative to the css file path
fix CSS parser breaking on “@media screen and …” ( #132 )
- Switched dependency to Pillow instead of PIL.
Released: 2013-03-25
Switched dependency to Pillow instead of PIL.
Converted the docs to rst (thanks tomscytale!)
Huge performance improvements (thanks Andrea Bravetti!)
Bugfixes.
- Added a tag to write the total number of pages.
Released: 2012-05-23
Added a pdf:pagecount/ tag to write the total number of pages.
The pdf:barcode/ tag now accepts a fontsize argument for the human-readable font.
Various bugfixes and enhancements
Released: 2011-06-19 Changes were not documented
Released: 2011-06-19
Changes were not documented
Released: 2011-05-27 Changes were not documented
Released: 2011-05-27
Changes were not documented
Released: 2011-05-20 Changes were not documented
Released: 2011-05-20
Changes were not documented
- NEW: Command line tool called “xhtml” (“pisa” still available but will be deprecated with pisa 3.1)
Released: 2011-05-19
Changes were not documented
The following changelog entries were relevant before the maintainer change.
“I would like to thank the people mentioned in brackets in this change log very much for their help and support!” - Dirk
Version 3.0.33, 2010-06-16
NEW: Changed license to Apache License 2.0, now completely Open Source without any charging. Feel free to continue or for this project.
FIX: Empty cells now collapse
Version 3.0.32, 2009-05-08
NEW: New command line option ‘–base’ to specify base path if input comes via STDIN
FIX: The ‘keep in frame’ feature for tables did not work inside of static frames (Arun Shanker Prasad)
FIX: Small typos
Version 3.0.31, 2009-05-04
NEW: Support for Style “list-style-image”, also supports “zoom”
NEW: Temporary files internally are written to disk if they exceed a certain size
NEW: Font names can now also read from external URL
UPD: Modified pdfjoiner.py demo
FIX: Custom font image problem still appeared
FIX: Single image in a block issue
FIX: Randomly used wrong images is fixed using a workaround for the bug in Reportlab _digester routine
FIX: Empty tables error (Davide Moro)
FIX: Fallback to urllib2 if httpdlib fails
Version 3.0.30, 2009-03-27
NEW: Default CSS now hides content of <noscript>
UPD: Better whitespace handling in RL Paragraph
FIX: Fixed RL Paragraph.split to work with autoleading and images
FIX: Small bug fix for show_error_as_pdf
FIX: Demos used os.startfile which is not supported on non Windows OSes
FIX: Table available height threw exceptions
FIX: Switched from urllib2 to httplib for loading external sources
FIX: Correct homepage and download page in setup.py
FIX: Paragraphs in lists repeated the bullet
FIX: Tables now support -pdf-keep-with-next
FIX: TOC bug fixed
FIX: Add missing table columns to avoid error in Reportlab table
FIX: Fix for background images sizing
FIX: Empty documents now create one blank page
FIX: Imported fonts caused an error if used together with images
Version 3.0.29, 2008-12-01
NEW: Warning if Reportlab 2.2 is not installed
UPD: Better support for named colors
UPD: Modified frame handling to better support relative values
FIX: Splitting paragraph threw errors some times; also had problems with line breaks on the second page, fix for RL 2.2 paragraph was needed
FIX: Added margins to <blockquote> default CSS
FIX: Inline images in static frames did not work
FIX: Link anchors and non internal fonts caused a strange error
Version 3.0.28, 2008-11-21
NEW: Requires Reportlab 2.2 now!
NEW: Background colors for inline elements like <span>
NEW: Inline images and left and right aligned images implemented
NEW: Possibility to handle table cells that are to large via CSS option -pdf-keep-in-frame-mode
NEW: Option “–system” for command line tool to dump system version infos
NEW: CSS attribute -pdf-line-spacing for fix space between lines
NEW: Creation and handling of data URI with base64 encoding (others to come)
NEW: New general file loader that is also able to load remote data and data URI
NEW: PDF Joiner to concatenate many PDF and pisa documents
NEW: Page backgrounds can now be images or PDF
NEW: Visual Unittests based on ImageMagick and TortoiseIDiff (for Windows)
NEW: Pisa now raises exceptions if errors occurred; with pisaDocument(…, raise_exception=False) you can turn them off
UPD: Paragraphs now use the maximum leading to avoid overlapping text
UPD: Removed “Keep with next” from H1 to H6
FIX: Sizing of images is now handled better; should better work with PIL
FIX: Border handling of paragraphs optimized and fixed
FIX: Images that are higher than the page frame are scaled down to fit
FIX: Paragraphs only containing are rendered
FIX: Problem regarding the order of border style definitions
FIX: Single <br> between two blocks now creates a new line
FIX: Set table attribute “repeat” to “0”
FIX: Some <font> attributes did not work as expected
FIX: Font sizes reworked to behave like browser implementations
FIX: Like in most HTML browser table cells now have “valign=middle” and table headers have font weight bold
FIX: Little fix in CSS parsing
FIX: Default of <link media=””> was “screen”, changed to “all”
FIX: Command line tools did not install with “easy_install”
Version 3.0.27, 2008-10-04
INF: License changed from Qt to GPLv2
INF: Not yet completely compatible with Reportlab 2.2 ( errors and borders)
NEW: Command line tool called “xhtml” (“pisa” still available but will be deprecated with pisa 3.1)
NEW: EGG for Python 2.6
NEW: Basic support for Data URI
NEW: New style -pdf-keep-with-next (does not work with pdf:toc for now)
UPD: Setup now exclusively works with SetupTools
Version 3.0.26, 2008-08-28
FIX: Python <2.5 didn’t work because of a syntax error
Version 3.0.25, 2008-08-15
UPD: Made imports more explicit to avoid import recursions
FIX: pdf:pagenumber/ didn’t work in tables (Roman Lisagor)
FIX: Images without suffixes have been ignored by pisa (Henning von Bargen)
INF: Preparations for support of HTML FORM using INPUT, TEXTAREA, SELECT
Version 3.0.24, 2008-07-14
NEW: Support for separate borders on each side of a paragraph has been added (Robin Dunn)
NEW: Support for font tag (color, face, size)
UPD: Handling of margin and padding in paragraphs is improved (Robin Dunn)
UPD: Updated documentation (CreatePDF, Images)
FIX: A typo in margin-left has been fixed (Robin Dunn)
Version 3.0.23, 2008-06-26
UPD: getColor() now understands colors like rgb(255,0,0) (Darryl Dixon)
FIX: c.warning threw errors if no arguments where passed (Searle)
FIX: pisa now works with html5lib 0.11.1
Version 3.0.22, 2008-06-06
UPD: Updated documentation
UPD: Speed optimizations by removing copy.deepcopy (Darryl Dixon)
FIX: Small fix in CSS parser
Version 3.0.21, 2008-06-05
FIX: Used a parameter for html5lib that was not supported by html5lib 0.10
FIX: Now tested against the latest third party packages: ReportLab 2.1, html5lib 0.10, pyPdf 1.11
Version 3.0.20, 2008-06-02
NEW: New parameter “encoding” to explicitly set an encoding for the source data
UPD: Added a programming example to documentation
FIX: If a Unicode string is passed it will automatically be converted to UTF8
FIX: Fixes for Google AppEngine support
FIX: If possible cStringIO will be used instead of StringIO
FIX: An exception in psaDocument was not handled the right way because a context object was expected
Version 3.0.19, 2008-05-31
NEW: Support for Google AppEngine
NEW: Support for page break before and after [not yet tested] (Luka Frelih)
UPD: Reworked parts of the documentation but not yet completed
UPD: Optimized the command line tool “pisa”
FIX: TOC bugs regarding entities and additional tags inside the TOC entry definitions (Luka Frelih)
FIX: Default logging didn’t work with Python<2.5 (Anders J. Munch)
FIX: StringIO is used instead of cStringIO to avoid encoding problems like the ones we had with GoogleAppEngine
Version 3.0.18, 2008-04-19
WIN: Updated the windows command line version
NEW: WSGI support and demo
NEW: Added simple ASPN Cookbook example
UPD: Unified setup.py and setup_egg.py (Andreas Gabriel)
UPD: Better handling of XML and HTML parsing
UPD: Cleanup of Django sample
UPD: Cleanup of command line tool options
UPD: Command line tool doesn’t stop batch if error occurred any more
FIX: ‘style’ attribute was not evaluated!
FIX: If a string was passed to pisaDocument it had been converted to StringIO, which was not necessary
FIX: c.addPara(force=True) works again e.g. for forcing empty pages
FIX: Better handling of CDATA and Comments
FIX: Better handling of
FIX: Removed rsplit() for backward compatibility with Python 2.3
FIX: Handling of inconsistent HTML anchors
FIX: TurboGears Demo
Version 3.0.17, 2008-03-23
NEW: Added CSS support for TOC and updated documentation (Jean Baltus)
UPD: Added “render_to_pdf” to Django demo (Diego Firmenich)
UPD: Did some refactoring to make CSS parsing more flexible
UPD: Removed log.exception for warnings
FIX: Empty entries in TOC (Jean Baltus)
FIX: Use correct font for <li> now (reported by Gabor Farkas)
Version 3.0.16, 2008-03-16
Did some researches about support for languages like Farsi, Arabic and Asian languages. The dir=’rtl’ feature seems to be quite time intensive to be implemented, maybe I will do it in a later version or on request
Switched back to HTML parsing by default, but use of XHTML is recommended. Use the option “xhtml” in pisaDocument or “-x” in the command line tool
Added a decorator for use in Turbogears and CherryPy
Completely switched to Python logging system
Created a separate download for the fonts in the “test” directory to reduce the size of the package
Just use multiBuild if needed e.g. using pdf:toc
Bugfix: @font-face threw always a warning about font-weight
Bugfix: List points have to be always in “Helvetica” (Gabor Farkas)
Bugfix: Obligatory attributes for tag had not been handle the right way
Bugfix: Marked some old tag based functionalities like pdf:font, pdf:frame and pdf:template as deprecated
Version 3.0.15, 2008-03-13
Added new package and namespace “ho”. With pisa 3.1. we will move away form “sx”
Added version testing (2.1) for Reportlab Toolkit (Diego Firmenich)
Added new command pdf:toc for support of table of contents, stiling per CSS has not been implemented yet (Jean Baltus)
Added simple barcode support via command pdf:barcode (Diego Firmenich)
Added Python logging. Name of logger “ho.pisa” and “ho.css”. Set debugging level in command line tool by using “-d” for debugging and “-w” for warnings
Added complete support for CSS “font”
Modified the version handling and setup system for pisa distributions (had to do with the import errors that where not thrown, reported by Schmitte)
Updated documentation and added a CSS for HTML version
Bugfix: CSS “background” URL handling was broken (Luis Bruno)
Bugfix: CSS “border” now works more standard conform
Bugfix for compatibility problems with Python 2.3 because of reversed() function
Bugfix: No exception was thrown if a third party module was missing (Kai Schmitte)
Bugfix: Changed HTML5 parser from HTMLParser to XHTMLParser so that the custom tags of the “pdf” namespace are handled like expected
Bugfix: Switched from urllib to urllib2 because status errors (like 404) where not handled (Kees Hink)
A lot of smaller bugfixes and testings
Version 3.0.14, 2008-02-13
Added a sample for Unicode support in exotic languages like “farsi” using DejaSans font (Adam Hyde)
Command line tool generation integrated into setup.py (Andreas Gabriel)
Bugfix if no path had been set to pisaDocument()
Bugfix for calculating @frame dimensions
Bugfix: CSS comments like “//” where allowed (Andreas Gabriel)
Version 3.0.13, 2008-01-22
Added a demo using cherrypy web server and kid
Added a demo using django framework
Modified test-background.html to work with CSS
Added support for bold and italic TTF fonts to the @font-face CSS section (Robert Klep)
Added support for bold and italic Postscript fonts to the @font-face CSS section
The @-rules are not need a trailing space after ident any more (Robert Klep)
Fixed the Windows standalone version to work
Made the ‘sx’ folder more sharable by modifying init.py
Changed font-weight so that only values starting with ‘400’are considered ‘bold’ (Robert Klep)
Added “text-indent” style (Robert Klep)
Added “-pdf-keep-with-next” style to avoid page break between certain elements (Robert Klep)
Added “-pdf-outline”, “-pdf-outline-level” and “-pdf-outline-open” styles to create PDF bookmarks. Per default this is defined for the tags H1 to H6 (Robert Klep)
New option to overwrite the default CSS definitions of pisa
New command line options –css
New command line options –css-dump to get the default CSS definitions. A dump of the recent CSS default may also be found in test/default.css
Fixed setup.py
Added EGG installation file support
Version 3.0.12, 2008-01-09
Moved SVN repository to Holtwick
Modified copyright notes and links to http://www.htmltopdf.org
Added new table attributes “border”, “bordercolor”, “cellpadding”
Added support for
Version 3.0.11, 2007-11-13
New example for loading a page form the web via Python
New example “test-invoice.html”
Added support for “align” attribute to <td> and <th>
Fixed that more than one static frame can use the same named element
Added -pdf-next-page to specify next page template
Added -pdf-frame-break: after, before
Fixed bug for @page without declarations
Added option for output of errors as PDF (e.g. useful in web applications)
Set “producer” to “pisa”
Set author, subject and keywords with <meta>
Version 3.0.10, 2007-11-02
Fixed some problems with wrong @page and @frame definitions
New property -pdf-frame-box
Implemented a pre parser for CSS that cleans up the code with some regular expression, like stripping illegal url http://...
Improved online demo
First release of binary Windows command line version or pisa
Fixed some issues with named anchors
Empty documents are now delivered correctly
Fixed error on list types
Fixed problem with debugging infos
Version 3.0.9, 2007-10-31
Modified setup.py for Chesse Shop
Added bdist_wininst to setup
Moved w3c into sx package and added license text
Modified simple.py demo script
Clean up for first public release
Version 3.0.8, 2007-10-31
Added <a name> and a bugfix for ReportLab anchors
Added <a href>
More documentation about fonts and new font aliases
Fixed some bugs in tables
<hr> now uses ReportLabs implementation
Margin collapse by using spaceBefore and spaceAfter
Renamed -pdf-page-size to size (CSS3)
Version 3.0.7, 2007-10-30
Static frames in @frame
Wrote layout section in documentation
Updated the documentation CSS
Renamed @box to @frame
Added -pdf-page-size and -pdf-page-orientation
Added @page and @box
Fixed some problems with font definitions and Unicode
Font “Times” does not exist, changed default to “Times-Roman”
Margins, paddings and borders are only applied in display:block elements
Version 3.0.6, 2007-10-29
Implemented @font-face
“font-family” can now handle comma separated font names
Implemented pdf:font for embedding TTF and PS fonts
<link> looks for rel=”stylesheet”
Style “white-space” and support for PRE
Nested lists and ordered lists, Style “list-style-type”
Prepared parser for @page and @box
Version 3.0.5, 2007-10-25
Initial implementation of @font-face
Warnings are only shown if flag -w is set
Relative @import implementations
Workaround for styles beginning with asterics like “* font: small”
Support for color=transparent (threw Exceptions before)
For @import with now media, is now set media=all
Fixed the .1 CSS parser problem
Removed cssutils again because of problems with @import
Ignore CDATA in style definitions
New method c.debug and command line option –debug
Better URL support
CSS attributes may now start with hyphen for vendor specific styles e.g. “-pdf-page-break”
Implemented @import
Implemented @media
Images are now recalculated to 96DPI too
1px = 1/96inch (96dpi) instead of 1px = 1pt = 1/72inch
Added some new tests like test-css-media.html
Version 3.0.0
Initial versions of pisa rewrite
One column per quarter.