Needs to print in the client printer

Hi,
The requirement is as follows
We have a web application in which we create reports and export it to  PDF and display it in the browser.
All works the problem here is we have a textbox in the webform in this textbox the client will enter a number say 5. Add when exporting the report to the pdf and display it in the browser we need to automatically print in the printer connected to the client's PC the report n number of times(if the user has entered 5 in the textbox then we need to print it 5 times).

can anyone provide me a solution to this problem or a point me to a URL that will help me find the solution.

The softwares used in
C#, Asp.net 1.1 and we are using the crystal reports available in Visual Studio 2003

Thanks in advance

venki
LVL 21
tovvenkiAsked:
Who is Participating?
 
Ramesh SrinivasTechnical ConsultantCommented:
Doesn't look like there is a way :(

There is no way to disable the prompt with JavaScript, so for Netscape and other browsers, users will have to see the dialog.  However, in some versions of Internet Explorer, a call to the ExecWB OLE method from a second browser object can be used to circumvent the print dialog (note: spaces have been added to OBJECT declarations to display the code properly in this article--you should remove the spaces to use the code):


function PrintWindow(){
if (navigator.appName == "Microsoft Internet Explorer") {
     var PrintCommand = '< O B J E C T ID="PrintCommandObject" WIDTH=0 HEIGHT=0 ';
PrintCommand += 'CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">';
     document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
     PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = ""; }
else { window.print();} }

You can try the ExecWB method on the client-side and hope that it bypasses the print dialogue for your pdf document. But ofcourse it may only work for IE.

regards,

KS

0
 
Ramesh SrinivasTechnical ConsultantCommented:
Hi venk,

Are you printing the pdf or crystal report??

Anyway, this may help you: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21777756.html

regards,

KS

0
 
tovvenkiAuthor Commented:
Hi,
Thanks for the quick response, but I think this is from an windows form application. I need to do that from a web application.

regards
venki
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Ramesh SrinivasTechnical ConsultantCommented:
0
 
Ramesh SrinivasTechnical ConsultantCommented:
Damn, it's server-side only i think :S

Not sure if there is a way to by-pass the print dialog on client-side printing (using window.print;).

I will look into it...
0
 
Ramesh SrinivasTechnical ConsultantCommented:
Apparently this works, but not for pdfs :O

AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER)
0
 
tovvenkiAuthor Commented:
Hi thanks again,
i think this won't work as this prints by reading using a stringreader. what is want is I have a webform which has a input box and a print button. when the print button is pressed a crystal reports report will be genereated and exported into a PDF then the generated PDF needs to be printed in the printer in the client's PC the number of times specified by the user.

regards
Venki
0
 
tovvenkiAuthor Commented:
Hi,
I will try this out and get back to you. In the mean time if you have other ideas please let me know it.

Thanks
venki
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.