`
endual
  • 浏览: 3508473 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

com.itextpdf.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' is

    博客分类:
  • java
 
阅读更多

 

  http://itext-general.2136553.n4.nabble.com/Asian-font-not-recognized-after-update-td2991134.html

 

  我们使用国语的时候,将要把加入亚洲语言的一个包,而这个包只支持到2.X,后续版本的升级中,

  这个包名变掉了,因而需要我们寻找到新的包进行添加到应用中。

 

 

 

 

com.itextpdf.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized.

 

 

 

Hi all, 

I just recently updated the iText.jar for my program from iText 2.1.7 to iText 5.0.4. There had been quite some changes and one of them is bothering me right now and I can't figure out why. I used to be able to
have my program function correctly and generates a PDF file with chinese characters. Code snippit: 

BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); 
Font fontChinese = new Font(bfChinese, 13, Font.NORMAL); 




After I did the update, this line of code no longer works. It's throwing me this exception: 

com.itextpdf.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized. 

I already imported iTextAsian.jar (as it worked for me before the update). 

Thanks! 
John
Reply | Threaded | More     star

Re: Asian font not recognized after update

1T3XT BVBA
4767 posts
We will probably ban users with a hotmail or gmail address 
in the future, so it's probably better to use you Wipro address 
so that we know who we are talking to, Mr. Supreme... 

Also: you should subscribe to the list. 

On 12/10/2010 7:01, supremelmfz wrote: 
> After I did the update, this line of code no longer works. It's throwing me 
> this exception: 

> com.itextpdf.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' 
> is not recognized. 

> I already imported iTextAsian.jar (as it worked for me before the update). 

I think you are using the old iTextAsian.jar. 

In the old iTextAsian.jar there are directories 
com/lowagie/text/pdf/fonts 
In the new iTextAsian.jar there are directories 
com/itextpdf/text/pdf/fonts 

The new iTextAsian.jar won't work for the old iText, 

and vice versa. 
分享到:
评论
2 楼 endual 2012-11-08  
禀圣含华 写道
我改了这个iTextAsian包,还是一样的,求解啊

或许你要降低Itext.jar的版本

这里有资源
http://download.csdn.net/detail/endual/4482470
1 楼 禀圣含华 2012-11-07  
我改了这个iTextAsian包,还是一样的,求解啊

相关推荐

    itextpdf5.4.3+itextasian5.2.0

    解决 com.itextpdf.text.DocumentException: Font 'STSongStd-Light' with 'UniGB-UCS2-H' is not recognized. 亲测可用!

    tif 转合并 pdf itext java

    这是本人最近工作中的一个真实项目,将tif文件转换成pdf文件或者把多个tif文件合并成一个pdf文件。在这里跟大家分享下,希望能帮到哪位朋友。 内附详细代码及说明 和 itext包

    com.lowagie.text.jar

    java使用iText实现PDF文件添加水印功能的jar包

    itextsharp生成pdf插件

    生成pdf的插件工具,绿色插件,请放心使用,C#使用方法:先引用itextsharp.dll动态链接库,然后using itextsharp.text等空间,即可使用。 引用: using iTextSharp; using iTextSharp.text; using iTextSharp.text....

    C#创建PDF文件一例

    // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter.getInstance(document, new FileStream("Chap0101.pdf", FileMode.Create)); ...

    使用 dom4j 解析 XML

    使用 dom4j 解析 XML;很不错的中文文档

    Java生成pdf的demo.rar

    java导出pdf需要用到iText库,iText是著名的开放源码的站点sourceforge一个项目,是用于生成PDF文档的一个java类库。通过iText不仅可以生成PDF或rtf 的文档,而且可以将XML、Html文件转化为PDF文件。 iText的安装...

    java项目超市

    // 2.获取输出流 OutputStream os = socket.getOutputStream(); ObjectOutputStream oos =new ObjectOutputStream(os); Choice c=new Choice(); c.choice(ois, oos); // 关闭资源 oos.close(); ...

    用户注册和登录是每个系统的必须存在的一部分,基于Dwr+Struts2+Spring+Hibernate写了一个用户登录注册系统

    22. //如果不用此包会抛出:java.lang.NoClassDefFoundError: org/dom4j/DocumentException 23. dom4j-1.6.1.jar 24. 25. //dwr必须 26. dwr.jar 27. 28. 29. //不用此包,在启动时招聘:java.lang....

    poi所有jar,dom4j-1.6.1.jar,xmlbeans-2.6.0.jar

    解决:HSSFWorkbook 解决:java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions 解决:java.lang.NoClassDefFoundError: org/dom4j/DocumentException

    org.dom4j.jar

    java.lang.ClassNotFoundException: org.dom4j.DocumentException 缺少dom4j.jar包 加进去即可

    xml简单实现学生管理系统!看不懂来打我!!!

    目录一:项目分析二:实现步骤1.Dom4j工具类2.创建xml文件:3.Service层4.测试方法 一:项目分析 学生管理系统: 通过利用xml文件的存储功能来存储学生信息。再用dom4j解析器来对xml文件进行操作,也会用到一点xpath...

    apache-cxf

    } catch (UnsupportedEncodingException | DocumentException e) { } catch (ClientException e) { } if(null == doc){ return null; } Element root = doc.getRootElement(); if(UtilValidator.isEmpty...

    JAVA读XML:sax,dom,jdom,dom4j的比较以及选择.doc

    JAVA读XML:sax,dom,jdom,dom4j的比较以及选择.doc

    在dom4j中使用XPath的简单实例

    import org.dom4j.DocumentException; import org.dom4j.Node; import org.dom4j.io.SAXReader; public class Demo4 { public static void main(String[] args) throws DocumentException { SAXReader reader=new ...

    Tomcat解析XML和反射创建对象原理

    下面通过实例代码给大家介绍Tomcat解析XML和反射创建对象原理,具体代码如下所示: ...import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; public class ServerReadXML1

    dom4j 使用简介 代码 程序

    // )(Z QXML,*B(Z_,+, XML (E ...MalformedURLException, DocumentException { SAXReader reader = new SAXReader(); Document document = reader.read(new File(fileName)); return document; }

Global site tag (gtag.js) - Google Analytics