Solved

Exporting Crystal reports to PDF using C# remoting application

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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 …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

729 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