August 14, 2008 at 1:21 pm
What iis wrong with the following code?
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("Content-disposition", "attachment; filename=TestDeviceFilter.pdf");
Response.ContentType = "application/pdf";
Response.Buffer = true;
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
//this.RenderControl(htmlTextWriter); this is for whole page.
RV_Reports.RenderControl(htmlTextWriter);
Response.Write(stringWriter.ToString());
Response.End();
I get the following when I try to open the PDF:
Adobe Reader could not open 'myfile.pdf' because it is either not a supported file type or because the file has been damaged
August 14, 2008 at 1:54 pm
Microsoft does not sell PDF dll so you need third party PDF dll in your application to render PDF through the response object. Check below for two but I have not used both.
http://sourceforge.net/projects/pdfsharp/?abmode=1
http://itextsharp.sourceforge.net/
Kind regards,
Gift Peddie
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply