Data Set to pdf using asp.net?
<p>In web application, i am trying to generate one pdf file, the data is dataset, the data in dataset  in a html format, that is</p>

<pre><code>  &lt;html&gt; 
   &lt;header&gt; &lt;/header&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;.
</code></pre>

<p>I get the code for converting datatable to pdf, it is generating pdf but getting error while opening when i debug my code, i found that data in dataset in a html format. can you help me, thank you.</p>

<pre><code>  Document document = new Document();

    PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("c://newchk.pdf", FileMode.Create));
    document.Open();
    //iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("c://ggi logo.bmp");
    //document.Add(img);
    iTextSharp.text.Font font5 = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA, 5);
    //float[] columnDefinitionSize = { 22F, 22F, 12F, 7.75F, 7.77F, 7.77F, 7.77F, 7.77F, 10.88F, 10.88F, 10.88F, 4.75F, 7.77F, 7.77F, 7.77F, 7.77F, 7.77F, 7.77F, 9F };

    PdfPTable table = new PdfPTable(dt.Columns.Count);
    PdfPRow row = null;
    float[] widths = new float[] { 4f, 4f, 4f, 4f };

    table.SetWidths(widths);

    table.WidthPercentage = 100;
    int iCol = 0;
    string colname = "";
    PdfPCell cell = new PdfPCell(new Phrase("Products"));


    ////table.AddCell(cell);
    cell.Colspan = dt.Columns.Count;

        //cell.Border = 0;

        //cell.HorizontalAlignment = 1;
    foreach (DataColumn c in dt.Columns)
    {

        table.AddCell(new Phrase(c.ColumnName, font5));
    }

    //cell.BackgroundColor = new iTextSharp.text.Color(0xC0, 0xC0, 0xC0);


    foreach (DataRow r in dt.Rows)
    {
        if (dt.Rows.Count &gt; 0)
        {
            table.AddCell(new Phrase(r[0].ToString(), font5));
            table.AddCell(new Phrase(r[1].ToString(), font5));
            table.AddCell(new Phrase(r[2].ToString(), font5));
            table.AddCell(new Phrase(r[3].ToString(), font5));
        }          
    }  document.Add(table);
        document.Close();
</code></pre>

<p>The above is my code for converting pdf. [datatable to pdf].</p>
