This is a migrated thread and some comments may be shown as answers.

Export to PDF

2 Answers 255 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bader
Top achievements
Rank 1
Bader asked on 14 Feb 2012, 05:33 PM
Hi,

I'm using the following code in order export a report to PDF file. The problem is that even a small report with one page only is exported to a PDF file with a size of ~15 MB. How could that be? and how to handle this issue?
/Exports a report to a PDF document
public static void ExportToPDF(Telerik.Reporting.Report reportToExport)
{
ReportProcessor reportProcessor = new ReportProcessor();
RenderingResult result = reportProcessor.RenderReport("PDF", reportToExport, null);
string fileName = result.DocumentName + ".pdf";
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = result.MimeType;
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Private);
HttpContext.Current.Response.Expires = -1;
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("{0};FileName=\"{1}\"", "attachment", fileName));
HttpContext.Current.Response.BinaryWrite(result.DocumentBytes);
HttpContext.Current.Response.End();
}


Please, I need your help,

Regards,
Bader

2 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 14 Feb 2012, 06:21 PM
Hello Bader,

Check The size of the exported PDF file is big KB article for more info on your inquiry.

Kind regards,
Steve
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Bader
Top achievements
Rank 1
answered on 15 Feb 2012, 07:53 AM
Hi,

Thank you very much, That solves the problem.

Regards,
Bader
Tags
General Discussions
Asked by
Bader
Top achievements
Rank 1
Answers by
Steve
Telerik team
Bader
Top achievements
Rank 1
Share this question
or