pypi xhtml2pdf 0.2.25
v0.2.25

latest release: 0.2.26
3 hours ago

⚠️ 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 :issue:809 and :issue: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
    :doc:format_html. Fixes :issue: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
    :doc:format_html. Fixes :issue: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 :issue: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 :issue: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 &#xa0;. Fixes
    :issue:849.
  • A non-breaking space at the start of a line after a <br/> is kept,
    as a browser keeps it: <br/>&#xa0;&#xa0;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 :issue: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
    :issue: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 :issue: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 :issue:545.

| Thanks to the following people on GitHub for contributing to this release:
| cristianchiriac, who fixed the IndexError after a <br/>
(:pr:850), rondanen, whose report of the repeated PNG found its
cause, and wyhsu1128, who narrowed the <br/> crash down to a few
lines of HTML.

Full Changelog: v0.2.24...v0.2.25

Don't miss a new xhtml2pdf release

NewReleases is sending notifications on new releases.