I want to generate a PDF by passing HTML contents to a function. I have made use of iTextSharp for this but it does not perform well when it encounters tables and the layout
Update: I would now recommend PupeteerSharp over wkhtmltopdf.
Try wkhtmtopdf. It is the best tool I have found so far.
For .NET, you may use this small library to easily invoke wkhtmtopdf command line utility.