Create PDF from HTML page with formatting retained in PDF in ASP.Net

Posted by Vishal Avhad on Stack Overflow See other posts from Stack Overflow or by Vishal Avhad
Published on 2012-09-27T14:55:46Z Indexed on 2012/09/27 15:37 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

I am trying to convert an HTML page to a PDF using iTextSharp.dll in ASP.Net.

I am able to convert the contents to my PDF , but the problem is that the Formatting of HTML page (which is inline) get removed from my PDF created.

For instance I have the following code block to be formatted from my HTML page to PDF.

<table style="width:90%; float:left; background:#dddddd; padding:15px; border:1px solid #000; color:#000;"><tr><td style="text-transform:uppercase; font-size:14px;font-weight:bold;">SPECIAL DELIVERY FOR:</td></tr><tr><td style="padding-left:40px; font-size:12px; color:#4e4e4e;">Name: #CustomerName#    
<br /><br /><label>
<b>Date: #CreatedOn#    
</b></label><br />
</td></tr>
</table>

I have to format my PDF with much more HTML codes like this.

I have used the Stylesheet class also, but that was not much of help.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about html