Amazing! Can easily be adjusted to generate searchable PDFs in Arabic, using bidi and arabic-reshaper:
import arabic_reshaper
from bidi.algorithm import get_display
from arabic_reshaper import reshape
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
etc.
# Adding a font since Reportlab's default font doesn't support arabic
pdfmetrics.registerFont(TTFont('FontName', 'path to the font directory/FontName.ttf'))
# Calculate text rotation angle
text.textOut(get_display(reshape(word.content + " ")))
Original code here: https://github.com/abderrahmaneMustapha/add-arabic-reportlab
Tutorial here: https://abderrahmane.hashnode.dev/how-to-add-arabic-text-on-pdf-with-reportlab
One question though: how can we add line breaks/paragraphs using this code?
Cheers,