Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exporting Crystal reports to PDF using C# remoting application

Posted on 2006-11-28
2
Medium Priority
?
3,399 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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