Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reportlab Compatibility: Adapt to New ShowBoundaryValue Import #754

Merged
merged 4 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies = [
"pyhanko-certvalidator>=0.19.5",
"pypdf>=3.1.0",
"python-bidi>=0.4.2",
"reportlab>=4.0.4,<4.1",
"reportlab>=4.0.4,<5",
"svglib>=1.2.1",
]
dynamic = ["version"]
Expand All @@ -67,10 +67,10 @@ Changelog = "https://xhtml2pdf.readthedocs.io/en/latest/release-notes.html"

[project.optional-dependencies]
pycairo = [
"reportlab[pycairo]>=4.0.4,<4.1",
"reportlab[pycairo]>=4.0.4,<5",
]
renderpm = [
"reportlab[renderpm]>=4.0.4,<4.1",
"reportlab[renderpm]>=4.0.4,<5",
]
test = [
"tomli>=2.0.1; python_version<'3.11'",
Expand Down
8 changes: 7 additions & 1 deletion xhtml2pdf/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading