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

查看:35
本文介绍了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 !!

有人可以帮我吗?

推荐答案

问题是您的字体没有用于阿拉伯语代码点的字形.您需要嵌入具有阿拉伯字形的字体,例如 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天全站免登陆