Solved

Exporting Crystal reports to PDF using C# remoting application

Posted on 2006-11-28
2
3,386 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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