iTextSharp的和阿拉伯语字符? [英] Itextsharp and arabic character?

查看:170
本文介绍了iTextSharp的和阿拉伯语字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用iTextSharp的将HTML转换成PDF格式(使用asp.net C#)和中英文字符的工作,但是当我要转换的HTML,包括阿拉伯字符它会给我空PDF !!

i have use itextsharp to convert html to pdf(using asp.net C#) and its work in english characters , but when i want to convert html including arabic characters it will give me empty pdf !!

任何一个可以帮助我吗?

can any one help me?

推荐答案

的问题是,你的字体没有为阿拉伯语code点字形。您需要嵌入一个具有阿拉伯字形如arabtype.ttf字体。

The problem is that your font does not have glyphs for the Arabic code points. You need to embed a font that has Arabic glyphs such as arabtype.ttf.

string fontpath = Environment.GetEnvironmentVariable( "SystemRoot" ) + "\\fonts\\arabtype.ttf";
BaseFont basefont = BaseFont.CreateFont( fontpath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED );
Font arabicFont = new Font( basefont, 10f, Font.NORMAL );

这篇关于iTextSharp的和阿拉伯语字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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