943,703 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 10051
  • ASP.NET RSS
Jun 29th, 2009
0

printing at client side without print dialog box

Expand Post »
hi..actually i am developing a web application wherein i need to print barcodes at client side.
i have the PCL file that would print the barcode but the problem lies in printing at the client side and that too without opening the print dialog box.
can somebody help me with this issue??
what i exactly want is that the user clicks the button and barcode is printed at the default printer (with no dialog box)..

somebody help me ..
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Poojasrivastava is offline Offline
13 posts
since Apr 2009
Jun 29th, 2009
0

Re: printing at client side without print dialog box

The printing behavior client side is handled by the browser and as far as I know you cannot change this behavior without writing a browser plugin.

According to a post I read it is possible for some browsers but I still do not recommend it:
http://www.webdeveloper.com/forum/sh...ad.php?t=85301
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Jun 29th, 2009
0

Re: printing at client side without print dialog box

Last edited by adatapost; Jun 29th, 2009 at 8:38 am.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jun 29th, 2009
0

Re: printing at client side without print dialog box

Try the solution given by Andy0000 in the following link: http://www.webdeveloper.com/forum/ar.../t-174029.html

But it may work in IE only.
Reputation Points: 165
Solved Threads: 113
Posting Pro
Ramesh S is offline Offline
580 posts
since Jun 2009
Jun 29th, 2009
0

Re: printing at client side without print dialog box

Use an ActiveX or Plugin ScriptX and Neptune from Meadroid to give you more control for Windows versions of Internet Explorer, Netscape, and Opera.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jul 16th, 2009
0

Re: printing at client side without print dialog box

OK this worked for me, ASP and IE8. This will print to your default printer as soon as the page loads.

** NO PRINTER DIALOG POP-UP!!!!!!! **

ASP.NET Syntax (Toggle Plain Text)
  1. <body onload="window.print();">
  2.  
  3. <OBJECT Classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0></OBJECT>
  4.  
  5. <SCRIPT LANGUAGE="JavaScript">
  6.  
  7. DA = (document.all) ? 1 : 0
  8.  
  9. </SCRIPT>
  10.  
  11. <SCRIPT LANGUAGE="VBScript">
  12.  
  13. sub print()
  14.  
  15. OLECMDID_PRINT = 6
  16.  
  17. OLECMDEXECOPT_DONTPROMPTUSER = 2
  18.  
  19. OLECMDEXECOPT_PROMPTUSER = 1
  20.  
  21. 'on error resume next
  22.  
  23.  
  24.  
  25. 'IE4 object has different command structure
  26.  
  27. if DA then
  28.  
  29. call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
  30.  
  31.  
  32.  
  33. else
  34.  
  35. call WB.IOleCommandTarget.Exec(OLECMDID_PRINT ,OLECMDEXECOPT_DONTPROMPTUSER,"","")
  36.  
  37.  
  38.  
  39. end if
  40.  
  41.  
  42.  
  43. end sub
  44.  
  45.  
  46.  
  47. 'This will be interpreted during loading.
  48.  
  49. 'It will write out the correct webbrowser object depending
  50.  
  51. 'on the browser version. To be sure it works, make sure you
  52.  
  53. 'include this script block in between the body tags.
  54.  
  55.  
  56.  
  57. if DA then
  58.  
  59. 'this must be IE4 or greater
  60.  
  61. wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
  62.  
  63. else
  64.  
  65. 'this must be IE3.x
  66.  
  67. wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
  68.  
  69. end if
  70.  
  71.  
  72.  
  73. document.write ""
  74.  
  75. </SCRIPT>
Last edited by peter_budo; Jul 17th, 2009 at 2:21 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
adamself is offline Offline
1 posts
since Jul 2009
Jan 19th, 2010
0

Please Help! this command prints a page 2 times, how to print single time?.

Please Help! this command prints a page 2 times, i need the page to be printed once. how to do so?



Click to Expand / Collapse  Quote originally posted by adamself ...
OK this worked for me, ASP and IE8. This will print to your default printer as soon as the page loads.

** NO PRINTER DIALOG POP-UP!!!!!!! **

ASP.NET Syntax (Toggle Plain Text)
  1. <body onload="window.print();">
  2.  
  3. <OBJECT Classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0></OBJECT>
  4.  
  5. <SCRIPT LANGUAGE="JavaScript">
  6.  
  7. DA = (document.all) ? 1 : 0
  8.  
  9. </SCRIPT>
  10.  
  11. <SCRIPT LANGUAGE="VBScript">
  12.  
  13. sub print()
  14.  
  15. OLECMDID_PRINT = 6
  16.  
  17. OLECMDEXECOPT_DONTPROMPTUSER = 2
  18.  
  19. OLECMDEXECOPT_PROMPTUSER = 1
  20.  
  21. 'on error resume next
  22.  
  23.  
  24.  
  25. 'IE4 object has different command structure
  26.  
  27. if DA then
  28.  
  29. call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
  30.  
  31.  
  32.  
  33. else
  34.  
  35. call WB.IOleCommandTarget.Exec(OLECMDID_PRINT ,OLECMDEXECOPT_DONTPROMPTUSER,"","")
  36.  
  37.  
  38.  
  39. end if
  40.  
  41.  
  42.  
  43. end sub
  44.  
  45.  
  46.  
  47. 'This will be interpreted during loading.
  48.  
  49. 'It will write out the correct webbrowser object depending
  50.  
  51. 'on the browser version. To be sure it works, make sure you
  52.  
  53. 'include this script block in between the body tags.
  54.  
  55.  
  56.  
  57. if DA then
  58.  
  59. 'this must be IE4 or greater
  60.  
  61. wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
  62.  
  63. else
  64.  
  65. 'this must be IE3.x
  66.  
  67. wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
  68.  
  69. end if
  70.  
  71.  
  72.  
  73. document.write ""
  74.  
  75. </SCRIPT>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rohit.ss is offline Offline
1 posts
since Jan 2010
Jan 19th, 2010
0
Re: printing at client side without print dialog box
Reputation Points: 8
Solved Threads: 7
Light Poster
pauldani is offline Offline
49 posts
since Jan 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: showing the gridview on button click
Next Thread in ASP.NET Forum Timeline: Problem with ASP.net not displaying correctly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC