Style problems when converting HTML to PDF

I am having problems with styles when converting HTML to PDF as others have mentioned.

I have looked at the archive file Awais Hafeez uploaded as a work around in response to post WORDSNET-3703 and am still having some problems.

I have expanded on that example and have attached an archive file with the html, the source code and an image showing the html rendered in a browser compared to the rendered PDF.

Can I get some guidance on how to render the HTML so that it will convert corretly to PDF?

Problems seem to be inline styles in general and some styles applied to table elements. The only thing I can seem to get to work are inline styles on spans and styles applied to table cell elements by using the “class=” syntax.

The sample app I’m using to render this is an ASP.Net MVC 3 web app using the Razor view engine. The controller returns a view with an object tag that executes a server action to return the pdf as a FileResult. The pdf is then displayed in adobe reader.


Hi ken,

Thanks for your inquiry.
Please download attachment and see the difference, I have added new class selector named “divGrayClass” and removed your inline style like this:

A div with an inline style.

.divGrayClass { background-color: Gray; font-family:Comic Sans MS; color:#004071; font-size:24px }

Follow up this mechanism. In case of any ambiguity, please let me know.
Hope this will help you.