[Python] How to print Arabic and English text together using Python's fpdf library

Discussão em 'Python' iniciado por Stack, Junho 20, 2025.

  1. Stack

    Stack Membro Participativo

    pdf.multi_cell(w=150, h=5, txt="تمانتمانتمانتمانتم English Letters")


    "English Letters" is rendered as a row of rectangles in the output:

    [​IMG]

    I also tried using arabic_reshaper Example code snippet:

    import arabic_reshaper
    from bidi.algorithm import get_display
    reshaped_text = arabic_reshaper.reshape(text)
    bidi_text = get_display(reshaped_text)
    pdf.set_xy(9, 132)
    pdf.multi_cell(w=150, h=5, txt=bidi_text)


    ...but it didn't work. Are there any other possible ways to make it work?

    Continue reading...

Compartilhe esta Página