473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.
objVillageCryReport.PrintOptions.PaperSource=Cryst alDecisions.Shared.PaperSource.Auto;
switch(paperSize_DropDownList.SelectedValue)
{
case "PaperA4" :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA4;
break;
case "PaperA4Small":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA4Small;
break;
case "PaperA3" :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA3;
break;
case "PaperB4":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperB4;
break;
case "PaperB5":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperB5;
break;
case "Paper10x14":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.Paper10x14;
break;
case "Paper11x17":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.Paper11x17;
break;
default :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.DefaultPaperSize;
break;

}
if(portrait_RadioButton.Checked==true)
{
objVillageCryReport.PrintOptions.PaperOrientation=
CrystalDecisions.Shared.PaperOrientation.Landscape ;

}
if(Landscape_RadioButton.Checked==true)
{
objVillageCryReport.PrintOptions.PaperOrientation=
CrystalDecisions.Shared.PaperOrientation.Landscape ;
}

objVillageCryReport.PrintOptions.PrinterName="Sams ung ML-1610 Series"
//printer installed on my local PC;
if(yes_CheckBox.Checked==true)
{
yes_CheckBox.Text="true";

}
else
{
yes_CheckBox.Text="false";
}
objVillageCryReport.PrintToPrinter(Convert.ToInt32 (noOfCopies_TextBox.Text.Trim()),
Convert.ToBoolean(yes_CheckBox.Text)
,Convert.ToInt32(startingPage_TextBox.Text.Trim()) ,Convert.ToInt32(endPage_TextBox.Text.ToString())) ;
any help greatly appriciated.

Dec 26 '06 #1
3 9513
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.

objVillageCryReport.PrintOptions.PaperSource=Cryst alDecisions.Shared.PaperSource.Auto;
switch(paperSize_DropDownList.SelectedValue)
{
case "PaperA4" :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA4;
break;
case "PaperA4Small":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA4Small;
break;
case "PaperA3" :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA3;
break;
case "PaperB4":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperB4;
break;
case "PaperB5":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperB5;
break;
case "Paper10x14":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.Paper10x14;
break;
case "Paper11x17":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.Paper11x17;
break;
default :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.DefaultPaperSize;
break;

}
if(portrait_RadioButton.Checked==true)
{
objVillageCryReport.PrintOptions.PaperOrientation=
CrystalDecisions.Shared.PaperOrientation.Landscape ;

}
if(Landscape_RadioButton.Checked==true)
{
objVillageCryReport.PrintOptions.PaperOrientation=
CrystalDecisions.Shared.PaperOrientation.Landscape ;
}

objVillageCryReport.PrintOptions.PrinterName="Sams ung ML-1610 Series"
//printer installed on my local PC;
if(yes_CheckBox.Checked==true)
{
yes_CheckBox.Text="true";

}
else
{
yes_CheckBox.Text="false";
}
objVillageCryReport.PrintToPrinter(Convert.ToInt32 (noOfCopies_TextBox.Text.Trim()),
Convert.ToBoolean(yes_CheckBox.Text)
,Convert.ToInt32(startingPage_TextBox.Text.Trim()) ,Convert.ToInt32(endPage_TextBox.Text.ToString())) ;

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.

objVillageCryReport.PrintOptions.PaperSource=Cryst alDecisions.Shared.PaperSource.Auto;
switch(paperSize_DropDownList.SelectedValue)
{
case "PaperA4" :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA4;
break;
case "PaperA4Small":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA4Small;
break;
case "PaperA3" :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperA3;
break;
case "PaperB4":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperB4;
break;
case "PaperB5":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.PaperB5;
break;
case "Paper10x14":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.Paper10x14;
break;
case "Paper11x17":
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.Paper11x17;
break;
default :
objVillageCryReport.PrintOptions.PaperSize=Crystal Decisions.Shared.PaperSize.DefaultPaperSize;
break;

}
if(portrait_RadioButton.Checked==true)
{
objVillageCryReport.PrintOptions.PaperOrientation=
CrystalDecisions.Shared.PaperOrientation.Landscape ;

}
if(Landscape_RadioButton.Checked==true)
{
objVillageCryReport.PrintOptions.PaperOrientation=
CrystalDecisions.Shared.PaperOrientation.Landscape ;
}

objVillageCryReport.PrintOptions.PrinterName="Sams ung ML-1610 Series"
//printer installed on my local PC;
if(yes_CheckBox.Checked==true)
{
yes_CheckBox.Text="true";

}
else
{
yes_CheckBox.Text="false";
}
objVillageCryReport.PrintToPrinter(Convert.ToInt32 (noOfCopies_TextBox.Text.Trim()),
Convert.ToBoolean(yes_CheckBox.Text)
,Convert.ToInt32(startingPage_TextBox.Text.Trim()) ,Convert.ToInt32(endPage_TextBox.Text.ToString())) ;

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
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...
4
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...
3
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...
5
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...
0
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...
2
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...
2
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...
0
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...
1
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...
1
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.