473,497 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing report on .Net Webpage

I am trying to give my clients the option to preview a Crystal report using
the Crystal ReportViewer control on a web page, or sending the report
directly to their default printer, so far without success. The code I am
using follows:

Public oReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
'PrintDirect is boolean parameter read from page header

Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Dim dsDataTable As New DataSet
' Code to fill the dataset
oReport.Load("myReport.rpt")
oReport.SetDataSource(dsDataTable)
If PrintDirect=True then
PrintReport(oReport)
else
CRViewer1.ReportSource = oReport
CRViewer1.DataBind()
end if
End Sub

Sub PrintReport(ByVal oReport as
CrystalDecisions.CrystalReports.Engine.ReportDocum ent)
Dim margins As PageMargins
With margins
.bottomMargin = 350
.leftMargin = 350
.rightMargin = 350
.topMargin = 350
End With
'Apply the page margins.
With oReport.PrintOptions
.PrinterName = "" 'default printer
.ApplyPageMargins(margins)
End With
'Print the report. Set the startPageN and endPageN
'parameters to 0 to print all pages.
oReport.PrintToPrinter(1, False, 0, 0)
End Sub

The report correctly displays on the Crystal ReportsViewer, but will not
output to the printer, even if I include a specific printer name. Any help
would be appreciated.
Nov 21 '05 #1
0 909

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

Similar topics

0
1289
by: John | last post by:
Hi all, I would like to use the Report building and printing capabilities of the MSAccess DB. I have a ASP.NET page which does calculations based on data in a MSSQL Server and once done will...
8
1766
by: Alan Lue | last post by:
Hi, I'm trying to set up a webpage so that I can view multiple HTML files from the same page. For example, you might go to http://example.com/lab_tests.html and be able to view lab1.html,...
0
726
by: Tom Hoogeboom | last post by:
I am trying to give my clients the option to preview a Crystal report using the Crystal ReportViewer control on a web page, or sending the report directly to their default printer, so far without...
6
4059
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if...
3
1870
by: Jay | last post by:
Hi, I have this problem with DataGrid printing. I have a page which contains only DataGrid. When i try to print the page, only 1st page contains the verticle and horizontal lines of the...
0
5728
by: John Smith | last post by:
Hello, I have 7 different crystal reports that need to be collated. Since I want to end up with a page of each (which all together make a single report), I created a blank main report and then...
0
1409
by: Deceneu | last post by:
Hi everyone, this is my first post so please bear with me. I have the following situation: i have a local report that needs to have two "versions": one for viewing in the report viewer (with all...
1
13602
by: Glenn | last post by:
I am writing a program for field work that will use a receipt printer. I need to be able to adjust the page settings prior to printing depending on how much needs to be printed. I have been able...
0
2815
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a deposit's report. I created a class to store the...
0
6993
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...
0
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7197
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...
1
6881
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...
0
5456
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,...
0
3088
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...
0
1411
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 ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.