Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Rendering to PDF in Simplified Chinese
grather
<p>I have a Birt Report rendering to PDF.</p><p>The report was localized and the selected Locale was zh_CN.</p><p> </p><p>Problem was some of the characters were missing. And some of the characters were incorrectly being highlighted.</p><p> </p><p>So my guess was the font being used did not have all the data that was needed.</p><p> </p><p>Here is what I learned and how I solved my issue.</p><p> </p><p>First I needed to figure out what font was actually bing used.</p><p> </p><p>To determine this In Acrobat Reader -- > file -- properties</p><p>I found when there was simplified the Msung Light was the font being embedded</p><p> </p><p>After a bit of talking to my client. I found that SimSun.ttf was a good option for Simplified Chinese.</p><p> </p><p> </p><p>And to make it a bit more challenging my client was in production and could not make any server changes. So could I deliver the font in the application and use that.</p><p> </p><p>So pdf is rendered by BIRT using iText. And that there is a config_PDF.xml that needs to be modified</p><p>to get the font SimSun.ttf to be used for Simplified Chinese I modified one line</p><p><composite-font name="all-fonts"></p><p> <font font-family="SimSun" catalog="Chinese" /></p><p></composite-font></p><p> </p><p>But this file is the BIRT world is in a signed jar file.</p><p>In the version I am using it is org.eclipse.birt.runtime_4.2.2.v20130216-1152.jar</p><p> </p><p>To remove the signature.</p><p>Open in WinZip remove the EC:ISPE_.rsa and the ECLI{PSE_SF from the META_INF directory</p><p>And modified the MANIFEST.MF file to remove all the Signature parts. Everything but the first 5 lines were removed. Now the jar dosn't throw security warning.</p><p>And when creating a Simplified Chinese PDF the SimSun.ttf will be used.</p><p> </p><p>But still need to make there font dynamically available. If you can install the font. All is fine.</p><p> </p><p>But I could not due to client restrictions.</p><p> </p><p>So I put the file in the ear file.</p><p>Then at startup copied that SimSun.ttf to the file system (I used the /tmp dir but any directory will work)</p><p> </p><p>Then need to tell iText the font is available.</p><p> </p><p>All that is needed is</p><p>FontFactory.registerDirectory(fontsdir.getAbsolutePath());</p><p> </p><p>Now all is working with my PDF in chinese.</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>
Find more posts tagged with
Comments
mwilliams
This would be a good post for the <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/devshare/'>devShare</a>
; so others can find it easier.