I'm using iTextSharp( C# iText port) to create pdfs from text/html. Most of my text is in Hebrew, a Right-To-Left language.
My problem is that PDFs show RTL langauge in reverse, so I need to reverse my strings in a way that would only reverse the RTL text without reversing any numbers or text in English. It is my understanding that fribidi allows doing that on linux, but I couldn't find any solutions for this problem for Windows.
I would welcome any suggestions, including an alternative to iTextSharp that would do this automatically (if one exists).
To show RTL texts by using iTextSharp correctly:
BaseFont.IDENTITY_H
RunDirection
, such as PdfPCell
, ColumnText
, etc. and now you can set their element.RunDirection = PdfWriter.RUN_DIRECTION_RTL
; HTML displays Hebrew/Arabic in Logical mode, and in PDF you need to store it Visual mode. What you need to do is convert from Logical to Visual mode. There are some libraries which do this (google for minibidi which is BSD licensed IMHO, or fribidi which is GPL or LGPL).
My real suggestion would be to change direction. Write a very small application in Qt4 which takes as first argument the URL, and the second the PDF to write. Since Qt4 has HTML support (via QtWebKit) has has the option to print to PDF (post script and SVG as well) this should be simpler then writing your own HTML->PDF solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With