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

Exporting Reports Straight to PDF in ASP.Net

3 Answers 257 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jim Richmond
Top achievements
Rank 1
Jim Richmond asked on 02 May 2007, 07:27 AM
Here is some code I borrowed (from other reporting packages) to export a report to pdf. I have an empty aspx page that runs this code on load (after reading some url parameters).

MyReport report = new MyReport(); 
string mimeType = string.Empty; 
string extension = string.Empty; 
Encoding encoding = null
byte[] buffer = Telerik.Reporting.Processing.ReportProcessor.Render("PDF", report, nullout mimeType, out extension, out encoding); 
Response.Clear(); 
Response.Buffer = true
Response.ContentType = "application/pdf"
Response.BinaryWrite(buffer); 
Response.End(); 

You have to be sure to reference Telerik.Reporting.ImageRendering

I was having some issues with the layout of a simple nested sub report. The spacing is fine in Design View but way off in html view. So this is my fix for now.

3 Answers, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 02 May 2007, 09:10 AM
Hi Jim,

I read your post as you've got a problem with incorrect rendering of your report (that contains a sub report) in HTML. Same report is rendering correctly in PDF. Because of the HTML issue you've been forced to send this report to the browser as a PDF document instead of displaying it in the viewer.

If I've understood you correctly, can you, please, describe us your problems with rendering the report in HTML so we can examine it and fix it on time. We will appreciate if you can send us a sample report/project that demonstrates the issue.

Regards,
Svetoslav
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jim Richmond
Top achievements
Rank 1
answered on 03 May 2007, 05:40 AM
There is about an inch of space that appears before the subreport in html view. It adds up when you have the sub report in a repeating section.  Sorry I don't have time to look into further as the solution above is working for me.
0
Svetoslav
Telerik team
answered on 03 May 2007, 07:58 AM
Hello Jim Richmond,

It's good that you've managed to cope with the problem by yourself. Anyway we will try to reproduce the scenario and fix the problem.

Sincerely yours,
Svetoslav
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Jim Richmond
Top achievements
Rank 1
Answers by
Svetoslav
Telerik team
Jim Richmond
Top achievements
Rank 1
Share this question
or