Skip to content
Advertisement

React pdf-renderer does not display characters č, ć and đ

I’m using @react-pdf/renderer version “1.6.8”. However, am unable to get the following characters: čćđ. Instead get empty spaces.

The characters are from the Croatian language and can be tested on their official page.

https://react-pdf.org/repl?example=page-wrap

Might someone know what to setup or how to approach the problem. Haven’t found anything on their official docs.

Github issue: https://github.com/diegomura/react-pdf/issues/780

Advertisement

Answer

Just imported custom fonts like this and it worked for me:

import font from '/styles/localFonts/Poppins-Medium.ttf

Font.register({ family: 'Poppins', src: font })
Advertisement