Click here to Skip to main content
12,397,027 members (68,177 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hey All ..

when i try to export Datalist or gridview to exported without images !!!

this is my code :

Response.ContentType = "application/pdf";
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);
        StringReader sr = new StringReader(sw.ToString());
        Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
        HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
        PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
Posted 8-Jul-11 2:54am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You may need to make sure that your images are referenced by absolute and not relative paths in your html. This is due to the fact that most pdf writers create a temporary copy of your html input in a temp directory before parsing which then causes the relative paths to fail.
shms_rony 8-Jul-11 9:05am
datalist images get from path in database
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I want to export datalist with image to pdf with c#
ThePhantomUpvoter 19-Apr-13 7:25am
This is not an answer to this 2 year old question. This would not even qualify as a question if you asked it yourself. You need to post this as your own question and include the code that you have tried and describe the problem that you are having with the code.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 19 Apr 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100