This project is read-only.

CSS Property 'font-size' Ignored

Oct 30, 2015 at 4:04 PM
Edited Oct 30, 2015 at 4:07 PM
I'm not sure if this is a bug or if I'm just doing something incorrectly, but it appears that the font-size property within my css is being ignored. My project allows a user to enter text in markdown format, which I translate into HTML, and then a user can print a PDF version. Since there are a lot of sections I'm using the HtmlRenderer.RenderToImage() and inserting the images into the PDF.

The HTML has no inline styles because it's converted from markdown, and really only paragraphs, and lists are being used. Therefore I have a a style string (see below) that gets parsed with HtmlRenderer.ParseStyleSheet() to create a CssData object to pass into the RenderToImage function.

"p, li { font-size = xx-small; font-family: \"Trebuchet MS\",Helvetica, sans-serif; line-height: 1; margin: 0px; }"

I noticed that no matter what I set for the font-size property the text was always the same size when rendered into the image, so I set a breakpoint to see what is the CssData object. All of the properties except for the font-size property was added to the correct elements.

What do I need to do to make sure that the font-size is honored?