How to display “Times new roman” font for Romanian language in pdf using iTextSharp

StackOverflow https://stackoverflow.com/questions/11536540

  •  21-06-2021
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

I tried this Itz Working Jst Try It.


 FontFactory.RegisterDirectories();
styles.LoadTagStyle(HtmlTags.TABLE, HtmlTags.FONT, "comic-sans-ms");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top