Hai, When I am trying to convert a HTML to Word, if my HTML contains only one image, it is displaying. But not, when my HTML contains more than one images. All the images are displayed as cross marks. Please help me to over come this issue.
string strImgCandidate = ""; string strImgWork1 = ""; string strImgWork2 = ""; string strImgWork3 = ""; strImgCandidate = Convert.ToString(imgCandidate.Src); strImgWork1 = Convert.ToString(imgWork1.Src); strImgWork2 = Convert.ToString(imgWork2.Src); strImgWork3 = Convert.ToString(imgWork3.Src); string strImageHeight = Convert.ToString(ConfigurationSettings.AppSettings["PreviewPDFImageHeight"]); string strImageWidth = Convert.ToString(ConfigurationSettings.AppSettings["PreviewPDFImageWidth"]); string candImg = "<img alt=\"candidate\" src=" + strImgCandidate + " width=\"" + strImageWidth + "\" height=\"" + strImageHeight + "\" />"; string wrkImg1 = "<img alt=\"test1\" id=\"imgtest1\" src=" + strImgWork1 + " width=\"" + strImageWidth + "\" height=\"" + strImageHeight + "\" />"; string wrkImg2 = "<img alt=\"test2\" id=\"imgtest2\" src=" + strImgWork2 + " width=\"" + strImageWidth + "\" height=\"" + strImageHeight + "\" />"; string wrkImg3 = "<img alt=\"test3\" id=\"imgtest3\" src=" + strImgWork3 + " width=\"" + strImageWidth + "\" height=\"" + strImageHeight + "\" />"; string candImg = "<img alt=\"candidate\" src=" + strImgCandidate + " style=\"height:250px; width:200px;\" />"; string wrkImg1 = "<img alt=\"test1\" id=\"imgtest1\" src=" + strImgWork1 + " style=\"height:350px; width:300px;\" />"; string wrkImg2 = "<img alt=\"test2\" id=\"imgtest2\" src=" + strImgWork2 + " style=\"height:350px; width:300px;\" />"; string wrkImg3 = "<img alt=\"test3\" id=\"imgtest3\" src=" + strImgWork3 + " style=\"height:350px; width:300px;\" />"; if (strImgCandidate != "") lblimgCandidate.Text = candImg; if (strImgWork1 != "") lblimgWork1.Text = wrkImg1; if (strImgWork2 != "") lblimgWork2.Text = wrkImg2; if (strImgWork3 != "") lblimgWork3.Text = wrkImg3; SaveToPdf(); string attachment = "attachment; filename=MyProfile.pdf"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/pdf"; StringWriter stw = new StringWriter(); HtmlTextWriter htextw = new HtmlTextWriter(stw); lblimgCandidate.Visible = true; lblimgWork1.Visible = true; lblimgWork2.Visible = true; lblimgWork3.Visible = true; lblimgCandidate.Visible = false; lblimgWork1.Visible = false; lblimgWork2.Visible = false; lblimgWork3.Visible = false; tblPreview.RenderControl(htextw); tblProfileDetails.RenderControl(htextw); Document document = new Document(); PdfWriter.GetInstance(document, Response.OutputStream); document.Open(); string tempPostContent = getImage(stw.ToString()); StringReader str = new StringReader(stw.ToString()); HTMLWorker htmlworker = new HTMLWorker(document); htmlworker.Parse(str); document.Close(); Response.Write(document); Response.End(); lblimgCandidate.Visible = false; lblimgWork1.Visible = false; lblimgWork2.Visible = false; lblimgWork3.Visible = false;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)