473,666 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Really tough Crystal Question

(I know this is not the Crystal Forum but I get far better answers here :)

I have a working ASPX page that uses a CrystalReportVi ewer to print any web
datagrid Passed to it. On the page I have a button
that will convert the report to a PDF. The code pasted below works just
fine.

My goal, however, it to bypass the Crystal report altogether and just
directly print the PDF. Apparently, however, the line that says:
CrystalReportVi ewer1.ReportSou rce = myReport is the one that both creates
and prints the crystal report and it is therefore necessary for the function
PrintToPDFWithS tream to work correctly.

Of course the report has to be created for my PDF function to work but is
there anyway to suppress the printing and trigger execution of
PrintToPDFWithS tream after the report is created?

Hope someone can help.
Thanks,
Gary

Private Sub Page_Load(ByVal .......
..
Dim myReport As New
CrystalDecision s.CrystalReport s.Engine.Report Document
myReport = Session("Report ToPrint")
Dim myDataSet As New DataSet
myDataSet.ReadX ml(Session("Rep ortFileString") )
myReport.SetDat aSource(myDataS et)
PrepareReport(m yReport.ReportD efinition.Secti ons) 'my function
CrystalReportVi ewer1.ReportSou rce = myReport
End Sub

Private Sub Button1_Click(B yVal sender .......
Dim reportToPrint As New
CrystalDecision s.CrystalReport s.Engine.Report Document
reportToPrint = Session("Report ToPrint")
PrintToPDFWithS tream(reportToP rint)
End Sub

Private Function PrintToPDFWithS tream(ByVal MyReport As
CrystalDecision s.CrystalReport s.Engine.Report Document)
Dim MyExportOptions As New CrystalDecision s.Shared.Export Options
MyExportOptions .ExportFormatTy pe =
CrystalDecision s.[Shared].ExportFormatTy pe.PortableDocF ormat
Dim MyExportRequest Context As New
CrystalDecision s.Shared.Export RequestContext
MyExportRequest Context.ExportI nfo = MyExportOptions
Dim MyStream As System.IO.Strea m
MyStream =
MyReport.Format Engine.ExportTo Stream(MyExport RequestContext)
Response.ClearH eaders()
Response.ClearC ontent()
Response.Conten tType = "applicatio n/pdf"
Dim myBuffer(MyStre am.Length) As Byte
MyStream.Read(m yBuffer, 0, CType(MyStream. Length, Integer))
Response.Binary Write(myBuffer)
Response.End()
End Function
Nov 18 '05 #1
1 1071
Hi Gary,

It seems that you use the following code
Private Sub Page_Load(ByVal .......
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
19160
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal Report at runtime? Example: private void button1_Click(object sender,
2
6565
by: Ashish Shridharan | last post by:
Hi All, I'm not very sure if this is the forum for my question but i was hoping someone could direct me to the right place (or answer my question). I am using the .NET crystal report viewer to display reports (crystal reports) in HTML in my web application. My client's requirements are that the reports need to be viewable on Netscape, Mozilla and IE. However, in Netscape
4
14269
by: Rick Thiel | last post by:
Hello, I am trying to build a Crystal report VisualStudio.NET for an ASP.NET application. I would like to build a report that doesn't connect to any particular database at design time because I am planning to pass a dataset to the report at runtime. From what I have read, it sounds like unbound fields might be the answer. However, I am having trouble figuring out how to bind these unbound fields to my dataset at runtime.
6
4109
by: Dr. Indera | last post by:
hello, much to my surprise, the version of crystal that comes with visual studio.net 2003 does not have a report preview window. i found out that i have to build a form in visual basic.net and use the crystal view object to be able to view forms. the form works fine for me, so i created a .exe of the form and emailed it to a friend because i thought they would be able to use the form/.exe without having visual studio.net installed. that...
2
3349
by: Phil | last post by:
There's a Crystal Reports hot fix for a particular but that I am experiencing in .NET -- DIV's get screwed up when you embed a Crystal Report in a web page. The bug is ADAPT00170558, the patch is 35395142. There's absolutely no documentation on a work-around, and the patch from CR is for version 9 only, not for .NET. Anyone know how to fix this aweful problem? Phil
5
5735
by: Rank Novice | last post by:
I'm a developer, not a DB admin. I'm writing a .NET app that uses crystal reports. The table I need to output is built inside a stored procedure. No choice, it makes use of some temporary tables. (Believe me I've tried to get around that.) Crystal reports seems to only know about tables and views. It looks like a view cannot call procedures. It can call functions, but in turn they also can't call procedures. I am hosed, what now?
10
17528
by: Joriz | last post by:
Obviously im new with ms access..so my basic question is how do i run crystal reports in my ADP. I also pass parameters to cyrstal reports. Please help! thanks in advance
38
3317
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more or is it a benefit that C knows nearly nothing (what I can think about is that C is the largest common divisor defined on most available platforms)?
1
2188
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am brand new to using Crystal Reports and am trying to generate a report based on a custom object - in another project. I have a layered design, with all my business objects in a seperate project. I created a new project as part of the solution, added a reference to the project containing my business objects, created a datasource that points to one of the objects and then tried to create CR based on the object. The data tab (in the CR...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.