(Quick Reference)

8 Exotic Characters - Reference Documentation

Authors: Grails Plugin Collective

Version: 1.0.0

8 Exotic Characters

In most cases, there are no issues with dealing with exotic Unicode characters. However, certain characters will not render in PDF documents without some extra work (the same problem does not exist when rendering images). This is a quirk with the way iText works, which is the library underpinning the PDF generation.

This thread explains the issue.

The solution is to register the font to use with a particular encoding. Because we are using XHTMLRenderer we can specify this in CSS as opposed to programatically registering.

@font-face {
      src: url(path/to/arial.ttf);
      -fs-pdf-font-embed: embed;
      -fs-pdf-font-encoding: cp1250;
    }
    body {
      font-family: "Arial Unicode MS", Arial, sans-serif;
    }

See this page for details on these CSS directives.