Reputation: 49
I have tried all the react pdf generators to support Hebrew text. I successfully built the whole reporting system with pdfmake, but then I came to realize it doesn’t support Hebrew ( rtl ). I tried to change the fonts by looking on few solutions. Somebody please specify some package that can support Hebrew in a proper way. I don’t know how to add fonts to any of the packages.
Upvotes: 4
Views: 2291
Reputation: 21
It helped me with Hebrew in react-pdf/renderer, but in PDF if hebrew has unicode symbols text is broken .
Font.register({ family: 'Rubik', src: "http://fonts.gstatic.com/s/rubik/v3/4sMyW_teKWHB3K8Hm-Il6A.ttf" });
It works in my app . But doesn't work if substitute in https://react-pdf.org/repl?example=page-wrap .Look for "Rubik" in this file (Ctrl + F and insert Rubik in search input): https://gist.github.com/karimnaaji/b6c9c9e819204113e9cabf290d580551, all fonts related to Rubik contain Hebrew characters .
Upvotes: 2
Reputation: 31
I am using react-pdf
I had the same problem - Hebrew was gibberish. Solved it by adding and using Rubik font.
In react-pdf it's pretty easy to add a font:
Font.register({
family: 'Rubik',
src: '/fonts/Rubik-Regular.ttf'
});
I also tried pdfmake but eventually chose react-pdf because it has better documentation and it had everything I needed.
Upvotes: 3