ATMIT contributes solving the RTL and Arabic characters in PDF reports
OpenERP is multilingual, and the Arabic language is among the official translations that could be easily loaded using the translation wizard in OpenERP 6.1. However there was a problem in rendering texts written in Right-to-Left (RTL) languages in general and Arabic texts in particular into PDF reports, where the text was being displayed detached and in Left-To-Right (LTR) direction in place of RTL, see photo below.
Today, at ATMIT, an OpenERP partner, we have the pleasure to announce that our technical team has continued and elaborated on previous efforts of other partners/community (such as am4computers and Pragmatic) and fixed this obstacle, and our OpenERP customers are already enjoying printing the reports in Arabic. Having the Open Source concept in mind and the development tools in hand, we are happy to publish the solution and share it with the OpenERP community and partners, especially with those who were stuck in the same point. Below, the solution and a detailed instruction on how to fix the problem.
The solution consists of 4 main modification steps:
1- Update Packages
Open your terminal and execute the following commands to update your software list with the latest changes made in repositories:
sudo apt-get update
And then, upgrade your system by typing:
sudo apt-get upgrade
2- InstallingReportLab Dependencies
OpenERP 6.1 uses the ReportLab open-source toolkit to generate reports in PDF. RML2PDF, a central component of ReportLab that converts XML tags into PDF documents, unfortunately doesn’t support by default the RTL languages format. To enable the RTL support, we should install and rebuild 3 depending librariespkg-config, FriBiDi and PyFribidi.
sudo apt-get install pkg-config
sudo apt-get install libfribidi0
sudo apt-get install python-pyfribidi
3- Replace 3 ReportLab Files
In order to make your life easier, simply download the 3 files below and replace them with the old ones in the directories mentioned in the next table
|File Name||Directory||Linked Directory||Download|
4- Fix OpenERP Files
Similar to step 4, you now have to download and replace only 2 files in OpenERP subdirectories as described in the table below:
Now you’re almost done. Just restart your openerp service and you should be ready for creating your PDF reports in Arabic with attached letters and in RTL format, just like the photo below.
P.S. all above mentioned steps and commands were executed and successfully tested using Ubuntu 11.10.
P.S. In the source files that you downloaded from this page, every modification done by ATMIT is indicated by a comment “# added by ATMIT”.