简体   繁体   中英

cete.DynamicPdf formattedTextArea doesn't render html

I am trying to create a pdf with text formatting using cete.dynamicpdf and html I am using the formattedtextarea which supposedly can handle html input.

     FontFamily ff = new FontFamily("fontFamily", font);
        FormattedTextAreaStyle style = new FormattedTextAreaStyle(ff, fontSize, true);
        FormattedTextArea textArea = new FormattedTextArea(HttpUtility.HtmlDecode(text), x * mmToPoints, y * mmToPoints, w * mmToPoints, h * mmToPoints, style);

I am currently passing simple tags to the "text", but when the documents gets created no bold text is to be seen. 简单的标签传递给“文本”,但是在创建文档时,看不到任何粗体文本。

I needed to define some fonts for the fontfamily object to get the tags to work

    //Building font objects and FontFamily object. 
        TrueTypeFont verdanaRegularFont = new TrueTypeFont("verdana.TTF");
        TrueTypeFont verdanaBoldFont = new TrueTypeFont("verdanab.TTF");
        TrueTypeFont verdanaBoldItalicFont = new TrueTypeFont("verdanaz.TTF");
        TrueTypeFont verdanaItalicFont = new TrueTypeFont("verdanai.TTF");
        FontFamily verdanaFontFamily = new FontFamily("VerdanaFontFamily", verdanaRegularFont, verdanaBoldFont, verdanaItalicFont, verdanaBoldItalicFont); 
        FormattedTextAreaStyle style = new FormattedTextAreaStyle(verdanaFontFamily, fontSize, true);
        FormattedTextArea textArea = new FormattedTextArea(HttpUtility.HtmlDecode(text), x * mmToPoints, y * mmToPoints, w * mmToPoints, h * mmToPoints, style);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM