【问题标题】:How to display "Times new roman" font for Romanian language in pdf using iTextSharp如何使用 iTextSharp 在 pdf 中显示罗马尼亚语的“Times new roman”字体
【发布时间】:2012-07-18 07:42:47
【问题描述】:

LoadTagStyle 不适用于带有 times new roman 字体的标签正文 我想在 pdf 文档中生成一个 html 页面在他的里面我有字体时间新罗马 我尝试设置字体时间新罗马,但他不工作

我尝试了几种情况:

 var styles = new StyleSheet();

1. styles.LoadTagStyle("body", "font-family", "times new roman");
2. styles.LoadTagStyle("body", "face", "times new roman");
3. styles.LoadTagStyle(HtmlTags.BODY, "face", "times new roman");
4. styles.LoadTagStyle(HtmlTags.BODY, HtmlTags.FONT, "times new roman");

但是这些例子都不起作用

我也试过了:

FontFactory.RegisterDirectories();

FontFactory.Register(FULL_PATH_TO_TIMES_NEW_ROMAN); 

style.LoadTagStyle(HtmlTags.TABLE, HtmlTags.FACE, "times-roman");

生成的文本没有变音符号 有什么建议吗?

【问题讨论】:

    标签: c# stylesheet html-to-pdf


    【解决方案1】:

    这段代码解决了我的问题

                FontFactory.Register("c:\\windows\\fonts\\times.ttf");
                StyleSheet st = new StyleSheet();
                st.LoadTagStyle(HtmlTags.TABLE, "border", "1");
                st.LoadTagStyle("body", "face", "times new roman");
                st.LoadTagStyle("body", "encoding", "Identity-H");
    

    【讨论】:

      【解决方案2】:

      我试过这个 Itz Working 快试试吧。


      FontFactory.RegisterDirectories();
      styles.LoadTagStyle(HtmlTags.TABLE, HtmlTags.FONT, "comic-sans-ms");

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-11-24
        • 2016-09-23
        • 1970-01-01
        • 2022-11-01
        • 1970-01-01
        • 2011-05-27
        • 2020-02-01
        • 1970-01-01
        相关资源
        最近更新 更多