Saturday, 17 August 2013

How to create pdf file in ASP.NET

If you want to insert image in pdf file using iTextSharp :

var image = iTextSharp.text.Image.GetInstance(Server.MapPath('your image path'));

// where u want your image  (x,y pixels)
image.SetAbsolutePosition(300,300);

document.Add(image)


*************here is code*******

 String imgname = (grid1.Rows[i].Cells[1].FindControl("imagelarge") as System.Web.UI.WebControls.Image).ImageUrl.ToString();
                        //var logo = iTextSharp.text.Image.GetInstance(Server.MapPath(imgname));
                        //Response.Write("img="+imgname);
                        totRequest += "<tr><td><img src="+Server.MapPath(imgname)+" height='100' width='100'></td>";
                        String pname = (grid1.Rows[i].Cells[2].FindControl("name") as Label).Text;
                        totRequest = totRequest + "<td>" + pname;
                        String color = (grid1.Rows[i].Cells[3].FindControl("col") as Label).Text;

0 comments:

Post a Comment