From 74bed6d8b347beb22be09873acec5c6f9e398eb9 Mon Sep 17 00:00:00 2001 From: yopiti Date: Fri, 17 Jul 2026 16:07:57 +0200 Subject: [PATCH] fix: import ShowBoundaryValue from new reportlab location reportlab moved ShowBoundaryValue from reportlab.platypus.frames to reportlab.pdfgen.canvas in the 4.4 line. Import it from the new location with a fallback to the old one for older reportlab, matching upstream. Unblocks reportlab>=4.4.3 (and svglib 2.0.2, which requires it). --- xhtml2pdf/context.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xhtml2pdf/context.py b/xhtml2pdf/context.py index 31abc542..ba263e3f 100644 --- a/xhtml2pdf/context.py +++ b/xhtml2pdf/context.py @@ -27,7 +27,13 @@ from reportlab.lib.styles import ParagraphStyle from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont -from reportlab.platypus.frames import Frame, ShowBoundaryValue +from reportlab.platypus.frames import Frame + +try: + from reportlab.pdfgen.canvas import ShowBoundaryValue +except ImportError: + # reportlab < 4.0.9.1 + from reportlab.platypus.frames import ShowBoundaryValue from reportlab.platypus.paraparser import ParaFrag, ps2tt, tt2ps from xhtml2pdf import default, parser