I use gem combine_pdf for load existed pdf file and add some text (in French) to it. But some specific charactets displaying poorly: https://drive.google.com/file/d/1LAiK3JJTDjbVpgXrA9ITfCTeYSVws37x/view?usp=sharing
I try:
CombinePDF::Fonts.register_font(Rails.root.join('app/assets/fonts/slick.ttf'), font_metrics, Type: :Font)
font_metrics i take from Helvetica font from initiate_library function (CombinePDF::Fonts). But it not work... What am I doing wrong?
I had the exact same problem with the
combine_pdfgem. I did manage to fix it following the recommendations in the combine_pdf #137 issue.I created a PDF file with all the characters needed with a font that includes those characters (basically the entire alphabet, including the special characters
é à êas well as€or'characters).Register the font as an available font in combine_pdf (e.g. your controller):
font: :new_font(or set it globally in an initialiser).You can see a full example here in the combine_pdf_demo
The biggest problem for me was to correctly embed the new font in the PDF template. You need to make sure the fonts are actually embedded in the PDF, as sometimes system-fonts don't get properly embedded. Also make sure to include all the characters needed in your text.