i am working on file conversion of webpage to pdf using itextsharp tool...i have binded the company details in a repeater control from sqlserver 2005..and the images are loaded from the directory path....patricular company correponding images is loaded from the directory...the problem i am facing is , i couldnt get the image when i am converting the webpage to pdf....i enclose the coding ....please help me
/* BINDING deatils to repeater*/
protected void Page_Load(object sender, EventArgs e)
{
string _strName = string.Empty;
_strName = "q";
DataTable Print_Rep = new DataTable();
clsCompanySearch objRep_Cls = new clsCompanySearch();
Print_Rep = objRep_Cls.company_pdf(_strName);
Rpt_Company.DataSource = Print_Rep;
Rpt_Company.DataBind();
}
/* BINDING THE IMAGES FROM THE DIRECTORY */
protected void Rpt_Company_Search_no_tabs_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)e.Item.FindControl("img_logo");
Label lbl_memberno = (Label)e.Item.FindControl("lblmemberno");
string memberno = lbl_memberno.Text.ToString().Trim();
string image = HttpContext.Current.Server.MapPath("~/_Images/Arab_Logos/") + memberno.ToString() + ".jpg";
if (File.Exists(image))
{
img.ImageUrl = "~/_Images/Arab_Logos/" + memberno.ToString() + ".jpg";
img.Visible = true;
}
else
{
img.Visible = false;
}
}
/*CONVERSION OF PDF */
protected void btnPDF_Click(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=yamunaPage.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
string path = HttpContext.Current.Server.MapPath("~/_Images/Arab_Logos/");
pdfDoc.Open();
var appDataPath=Server.MapPath("~/_Images/Arab_Logos/");
htmlparser.Parse(sr);[GETTING ERROR IN THIS LINE]
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}
so while converting to pdf ...i am getting the error as
Could not find a part of the path 'C:\_Images\Arab_Logos\1002.jpg'.
PLEASE help me as soon as possible...please