Crystal report export to PDF size issue

We have the following code to export a report from Crystal report 10 into PDF format. Once exported, this will get displayed in the browser, from where the user can take print out or save to system.

 ostream = rd.ExportToStream(ExportFormatType.PortableDocFormat)
                    If Response IsNot Nothing Then
                        Response.Clear()
                        Response.Buffer = True
                        Response.ContentType = “application/pdf”
                        Response.BinaryWrite(ostream.ToArray())
                        Response.Flush()
                    End If

Above code generated huge PDFR files and caused performance issues. Sample files generated by the above code ranges from 200KB to 300KB. We have replaced the export code with ExportToHttpResponse method of crystal report and observed the reduction in file size from 200KB to 60KB. 

rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, “”);

Advertisements

About ambilykk

I am a Technology Evangelist on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP .Net and Ajax. My interests also include Azure and Visual Studio. Technology adoption and learning is my key strength and technology sharing is my passion.
This entry was posted in ASP.Net, C# and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s