Solved

Exporting Crystal reports to PDF using C# remoting application

Posted on 2006-11-28
2
3,391 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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