diff --git a/src/pretix/base/pdf.py b/src/pretix/base/pdf.py
index ba767114bc..20cb190c7f 100644
--- a/src/pretix/base/pdf.py
+++ b/src/pretix/base/pdf.py
@@ -10,6 +10,8 @@ from functools import partial
from io import BytesIO
import bleach
+from arabic_reshaper import ArabicReshaper
+from bidi.algorithm import get_display
from django.conf import settings
from django.contrib.staticfiles import finders
from django.dispatch import receiver
@@ -449,6 +451,16 @@ class Renderer:
tags=["br"], attributes={}, styles=[], strip=True
)
)
+
+ # reportlab does not support RTL, ligature-heavy scripts like Arabic. Therefore, we use ArabicReshaper
+ # to resolve all ligatures and python-bidi to switch RTL texts.
+ configuration = {
+ 'delete_harakat': True,
+ 'support_ligatures': False,
+ }
+ reshaper = ArabicReshaper(configuration=configuration)
+ text = "
".join(get_display(reshaper.reshape(l)) for l in text.split("
"))
+
p = Paragraph(text, style=style)
p.wrapOn(canvas, float(o['width']) * mm, 1000 * mm)
# p_size = p.wrap(float(o['width']) * mm, 1000 * mm)
diff --git a/src/requirements/production.txt b/src/requirements/production.txt
index 863b30f19e..5273b4816c 100644
--- a/src/requirements/production.txt
+++ b/src/requirements/production.txt
@@ -62,3 +62,5 @@ django-redis==4.10.*
redis==3.2.*
django-phonenumber-field==3.0.*
phonenumberslite==8.10.*
+python-bidi==0.4.* # Support for arabic in reportlab
+python-arabic-reshaper==2.0.15 # Support for Aabic in reportlab
\ No newline at end of file
diff --git a/src/setup.py b/src/setup.py
index d115120173..e71d69ca5c 100644
--- a/src/setup.py
+++ b/src/setup.py
@@ -148,6 +148,8 @@ setup(
'urllib3==1.24.*', # required by current requests
'django-phonenumber-field==3.0.*',
'phonenumberslite==8.10.*',
+ 'python-bidi==0.4.*', # Support for Arabic in reportlab
+ 'python-arabic-reshaper==2.0.15', # Support for Arabic in reportlab
],
extras_require={
'dev': [