Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Invalid nested tag strong found, expected closing tag img
Posted
Updated 14-Apr-15 1:17am
v2

because of the expected closing tag img , When I completing the missing tag ,It's work ok....(wrong)====>(Ok)
 
Share this answer
 
Here is a sample iTextSharp pdf create program.
You must download iTextSharp from SourceForge or other site.
C#
using iTextSharp.text;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;
using System.Web.UI.HtmlControls;
...
protected void Button1_Click(Object sender,System.EventArgs e)
        {
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=this.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            HtmlForm frm = new HtmlForm();
            GridView1.AllowPaging = false;
            GridView1.Parent.Controls.Add(frm);
            frm.Controls.Add(GridView1);
            frm.RenderControl(hw);
            StringReader sr = new StringReader(sw.ToString());
            Document PDFdoc = new Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F);
            iTextSharp.text.html.simpleparser.HTMLWorker htmlparser =   new iTextSharp.text.html.simpleparser.HTMLWorker(PDFdoc);
            PdfWriter.GetInstance(PDFdoc, Response.OutputStream);
            PDFdoc.Open();
            htmlparser.Parse(sr);
            PDFdoc.Close();
            Response.Write(PDFdoc);
            Response.End();
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900