简体   繁体   中英

how convert html string to pdf using c#

i have a string variable with html code and need convert to pdf the code of the variable, the variable is filled with the data of one gridview

<div>
<table>
<tr>
<td>Name</td>
<td>Cuty</td>
<td>Other Row</td>
<tr>
<td>Jonh</td>
<td></td>
<td></td>
<tr>
<tr>
<td>Name</td>
<td style="background-color:#00AA55;">Mary</td>
<td></td>
<td></td>
<tr>
</table>
</div>

and i need convert this table in pdf including the row style. currently use itext library but don't add the style on the document

If you want a lot of painstaking work - create your own html -> pdf converter using PDFSharp ( http://pdfsharp.com/ ). However, depending on the usage, I've heard using the internet explorer COM is a good solution. You can always print an HTML page to a virtual PDF printer.

Use PDFizer , whenever you have valid xHTML (which you should always have).

It's pretty much the most reliable library out there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM