New Message on dotNET User Group Hyd

how to incorporate print Option with Crystal Reports (ASP.NET).

Reply
  Reply to Sender   Recommend Message 2 in Discussion
From: Mahendrakumar8

1) Printing a Crystal Reports 9.0 from ASP.Net - Can't be done is the short answer. However, you can print from server side or export report to pdf on client and client can print etc.
But The new Crystal Reports 10 extends the version 9 capabilities as well as the feature set of the bundled editions you may already be using, with:

  • Report designer enhancements
  • Report object repository updates
  • More options to view, print and export
  • .NET, Java� and COM report engines
  • Simplified .Net merge modules
  • Improved processing performance And much more...

There is another option to print the crystal reports

The clients browser using a created PDF file via Crystal Reports. Herewith the C# sharp code required:-

// DEFINE CRYSTAL REPORTS VARIABLES
ReportDocument crReportDocument = new ReportDocument();
ExportOptions crExportOptions = new ExportOptions();
DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();
string sFileName = "c:\\temp\\sample.pdf";

// SET CRYSTAL REPORT VARIABLES
crDiskFileDestinationOptions.DiskFileName = sFileName;
crReportDocument.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crReportDocument.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crReportDocument.ExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crReportDocument.Export()

// WRITE SAMPLE.PDF FILE TO CLIENTS BROWSER
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(sFileName);
Response.Flush();
Response.Close();

//DELETE THE EXPORTED FILE FROM DISK
System.IO.File.Delete(sFileName);

What you have to remember is that Error Checking must be written into your code to make sure that your PDF viewer is installed on the client machine otherwise the crash could be quite horrible for the user!!!

Hope this will help those who are ready to pull their hair out on this!

Thanks & Regards,

A. Mahendra kumar





View other groups in this category.

Click here!
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to