Exporting CrystalReport into PDF from web application

D

David Dvali

Hello.

I have some strange problem and will be very thankful if anybody will help
me to solve it.
In my ASP.NET web form I have used CrystalReport to produce some report, now
I want to export this report into PDF without saving any temporary file on
server disk.
I'm using such code:
P.S. At moment when this code is running I already have "crReportDocument"
created and assigned all required parameters to it.

========================================================
MemoryStream memoryStream;
memoryStream = (MemoryStream)crReportDocument.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
========================================================

And now there is a problem:
When I export it the web browser is trying to open it in Acrobat Reader, but
Acrobat Reader shows error message "An unrecognized token"0,5" was found"
and the pages are blank (by the way the pages count is correct).
Also the strange fact is, that when I'm exporting to Excel with the same
method it works fine.
What I'm doing wrong and how can I solve this problem?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top