Adds support for UFT-8 when rendering pdf.

General clean up.