Skip to content

v0.1.3

Choose a tag to compare

@lhopkins lhopkins released this 22 Dec 19:23
· 19 commits to main since this release

Breaking Changes

This release simplifies text positioning with explicit vertical anchoring.

Removed

  • line_height field from text elements (rupdf renders single-line text only)

Added

  • vertical_anchor field for text with values:
    • "baseline" (default): y is the text baseline
    • "cap_top": y is the top of capital letters
    • "center": y is the midpoint between baseline and cap_top

Text Positioning

Text is now positioned using an explicit anchor point defined by:

  • Horizontal (align): "left" (default), "center", "right"
  • Vertical (vertical_anchor): "baseline" (default), "cap_top", "center"

Example:

{
    "type": "text",
    "x": 100, "y": 200,
    "text": "Hello",
    "font": "myfont", "size": 12,
    "align": "center",
    "vertical_anchor": "center"
}

Non-Text Elements

All non-text elements (rect, line, image, barcode, qrcode) use (x, y) as the top-left corner with no alignment support.

Installation

pip install rupdf==0.1.3