Support RTL
Hi chinapandaman First and foremost, I want to thank you for this library, it is currently the most promising tool for what I'm trying to create. I was able to load a custom Font, but the text is wrong. The result should be בדיקה but the text is הקידב Here is my code:
PdfWrapper.register_font("new_font_name", "/path/to/AharoniCLMBook.ttf")
form = PdfWrapper("my-file.pdf", global_font="new_font_name")
form.widgets["name_pensia_text_field_widget"].font = "new_font_name"
form.fill(
{
"text_field_widget": 'בדיקה'
},
)
with open("res.pdf", "wb+") as output:
output.write(form.read())`
[aharoni-clm-book.zip](https://github.com/chinapandaman/PyPDFForm/files/15051733/aharoni-clm-book.zip)
Hey, thanks for posting.
I traced through your snippet and up until this point text_to_draw was still בדיקה. But for some reason the canvas.drawString method (which is part of reportlab) seems to be drawing the characters in reverse order.
If I input the text in reverse order in the initial snippet, it will generate a correct PDF.
form.fill(
{
"text_field_widget": "הקידב"
},
)
I also tried your code using the FormWrapper. Same thing, the final text is printed in reverse order. I'm not sure what language these characters are but I guess it's just a common thing that PDF, regardless directly drawn or input through text field, prints these characters in reverse order?
So the only thing I could tell you is if you are using this specific font, reverse the string first before feeding into the library.