473,686 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print Crystal Report in asp.net

Hii..

i am printing crystal reports in asp.net for that purpose i am using
PrintTo Printer method but for that it is needed me to pass printer
name which is installed on my local computer but when i upload it on
server then it gives me an error no default printer . for printing
purpose their is another method in java script window.print() but it
print whole window which includes report toolbar and other buttons but
i want to print only report document.can any one tell me what i can do?
here is the code i am using.
objVillageCryRe port.PrintOptio ns.PaperSource= CrystalDecision s.Shared.PaperS ource.Auto;
switch(paperSiz e_DropDownList. SelectedValue)
{
case "PaperA4" :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA4;
break;
case "PaperA4Sma ll":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA4Small;
break;
case "PaperA3" :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA3;
break;
case "PaperB4":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperB4;
break;
case "PaperB5":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperB5;
break;
case "Paper10x14 ":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.Paper10x14;
break;
case "Paper11x17 ":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.Paper11x17;
break;
default :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.DefaultPaperS ize;
break;

}
if(portrait_Rad ioButton.Checke d==true)
{
objVillageCryRe port.PrintOptio ns.PaperOrienta tion=
CrystalDecision s.Shared.PaperO rientation.Land scape;

}
if(Landscape_Ra dioButton.Check ed==true)
{
objVillageCryRe port.PrintOptio ns.PaperOrienta tion=
CrystalDecision s.Shared.PaperO rientation.Land scape;
}

objVillageCryRe port.PrintOptio ns.PrinterName= "Samsung ML-1610 Series"
//printer installed on my local PC;
if(yes_CheckBox .Checked==true)
{
yes_CheckBox.Te xt="true";

}
else
{
yes_CheckBox.Te xt="false";
}
objVillageCryRe port.PrintToPri nter(Convert.To Int32(noOfCopie s_TextBox.Text. Trim()),
Convert.ToBoole an(yes_CheckBox .Text)
,Convert.ToInt3 2(startingPage_ TextBox.Text.Tr im()),Convert.T oInt32(endPage_ TextBox.Text.To String()));
any help greatly appriciated.

Dec 26 '06 #1
3 9526
On 26 Dec 2006 06:01:15 -0800, Santosh wrote:
Hii..

i am printing crystal reports in asp.net for that purpose i am using
PrintTo Printer method but for that it is needed me to pass printer
name which is installed on my local computer but when i upload it on
server then it gives me an error no default printer . for printing
purpose their is another method in java script window.print() but it
print whole window which includes report toolbar and other buttons but
i want to print only report document.can any one tell me what i can do?
here is the code i am using.

objVillageCryRe port.PrintOptio ns.PaperSource= CrystalDecision s.Shared.PaperS ource.Auto;
switch(paperSiz e_DropDownList. SelectedValue)
{
case "PaperA4" :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA4;
break;
case "PaperA4Sma ll":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA4Small;
break;
case "PaperA3" :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA3;
break;
case "PaperB4":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperB4;
break;
case "PaperB5":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperB5;
break;
case "Paper10x14 ":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.Paper10x14;
break;
case "Paper11x17 ":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.Paper11x17;
break;
default :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.DefaultPaperS ize;
break;

}
if(portrait_Rad ioButton.Checke d==true)
{
objVillageCryRe port.PrintOptio ns.PaperOrienta tion=
CrystalDecision s.Shared.PaperO rientation.Land scape;

}
if(Landscape_Ra dioButton.Check ed==true)
{
objVillageCryRe port.PrintOptio ns.PaperOrienta tion=
CrystalDecision s.Shared.PaperO rientation.Land scape;
}

objVillageCryRe port.PrintOptio ns.PrinterName= "Samsung ML-1610 Series"
//printer installed on my local PC;
if(yes_CheckBox .Checked==true)
{
yes_CheckBox.Te xt="true";

}
else
{
yes_CheckBox.Te xt="false";
}
objVillageCryRe port.PrintToPri nter(Convert.To Int32(noOfCopie s_TextBox.Text. Trim()),
Convert.ToBoole an(yes_CheckBox .Text)
,Convert.ToInt3 2(startingPage_ TextBox.Text.Tr im()),Convert.T oInt32(endPage_ TextBox.Text.To String()));

any help greatly appriciated.
The problem is that the default account asp.net uses does not have access
to printers. You'll need to impersonate an account that does. Create an
account, log in with it, add a printer and then use impersonation for
asp.net to run under the account you have created
--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 26 '06 #2
i am not having any idea about how to so all these can u tell me how
would i ?

Rad [Visual C# MVP] wrote:
On 26 Dec 2006 06:01:15 -0800, Santosh wrote:
Hii..

i am printing crystal reports in asp.net for that purpose i am using
PrintTo Printer method but for that it is needed me to pass printer
name which is installed on my local computer but when i upload it on
server then it gives me an error no default printer . for printing
purpose their is another method in java script window.print() but it
print whole window which includes report toolbar and other buttons but
i want to print only report document.can any one tell me what i can do?
here is the code i am using.

objVillageCryRe port.PrintOptio ns.PaperSource= CrystalDecision s.Shared.PaperS ource.Auto;
switch(paperSiz e_DropDownList. SelectedValue)
{
case "PaperA4" :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA4;
break;
case "PaperA4Sma ll":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA4Small;
break;
case "PaperA3" :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperA3;
break;
case "PaperB4":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperB4;
break;
case "PaperB5":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.PaperB5;
break;
case "Paper10x14 ":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.Paper10x14;
break;
case "Paper11x17 ":
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.Paper11x17;
break;
default :
objVillageCryRe port.PrintOptio ns.PaperSize=Cr ystalDecisions. Shared.PaperSiz e.DefaultPaperS ize;
break;

}
if(portrait_Rad ioButton.Checke d==true)
{
objVillageCryRe port.PrintOptio ns.PaperOrienta tion=
CrystalDecision s.Shared.PaperO rientation.Land scape;

}
if(Landscape_Ra dioButton.Check ed==true)
{
objVillageCryRe port.PrintOptio ns.PaperOrienta tion=
CrystalDecision s.Shared.PaperO rientation.Land scape;
}

objVillageCryRe port.PrintOptio ns.PrinterName= "Samsung ML-1610 Series"
//printer installed on my local PC;
if(yes_CheckBox .Checked==true)
{
yes_CheckBox.Te xt="true";

}
else
{
yes_CheckBox.Te xt="false";
}
objVillageCryRe port.PrintToPri nter(Convert.To Int32(noOfCopie s_TextBox.Text. Trim()),
Convert.ToBoole an(yes_CheckBox .Text)
,Convert.ToInt3 2(startingPage_ TextBox.Text.Tr im()),Convert.T oInt32(endPage_ TextBox.Text.To String()));

any help greatly appriciated.

The problem is that the default account asp.net uses does not have access
to printers. You'll need to impersonate an account that does. Create an
account, log in with it, add a printer and then use impersonation for
asp.net to run under the account you have created
--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 29 '06 #3
On 29 Dec 2006 03:19:05 -0800, Santosh wrote:
i am not having any idea about how to so all these can u tell me how
would i ?
Take a look at this;

http://www.codeguru.com/forum/archiv.../t-290238.html

--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 29 '06 #4

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

Similar topics

0
1487
by: Randy | last post by:
I'm using Crystal.net version 9.0 in a aspx page using the CrystalReportViewer server control. When I view a report running locally on my server where I installed the crystal off the CD, the print works fine. If I view the HTML source, the print button A tag has an HREF that specifies javascript:__doPostBack However, when I view the same report on a development server where I just
4
2282
by: Wendy Elizabeth | last post by:
I would like to know how to print a crystal report that was generated in the ..NET framework using a Visual Basic.NET web application and/or a Visual basic.NET windows application. When crystal reports runs by itself, you can do a print preview to see what the report will look like. I would like to know how to do this using crystal reports that is embedded in the Visual Studio.net 1.1 professional and enterprise architect versions. ...
3
2570
by: Fabian | last post by:
Hello, Iam searching for a way to design a letter with Crystal Report. Now I want to imlement a table. I have the Data in a ArrayList, but it will not be able to make a Database, so I need a way to insert all the data from my ArrayList into this Table in the Crystal Report. How can I do that ? Another Problem is, that I must save the letter bevor printing it. So how can i get the Printevent from the Crystal Report ?
5
1780
by: Tony Dong | last post by:
Hi there, I am newer for dot net I want to make a report and then print it, the report may include images and text, how can I do that, any one can give me a suggestion? I know how to working with printers, but it looks just support text or image separately. Can I use cystal report to make a report and then use dot net program to
0
11558
by: Anniech | last post by:
I use VB.NET to integrate with crystal report 9.0 to print a report with custom paper size (using Dot Matrix printer). I have already added a custom paper size in the printer server and set the paper size in crystal report. However, 1. in web form, the crystal report viewer perview cannot identify the paper setting and use A4 instead. The print out is always with A4. 2. in win form, the crystal report viewer preview looks fine but...
2
3234
by: project | last post by:
I want to print an sales invoice with out open crystal report. I want to know ,with out opening Crystal report, how can I give the command to be printing invoice. I'm using the following lines to open a crystal report Dim myreport as new reportdocument() Dim Rptfrm as new project1.reportfrm()
2
14447
by: Rod | last post by:
We've got an old VB6 application which has 9 Crystal Reports it can print. These 9 reports are considered by our users to be in essence one "report", in the sense that they are all related and they cannot make their business plans without all 9 reports. However, they really are 9 separate reports, 7 of which have sub-reports in them. One of my colleagues has been working on converting them from the VB6 app, to .RPT files which can be...
0
2974
by: John Smith | last post by:
Hello, I am developing a VB.NET 2003 application that will use lots of Crystal Reports. Sometimes the users will preview a report in a Crystal report viewer, and sometimes they will send the report directly to the printer bypassing the Crystal report viewer altogether. When sending the job directly to the printer I use the PrintToPrinter command CR.PrintToPrinter(1, False, 0, 0)
1
8638
by: Kbalz | last post by:
Having a really hard time finding solid examples on deploying a CR .NET applcation on my intranet. I'll explain what I've done so far, and toward the bottom is where I can't print using the report viewer's gui button. I have a Windows XP sp2 Client machine used for development, it has Visual Studio 2005 sp1 and CR XI R2 Developer Version. My webserver is running Windows Server 2003 sp1, IIS 6.0, has CR XI R2 developer. I have a working...
1
2151
by: Saberthedream | last post by:
Hello, I am creating a crystal report in .net and i need to print the crystal report directly without showing it to user . for this i am writing code Report.PrintToPrinter(1, true, 0, 0); but when i run this report the print out page only show page no. not data present in report i.e only page no printed nothing else....i am in trouble plz help me how to print report directly using print to printer method.... thanks in Advance......
0
8586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8941
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
8775
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
8781
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...
1
6443
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
4312
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...
0
4536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2210
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1943
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.