Solved

Exporting Crystal reports to PDF using C# remoting application

Posted on 2006-11-28
2
3,375 Views
Last Modified: 2012-06-27
Hi All,
We have a C# .net remoting application that is using the CR 10 to print reports.  We are using Visual Studio 2005 for our development environment.  We are interested in Using the CR component to export the Crystal report to a PDF File and write the PDF file to the SQL Database for storage. Here are a couple of requirements:

1.  I want the PDF to print after it has been sent to the SQL database (without having to make a call to the SQL database to print the report (It should use the locally created PDF File that was unloaded to the SQL Server.

2.  I do not want the Crystal viewer to be displayed.  Each report (which are actually invoices) should have a pdf created, uploaded to the SQL Server, and printed.

How can this be done without 3rd party components?

Any help would be greatly appreciated.

Scott
0
Comment
Question by:smpross
2 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 18028729
Hi Scott,



Normally to show a report in PDF format without displaying in the viewer, I create a memory stream and then use the ExportToStream function of the ReportDocument object.  The vb.net code to do it is like this, hopefully you can translate to c# w/out much difficulty:

  Mstream = CType(MyReport.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), MemoryStream)

This gives you a report in PDF format in Mstream (a memory stream object).  You can then send it to the web browser directly w/out showing the viewer with this code:

        Response.Clear()
        Response.Buffer = True
        Response.ContentType = "application/pdf"
        Response.BinaryWrite(Mstream.ToArray())
        Response.End()
        Response.Flush()

I don't know how to store this in your database, but I'm assuming you can simply write the memory stream to a binary field.

HTH

frodoman
0
 

Author Comment

by:smpross
ID: 18028799
Thanks Frodoman!
That is exactly what I needed.

Scott
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now