LoadTagStyle does not work for tag body with times new roman font I want to generate in pdf document one html page inside his I have font times new roman I try to set font times new roman but his not work

I tried several cases:

 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");

but none of these examples work

Also I tried :

FontFactory.RegisterDirectories();

and

FontFactory.Register(FULL_PATH_TO_TIMES_NEW_ROMAN); 

and

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

generated text is without diacritics some proposal?

有帮助吗?

解决方案

This code solve my problem

            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");

其他提示

I tried this Itz Working Jst Try It.


 FontFactory.RegisterDirectories();
styles.LoadTagStyle(HtmlTags.TABLE, HtmlTags.FONT, "comic-sans-ms");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top