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
If you don't really need a true .Net PDF library, there are numerous free HTML to PDF tools, many of which can run from a command-line.
One solution would be to pick one of those and then write a thin wrapper around that in C#. E.g., as done in this tutorial.