Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have this in my sql tabel


<img alt="" width="184" height="230" src="/WebACOSApp/Image/Jellyfish.jpg" /><br />
this is my string



Now on my aspx page i have


<form id="form1"  runat="server">
 
    <div id="ImageDisplay"  runat="server">
 
    </div>

    <asp:Button ID="Button2" runat="server" Text="Download PDF with custom text" OnClick="GeneratePDFWithText" />

    </form>



Now my .cs code


Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            ImageDisplay.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);
            pdfDoc.Open();
            htmlparser.Parse(sr);
            pdfDoc.Close();
            Response.Write(pdfDoc);
            Response.End();




htmlparser.Parse(sr);--->gives error

Could not find a part of the path 'C:\WebACOSApp\Image\Jellyfish.jpg'.


Since my data comes from  database i cant change it..this data is inserted from radeditor
Posted

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