HTML Renderer

HTML Renderer “is a 100% managed C# library that draws beautifully formatted HTML”.
It was originally started by Jose Menendez Póo writing an article on CodeProject and hosting the project on CodePlex.
 
Jose seems to discontinued working on the project as his last update was Jan 29, 2009. Offering my contribution to the project Jose added me as project developer and on Nov. 5 2012 I have posted my first contribution to the project based on performance improvements I did.
 
I’m planning to continue contribute to the project, big thanks to Jose for his great work and giving me the opportunity to contribute, this is my first contribution to open source and I’m very excited about it.
 

Issues and Discussions

This page, or my blog in general, is not suitable for raising issues or asking question, please use the project pages hosted on CodePlex:

 

Source code

Hosted on GitHub: ArthurHub/HTML-Renderer.
Do fork and I will appreciate Pull Requests.
 

Relevant posts

 

Background

Managed HTML rendering is really old problem, my first encounter with this issue was back in 2005, my first project in my first workplace, where I needed to render rich HTML document and have some simple rich text editor that generated HTML.
 
Over the years, again and again, I have faced the same requirement with minor variation and I always have surrendered to using some form of Internet Explorer ActiveX wrapper, the obvious being WebBrowser control. This until my most recent project where I really needed good performance and stable component including on x64 architecture – not a simple requirement.
 
After using GeckoFX and then WebBrowser control with Internet Protocol I concluded that the only way to reach my performance and stability goals was to use 100% managed code. Searching the web for the solution I come up with two candidates: HTML Renderer andHTML Editor Control, after some testing and improving HTML Renderer performance I have concluded that HTML Renderer is right for the job and the code is simple enough to improve it for my needs.
Shortly after I decided that the improvements I’m going to do can benefit the community so I decided to contribute to the open source project.
 

Testimonials

HTML Renderer is used in Jive for Outlook and Jive for Office projects to render rich HTML discussions.
 

Links

14 comments on “HTML Renderer

  1. Nurul Huda says:

    Thanks for genius thing, I was confused to use default reporter from .NET, so I think html-renderer is the best one. Sadly, I cant use html panel on my VS-2005 (.Net 2), so, can you recompile it to make control possible to use using VB.NET 2005

    • Arthur says:

      The project is using VS2013 but it is compiled to .NET 2.0 – 4.5
      Just reference the correct dlls, no need to recompile the project.
      Also prefer using NuGet package: HtmlRenderer.WinForms

  2. Luigi says:

    Hi Arthur,

    I appreciate your work and I managed to implement your dll in my VS2013 web project.
    It works perfectly in local when I debug it with IIS Express but when I try to use it in a web server IIS 4.0 each time I try to render something I have troubles with IIS.
    Searching in the Server applications log I’ve found that w3wp.exe systematically crash.

    I didn’t find anybody with my same problem so I decided to write to you directly.
    Maybe you can help me with this problem because I’d like to use HtmlRenderer!!!

    Thank you in advance

    • Arthur says:

      I can’t say for sure, it may be an issue with native GDI calls.
      Try setting a flag to use GDI+ (UseGdiPlusTextRendering property or RenderToImageGdiPlus methods)

  3. George says:

    Hi Arthur,

    Thanks for your great work. I do have question on PdfGenerator.GeneratePdf(string html, PdfGenerateConfig config);
    I’m unable to change orientation of the document to landscape is there any demo and code sample to check.
    I changed the document page orientation to landscape but I I got blank page. I set PdfGenerateConfig.MarginTop to 250 and PageSize.A4 I was able to render the html but the content is cutted and shifted to the left. I would appreciate if you could give me some hint on how to solve this issue.

    Thank you.

    • Arthur says:

      I don’t have the resources to support this project at this time.
      I don’t have a tip either, you will have to fork and look for the issue.
      Sorry.

  4. Intrepid71 says:

    Is it possible to specify page orientation when using PdfGenerator.GeneratePdf(..)? I need to generate a Pdf from HTML in landscape mode. Thanks for a great tool!

  5. Anton says:

    Have you considerer writing a converter for DocX similar to the one for PdfSharp?

  6. xukun says:

    Hello! Is it free for any software?

  7. Jes says:

    Is posible to add page breaks in PDF?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s