문제

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 some text 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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top