Click here to Skip to main content
15,906,766 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all..
I am working on a project and I am creating crystal reports.
I have to print the reports.
When I press the print icon on the report , 1 pop opens and it asks me to choose all pages or select page range when I press on "Ok" on this page it then opens the repost in pdf file and then I click on print button on pdf and then print comes.

I want that when User click on report then without any further popup the Print should come and if it is not possible then after 1st popup print shud come. I dont want that User shud see the pdf file..

and I have not written any code for printing..

and also
I have tried by changing the ReportViewer control PrintMode from ActiveX and PDF but nothing works.
Do u have any other Idea how to solve this problem..

I have also tried by using this
C#
reportDocument.PrintToPrinter(1, false, 1, 1);

but nothing works.
Can any body help me in this please...

Thanks in advance...
Posted
Updated 29-Sep-11 20:33pm
v2

1 solution

The popup you get is the standard print dialog from windows.
The reason it is printing to PDF is probably because you have a pdf creator as your standard printer.

Whatever you do in code doesn't matter when you use the print button from the crystal report viewer, it will always show a print dialog where you have to select you printer and set you options.

What you can do however is place a button on the screen that will print the report directly to printer.
This however requires that you have a printersettings and pagesettings object to do so.

If you call the method 'printtoprinter' with the variables you gave, the report will print to you standard printer.

You can call the same method with (printersettings, pagesettings, boolean).
The way we did it is. Give the user a screen where he can set the printersettings and pagesettings for each report in the program. Those objects are then serialized to a text file and saved on a network share. (Important: serialize to text don't save it in a database because you will lose data and the printing won't work for all printers)
Then give the user the choice of where he wants to print to: screen or printer.
If printer is selected then deserialize the objects from the text files and call the printtoprinter method.

This isn't a easy task but is possible.
 
Share this answer
 
Comments
bkthebest 30-Sep-11 4:12am    
thanks Tom,
ok, i'll go through it...
kindly can you tell me the way that how can get the path of client's printer on the server
Tom Deketelaere 30-Sep-11 4:20am    
I'm guessing your talking web application here.
Unfortantly I haven't had any experience in using this for the web.
Depending on the application itself the overall working should be the same. The client will however always have to choice his printer and pagesettings once.
When they choice them (in your custom form that calls the printer and page dialogs) you can them save them locally onto your server and next time they want to print you can use those to print directly to printer.
But I haven't tried this so you might have to work around some problems.
bkthebest 30-Sep-11 8:51am    
ok, thanks Tom
Koushal Dosi 19-Apr-12 3:02am    
how to print crystal report on client computer.
Sanju TV 10-Mar-13 8:48am    
this solution is working only on serverside, how to print on client side printers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900