如何显示“$£Ω€απ⅔”在使用iReport的Jasperserver PDF中? [英] How can I display "$£Ω€απ⅔" in Jasperserver PDF using iReport?

查看:195
本文介绍了如何显示“$£Ω€απ⅔”在使用iReport的Jasperserver PDF中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用文本字段硬编码了

 :$£Ω€απ⅔:

测试这些字符是否以PDF格式显示



但是它只打印为

 :$£€:

我尝试将字体更改为符号,但这并不能解决问题。



注意:我正在使用iReport 5.5

解决方案

我使用


这是一个如何使用任意字体的例子,如果你喜欢
使用 DejaVu Sans DejaVu Serif 您可以在 jasper
报告字体库
中添加classpath,因此这些字体已经包含并映射到库中



I've hardcoded a Text field with the value

 ":$£Ω€απ⅔:" 

to test if these characters will show in PDF

But it only prints as

:$£€:

I've tried changing the font to "Symbol" but that does not do the trick.

Note: I'm using iReport 5.5

解决方案

I tried your characters using font-extensions in iReport, These are the steps that I took

  1. Download (or use one on your pc) your desired ttf font (it need to support the characters), I used dejavu-serif.
  2. Install the font in iReport or in Jasper soft studio (click links to understand how)

    • I used iReport 5.6 and did set the PDF-Encoding: Idenity-H (unicode with horizontal writing) and embedded the font in pdf. This was the code of my textField

      <textField>
          <reportElement x="8" y="15" width="100" height="20" uuid="41dc1200-091f-4799-a1d2-4622f88a0e84"/>
          <textElement>
              <font fontName="DejaVu Serif" size="13"/>
          </textElement>
          <textFieldExpression><![CDATA[":$£Ω€απ⅔:"]]></textFieldExpression>
      </textField>
      

  3. Export the font extension (this creates a .jar)

  4. Add the jar to your classpath.
  5. Export to pdf and enjoy the result.

This is an example of how to use any arbitrary font, if you like to use DejaVu Sans or DejaVu Serif you can just include the jasper report fonts library in classpath, hence these font are already included and mapped in library

这篇关于如何显示“$£Ω€απ⅔”在使用iReport的Jasperserver PDF中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆