Search code examples
javaubuntufontsfont-facewkhtmltopdf

Georgian characters is not rendered by wkhtmltopdf on ubuntu 12.04


I'm generating pdf with wkhtmltopdf tool. I'm executing that process from Java and passing html with OutputSteam and getting result from process' InputStream. Everything is working fine on my dev Ubuntu 14.04 but on Ubuntu Server 12.04 Georgian fonts is not renderd, question marks is rendered instead like this: ?????????

Does anyone have some experience to render Chinese or some other font that English with wkhtmltopdf?


Solution

  • You need to embed a font which is capable of rendering your characters in the PDF itself. Add something like the following to your stylesheet:

    @font-face {
        font-family: 'myFont';
        src: url( '/public/inc/fonts/myFont.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
    }
    
    body {
        font-family: myFont;
    }