<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Html to Pdf in .NET</title>
	<atom:link href="http://hamang.net/2008/08/14/html-to-pdf-in-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/</link>
	<description>- the everyday life</description>
	<lastBuildDate>Wed, 04 Jan 2012 17:56:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: harin yadav.C</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-49833</link>
		<dc:creator>harin yadav.C</dc:creator>
		<pubDate>Mon, 28 Nov 2011 14:39:45 +0000</pubDate>
		<guid isPermaLink="false">#comment-49833</guid>
		<description>i found FactoryProperties.cs  in 5.0 version when i include your snippet its giving me error 

Cannot implicitly convert type &#039;iTextSharp.text.BaseColor&#039; to &#039;System.Drawing.Color&#039;

at line
Color c = Markup.DecodeColor(prop[key]);

how to fix this error..</description>
		<content:encoded><![CDATA[<p>i found FactoryProperties.cs  in 5.0 version when i include your snippet its giving me error </p>
<p>Cannot implicitly convert type &#039;iTextSharp.text.BaseColor&#039; to &#039;System.Drawing.Color&#039;</p>
<p>at line<br />
Color c = Markup.DecodeColor(prop[key]);</p>
<p>how to fix this error..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: harin yadav.C</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-49832</link>
		<dc:creator>harin yadav.C</dc:creator>
		<pubDate>Mon, 28 Nov 2011 13:57:40 +0000</pubDate>
		<guid isPermaLink="false">#comment-49832</guid>
		<description>I&#039;m using iTextSharp version 5.1.2. There is no FactoryProperties.cs file, no InsertStyle method, and IncTable.cs file. How can I modify iTextSharp&#039;s source to get background color and table border color? I can&#039;t figure out how to achive that functionality in this version.
Thnx!</description>
		<content:encoded><![CDATA[<p>I&#039;m using iTextSharp version 5.1.2. There is no FactoryProperties.cs file, no InsertStyle method, and IncTable.cs file. How can I modify iTextSharp&#039;s source to get background color and table border color? I can&#039;t figure out how to achive that functionality in this version.<br />
Thnx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gautham</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-44888</link>
		<dc:creator>gautham</dc:creator>
		<pubDate>Wed, 19 Oct 2011 06:35:40 +0000</pubDate>
		<guid isPermaLink="false">#comment-44888</guid>
		<description>thks..</description>
		<content:encoded><![CDATA[<p>thks..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How To Convert HTML To PDF With Image Tags Using iTextSharp &#124; Top Online Trading</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-41685</link>
		<dc:creator>How To Convert HTML To PDF With Image Tags Using iTextSharp &#124; Top Online Trading</dc:creator>
		<pubDate>Wed, 28 Sep 2011 19:06:21 +0000</pubDate>
		<guid isPermaLink="false">#comment-41685</guid>
		<description>[...] Hamang.net as well [...]</description>
		<content:encoded><![CDATA[<p>[...] Hamang.net as well [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Soan</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-40350</link>
		<dc:creator>Soan</dc:creator>
		<pubDate>Wed, 21 Sep 2011 14:11:57 +0000</pubDate>
		<guid isPermaLink="false">#comment-40350</guid>
		<description>I tried the above code (without Grid and with iTextSharp 5+) version with some modifications. Strangely, there is no error but the PDF that is rendered is BLANK.
Does the parser.parse(reader) call automatically adds parsed HTML to PDF?
If yes, then it is not happening in my case.
Any ideas?</description>
		<content:encoded><![CDATA[<p>I tried the above code (without Grid and with iTextSharp 5+) version with some modifications. Strangely, there is no error but the PDF that is rendered is BLANK.<br />
Does the parser.parse(reader) call automatically adds parsed HTML to PDF?<br />
If yes, then it is not happening in my case.<br />
Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: juegos</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-38776</link>
		<dc:creator>juegos</dc:creator>
		<pubDate>Wed, 07 Sep 2011 20:20:49 +0000</pubDate>
		<guid isPermaLink="false">#comment-38776</guid>
		<description>It is somehow relaxing when you read a posting that is not only informative but fun. I will bookmark Html to Pdf in .NET &#124; hamang.net. I have been seeking for information about this subject matter for moths and yours is the best I have located. I trully enjoyed your blog post.</description>
		<content:encoded><![CDATA[<p>It is somehow relaxing when you read a posting that is not only informative but fun. I will bookmark Html to Pdf in .NET | hamang.net. I have been seeking for information about this subject matter for moths and yours is the best I have located. I trully enjoyed your blog post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jura</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-37483</link>
		<dc:creator>jura</dc:creator>
		<pubDate>Thu, 01 Sep 2011 00:03:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-37483</guid>
		<description>I&#039;m using iTextSharp version 5.1.2. There is no FactoryProperties.cs file, no InsertStyle method, and IncTable.cs file. How can I modify iTextSharp&#039;s source to get background color and table border color? I can&#039;t figure out how to achive that functionality in this version.
Thnx!</description>
		<content:encoded><![CDATA[<p>I&#039;m using iTextSharp version 5.1.2. There is no FactoryProperties.cs file, no InsertStyle method, and IncTable.cs file. How can I modify iTextSharp&#039;s source to get background color and table border color? I can&#039;t figure out how to achive that functionality in this version.<br />
Thnx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abdul Wahab O</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-32174</link>
		<dc:creator>Abdul Wahab O</dc:creator>
		<pubDate>Sat, 30 Jul 2011 06:29:33 +0000</pubDate>
		<guid isPermaLink="false">#comment-32174</guid>
		<description>Thank you very Mr: Vimal Lak 
U save my time a lot god bless u</description>
		<content:encoded><![CDATA[<p>Thank you very Mr: Vimal Lak<br />
U save my time a lot god bless u</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bishnu</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-22143</link>
		<dc:creator>bishnu</dc:creator>
		<pubDate>Sat, 14 May 2011 09:53:22 +0000</pubDate>
		<guid isPermaLink="false">#comment-22143</guid>
		<description>HtmlForm form = new HtmlForm();
       
            StringWriter sw = new StringWriter();

            HtmlTextWriter hTextWriter = new HtmlTextWriter(sw);
         
            string html = sw.ToString();
            string htmlDisplayText = @&quot;&lt;html&gt;&lt;body bgcolor=&quot;red&quot;&gt;&lt;h4&gt;Dear bishnu2&lt;/h4&gt;&#160;your address pdp&#160;&#160;&#160; isAn early version of the patterns was workshopped at PLoP After several internal workshops and updates, a later version was
workshopped at PLoP&#160; The patterns are now mature enough that I teach a
class based on the patterns at AG Communication
Systems. 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Copyright &#169; 1999 AG
Communication Systems Corporation
&lt;/body&gt;&lt;/html&gt;&quot;;
            htmlDisplayText = htmlDisplayText.Replace(&quot;{EMPLOYEETABLE}&quot;, html);         
            Document document = new Document();          
            MemoryStream ms = new MemoryStream();
            PdfWriter writer = PdfWriter.GetInstance(document, ms);        
            StringReader se = new StringReader(htmlDisplayText);
            HTMLWorker obj = new HTMLWorker(document);
            document.Open();
            obj.Parse(se);
            // step 5: we close the document
            document.Close();      
            Response.Clear();
            Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment; filename=report.pdf&quot;);
            Response.ContentType = &quot;application/pdf&quot;;                    
            Response.Buffer = true;        
            Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);
            Response.OutputStream.Flush();
            Response.End();</description>
		<content:encoded><![CDATA[<p>HtmlForm form = new HtmlForm();</p>
<p>            StringWriter sw = new StringWriter();</p>
<p>            HtmlTextWriter hTextWriter = new HtmlTextWriter(sw);</p>
<p>            string html = sw.ToString();<br />
            string htmlDisplayText = @&#034;&lt;html&gt;&lt;body bgcolor=&quot;red&quot;&gt;&lt;h4&gt;Dear bishnu2&lt;/h4&gt;&nbsp;your address pdp&nbsp;&nbsp;&nbsp; isAn early version of the patterns was workshopped at PLoP After several internal workshops and updates, a later version was<br />
workshopped at PLoP&nbsp; The patterns are now mature enough that I teach a<br />
class based on the patterns at AG Communication<br />
Systems.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Copyright &copy; 1999 AG<br />
Communication Systems Corporation<br />
&lt;/body&gt;&lt;/html&gt;&#034;;<br />
            htmlDisplayText = htmlDisplayText.Replace(&#034;{EMPLOYEETABLE}&#034;, html);<br />
            Document document = new Document();<br />
            MemoryStream ms = new MemoryStream();<br />
            PdfWriter writer = PdfWriter.GetInstance(document, ms);<br />
            StringReader se = new StringReader(htmlDisplayText);<br />
            HTMLWorker obj = new HTMLWorker(document);<br />
            document.Open();<br />
            obj.Parse(se);<br />
            // step 5: we close the document<br />
            document.Close();<br />
            Response.Clear();<br />
            Response.AddHeader(&#034;content-disposition&#034;, &#034;attachment; filename=report.pdf&#034;);<br />
            Response.ContentType = &#034;application/pdf&#034;;<br />
            Response.Buffer = true;<br />
            Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);<br />
            Response.OutputStream.Flush();<br />
            Response.End();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vimal Lak</title>
		<link>http://hamang.net/2008/08/14/html-to-pdf-in-net/comment-page-1/#comment-20937</link>
		<dc:creator>Vimal Lak</dc:creator>
		<pubDate>Sat, 16 Apr 2011 08:18:36 +0000</pubDate>
		<guid isPermaLink="false">#comment-20937</guid>
		<description>Convsert to datagrid to pdf
=====================================================================================\
Using 3.0.3.0 version of iTextSharp.dll
=====================================================================================

        Document document = new Document(PageSize.A4, 0, 0, 50, 50);
        System.IO.MemoryStream msReport = new System.IO.MemoryStream();

        try
        {
            
            PdfWriter writer = PdfWriter.GetInstance(document, msReport);

           
            document.AddAuthor(&quot;Vimal Lak&quot;);
            document.AddSubject(&quot;Export to PDF&quot;);

            document.Open();

            iTextSharp.text.Table datatable = new iTextSharp.text.Table(gridlastthree.Columns.Count);
            datatable.Padding = 2;
            datatable.Spacing = 0;

            

           
            float[] headerwidths = new float[gridlastthree.Columns.Count];
            for (int i = 0; i &lt; gridlastthree.Columns.Count; i++)
             {
                 headerwidths[i] = 20;
             }
            datatable.Widths = headerwidths;
            
       
            Cell cell = new Cell(new Phrase(&quot;Previous SRS History Of Vehicle No :&quot;+ Label2.Text, FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD)));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            cell.Leading = 30;
            cell.Colspan = 5;
            cell.Border = Rectangle.NO_BORDER;
            // cell.BackgroundColor = new iTextSharp.text.Color(System.Drawing.Color.Gray);
            cell.BackgroundColor = new iTextSharp.text.Color(System.Drawing.Color.SteelBlue);
            datatable.AddCell(cell);

          
            datatable.DefaultCellBorderWidth = 1;
            datatable.DefaultHorizontalAlignment = 1;
            datatable.DefaultRowspan = 2;
            datatable.AddCell(&quot;Sr.No&quot;);
        
            datatable.AddCell(&quot;SRS NO&quot;);
            datatable.AddCell(&quot;K.M. Reading&quot;);
            datatable.AddCell(&quot;SRS DATE&quot;);
            datatable.AddCell(&quot;Amount&quot;);
            int count = 0;
            for (int i = 0; i &lt; gridlastthree.Items.Count; i++)
            {
                  datatable.DefaultHorizontalAlignment = Element.ALIGN_LEFT;
                  count = i + 1;
                  datatable.AddCell(count.ToString());
                  
                  datatable.AddCell(gridlastthree.Items[i].Cells[1].Text);
                  datatable.AddCell(gridlastthree.Items[i].Cells[2].Text);
                  datatable.AddCell(gridlastthree.Items[i].Cells[3].Text);
                  datatable.AddCell(gridlastthree.Items[i].Cells[4].Text);
            }            
            document.Add(datatable);
        }
        catch(Exception ex)
        {
           Response.Write(e);
        }
        document.Close();
        Response.Clear();
        Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment;filename=Report.pdf&quot;);
        Response.ContentType = &quot;application/pdf&quot;;
        Response.BinaryWrite(msReport.ToArray());
        Response.End();
=====================================================================================
Using 4.1.2.0 Version of ITextSharp.dll
=====================================================================================       
 	Response.ContentType = &quot;application/pdf&quot;;
        Response.AddHeader(&quot;content-disposition&quot;,&quot;attachment;filename=GridViewExport.pdf&quot;);
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);
        gridlastthree.AllowPaging = false;
     
        gridlastthree.RenderControl(hw);
        StringReader sr = new StringReader(sw.ToString());
        Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
        HTMLWorker parser = new HTMLWorker(pdfDoc);
        PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
        pdfDoc.Open();
        parser.Parse(sr);  
        pdfDoc.Close();
        
        Response.End();</description>
		<content:encoded><![CDATA[<p>Convsert to datagrid to pdf<br />
=====================================================================================\<br />
Using 3.0.3.0 version of iTextSharp.dll<br />
=====================================================================================</p>
<p>        Document document = new Document(PageSize.A4, 0, 0, 50, 50);<br />
        System.IO.MemoryStream msReport = new System.IO.MemoryStream();</p>
<p>        try<br />
        {</p>
<p>            PdfWriter writer = PdfWriter.GetInstance(document, msReport);</p>
<p>            document.AddAuthor(&#034;Vimal Lak&#034;);<br />
            document.AddSubject(&#034;Export to PDF&#034;);</p>
<p>            document.Open();</p>
<p>            iTextSharp.text.Table datatable = new iTextSharp.text.Table(gridlastthree.Columns.Count);<br />
            datatable.Padding = 2;<br />
            datatable.Spacing = 0;</p>
<p>            float[] headerwidths = new float[gridlastthree.Columns.Count];<br />
            for (int i = 0; i &lt; gridlastthree.Columns.Count; i++)<br />
             {<br />
                 headerwidths[i] = 20;<br />
             }<br />
            datatable.Widths = headerwidths;</p>
<p>            Cell cell = new Cell(new Phrase(&quot;Previous SRS History Of Vehicle No :&quot;+ Label2.Text, FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD)));<br />
            cell.HorizontalAlignment = Element.ALIGN_CENTER;<br />
            cell.Leading = 30;<br />
            cell.Colspan = 5;<br />
            cell.Border = Rectangle.NO_BORDER;<br />
            // cell.BackgroundColor = new iTextSharp.text.Color(System.Drawing.Color.Gray);<br />
            cell.BackgroundColor = new iTextSharp.text.Color(System.Drawing.Color.SteelBlue);<br />
            datatable.AddCell(cell);</p>
<p>            datatable.DefaultCellBorderWidth = 1;<br />
            datatable.DefaultHorizontalAlignment = 1;<br />
            datatable.DefaultRowspan = 2;<br />
            datatable.AddCell(&quot;Sr.No&quot;);</p>
<p>            datatable.AddCell(&quot;SRS NO&quot;);<br />
            datatable.AddCell(&quot;K.M. Reading&quot;);<br />
            datatable.AddCell(&quot;SRS DATE&quot;);<br />
            datatable.AddCell(&quot;Amount&quot;);<br />
            int count = 0;<br />
            for (int i = 0; i &lt; gridlastthree.Items.Count; i++)<br />
            {<br />
                  datatable.DefaultHorizontalAlignment = Element.ALIGN_LEFT;<br />
                  count = i + 1;<br />
                  datatable.AddCell(count.ToString());</p>
<p>                  datatable.AddCell(gridlastthree.Items[i].Cells[1].Text);<br />
                  datatable.AddCell(gridlastthree.Items[i].Cells[2].Text);<br />
                  datatable.AddCell(gridlastthree.Items[i].Cells[3].Text);<br />
                  datatable.AddCell(gridlastthree.Items[i].Cells[4].Text);<br />
            }<br />
            document.Add(datatable);<br />
        }<br />
        catch(Exception ex)<br />
        {<br />
           Response.Write(e);<br />
        }<br />
        document.Close();<br />
        Response.Clear();<br />
        Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment;filename=Report.pdf&quot;);<br />
        Response.ContentType = &quot;application/pdf&quot;;<br />
        Response.BinaryWrite(msReport.ToArray());<br />
        Response.End();<br />
=====================================================================================<br />
Using 4.1.2.0 Version of ITextSharp.dll<br />
=====================================================================================<br />
 	Response.ContentType = &quot;application/pdf&quot;;<br />
        Response.AddHeader(&quot;content-disposition&quot;,&quot;attachment;filename=GridViewExport.pdf&quot;);<br />
        Response.Cache.SetCacheability(HttpCacheability.NoCache);<br />
        StringWriter sw = new StringWriter();<br />
        HtmlTextWriter hw = new HtmlTextWriter(sw);<br />
        gridlastthree.AllowPaging = false;</p>
<p>        gridlastthree.RenderControl(hw);<br />
        StringReader sr = new StringReader(sw.ToString());<br />
        Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);<br />
        HTMLWorker parser = new HTMLWorker(pdfDoc);<br />
        PdfWriter.GetInstance(pdfDoc, Response.OutputStream);<br />
        pdfDoc.Open();<br />
        parser.Parse(sr);<br />
        pdfDoc.Close();</p>
<p>        Response.End();</p>
]]></content:encoded>
	</item>
</channel>
</rss>

