Convert HTML to PDF in .NET

后端 未结 30 1821
不知归路
不知归路 2020-11-22 00:28

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

30条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 00:51

    It depends on any other requirements you have.

    A really simple but not easily deployable solution is to use a WebBrowser control to load the Html and then using the Print method printing to a locally installed PDF printer. There are several free PDF printers available and the WebBrowser control is a part of the .Net framework.

    EDIT: If you Html is XHtml you can use PDFizer to do the job.

提交回复
热议问题