Needs to print in the client printer

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#, 1.1 and we are using the crystal reports available in Visual Studio 2003

Thanks in advance

LVL 21
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ramesh SrinivasTechnical ConsultantCommented:
Hi venk,

Are you printing the pdf or crystal report??

Anyway, this may help you:



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

Ramesh SrinivasTechnical ConsultantCommented:
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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...
Ramesh SrinivasTechnical ConsultantCommented:
Apparently this works, but not for pdfs :O

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.

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.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tovvenkiAuthor Commented:
I will try this out and get back to you. In the mean time if you have other ideas please let me know it.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.