编写特殊字符purepdf在AS3 [英] Writing special characters with purepdf in AS3

查看:211
本文介绍了编写特殊字符purepdf在AS3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Flex 4和需要导出的一些PDF文件。我期运用purePDF库这一点。任何人都可以解释我如何使可能写在purePDF PDF文件罗马尼亚的字符 - >我需要写像AIST人物,等等

I'm working with flex 4 and need to export some pdf files. I'm useing purePDF library for this. Can anyone explain me how to make possible to write romanian characters in pdf files with purePDF -> I need to write characters like ăîşţ, etc.

我看维基该库的文档中,但不能充分理解我需要什么。鸭preciate任何帮助。

I look in the wiki documentation of that library but cannot understand enough what I need. Appreciate any help.

感谢

推荐答案

我会问我自己的问题,也要考虑到这将是另一种很有用的。

I'll ask my own question, taking in consideration that it'll be useful for other one.

注:以在帐户purepdf是iText库相当于从Java中,当您遇到任何问题和需要的文档,你可以咨询iText的文档中获取灵感与purePDF

Note: Taking in account that purepdf is the iText library equivalent from Java, when you encounter any problems and need documentation, you can consult iText documentation for inspiration with purePDF.

原来这就是你需要做的:

So this is what you need to do:

  • 找到包含您的特殊字符(TTF扩展名)合适的True Type字体。对我来说,我发现在/ usr /共享/字体/ TrueType字体/*.
  • 复制* .TTF字体文件为您的应用程序中使用的目录(在我的情况资产目录)
  • 您发现后,你可以尝试,如果通过以下code匹配您的需求:

  public static const SERIF_NORMAL : String = "FreeSerif.ttf";

  //"assets/fonts/FreeSerif.ttf" is the directory where I copied my *.ttf files
  [Embed(source="assets/fonts/FreeSerif.ttf", mimeType="application/octet-stream")]
  private var serifNormalCls : Class;
  private var normalFont : Font;

  var bfNormal : BaseFont;
//...
  //in youre initialization function :
  FontsResourceFactory.getInstance().registerFont(SERIF_NORMAL, new this.serifNormalCls());
  bfNormal = BaseFont.createFont(SERIF_NORMAL, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

  //and when you need to use your the special characters, you will use that font
  this.normalFont = new Font(Font.UNDEFINED, 10, Font.UNDEFINED, null, bfNormal);

干杯!

这篇关于编写特殊字符purepdf在AS3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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