We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Needs to print in the client printer

tovvenki
tovvenki asked
on
Medium Priority
352 Views
Last Modified: 2012-05-05
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
Comment
Watch Question

Ramesh SrinivasTechnical Consultant
CERTIFIED EXPERT

Commented:
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

Author

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
Ramesh SrinivasTechnical Consultant
CERTIFIED EXPERT

Commented:
Ramesh SrinivasTechnical Consultant
CERTIFIED EXPERT

Commented:
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 Consultant
CERTIFIED EXPERT

Commented:
Apparently this works, but not for pdfs :O

AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER)

Author

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
Technical Consultant
CERTIFIED EXPERT
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.