none
bypass or supress print dialog box

    Question

  • Hi!

    I'm developing this web aplication for an intranet where the user can print a list, I want this to be automatic, I know I can do so by using a java script, but then I was asked to avoid the browser to show the printer dialog box so the printing process would be much more faster and easier for the user; I found some info about this in a forum (http://www.codingforums.com/archive/index.php?t-224.html) and I understand that acording to this site what I want could be posible in former os and ie versions but not in the new ones with updates (and I understand why). My cuestion is; Is it true that supressing or bypassing the printer dialog box by an script isn't posible? and if so maybe someone can point me out to a ms oficial article related to this (as I must prove what I was asked isn't posible) for I've looked within this site and I haven't been able to find anything related (Maybe I haven't looked enough... :P). Thanks

    Wednesday, February 21, 2007 7:34 PM

Answers

  • Actually for the IE environment there's an ActiveX control that's already part of the OS.  It's free!  Smile

     

    <script language='VBScript'>
    Sub Print()
           OLECMDID_PRINT = 6
           OLECMDEXECOPT_DONTPROMPTUSER = 2
           OLECMDEXECOPT_PROMPTUSER = 1
           call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
    End Sub
    document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
    </script>

    That Sub Print effectively replaces the default print function.  All you then need in Javascript is...

     

    window.print();

     

    Works like a charm! 

     

    I found this solution on the web but I accidentally closed the browser after I implemented it - dont know where I got it...  Thanks to the author though, whoever he/she was!

     

    Curt

     

    Wednesday, June 18, 2008 5:49 PM
  • ariz007:

     I've posted what I think is the solution to this matter. Using IE so far it seams to me that there is no way to bypass or supress the printing dialog box by means of javascripting (and actually I believe this is true for any other browser in their latest versions); however as formerly posted in this thread an activeX or a script/program running on windows can be developed to bypass the printing dialog, actually some users in this thread have posted sites where you can actually buy an exe file that  will do this; here at my company we hired a software developer to write such program charging for it an equivalent of $500.00 dls. we used it and it worked as expected as long the aplication was running on a windows enviroment, but as we planned this application for thin clients we faced many other implications and finally we gave up with this solution.

     Currently, at least for us, this has been solved by using Firefox as the browser for the application. The thin clients we are using, Neoware thin clients running a Linux core called Neolinux, can run a "Firefox snapin" which is kind of a stand alone firefox browser (no OS beside the linux core and no other aplication running on the thin client). Firefox being more costumisable has allowed us to supress the printing dialog in a very simple way that requires only one line in the about:config list (more of how to do this here: http://www.asktheadmin.com/2007/12/in-firefox-how-can-i-print-to-my_01.html).

     So far this is all what I have about this and as for me the problem is solved I won't go any further with finding a way to supress or bypass the printing dialog box on IE.
    Wednesday, June 18, 2008 4:02 PM

All replies

  • Hi chuy244!  I'm looking for the same information.  Have you found anything yet?

    Thanks.

    Wednesday, June 13, 2007 1:44 PM
  • As a developer, AND a user, I personally HATE this behavior (skipping the print dialog).

    This is my #1 annoyance with MS Word, thank goodness most applications didn't follow suit.

    I typically have access to at least 4, if not more printers... plus the ability to print to a file, or a PDF.

    If I don't get the opportunity to pick: (a) what printer, (b) what paper size, (c) what orientation, (d) what scale, (e) color vs. black & white, and (f) what print quality, I get very upset.

    These are user options and preferences.  Unless you have a very good reason to avoid uses choosing these options, please do not remove the users choice.

    In IE7 now, there is at least the option to do a proper preview/scale/rotation... it's only minor progress, but it beats the heck out of what IE6 provided.

    Steve
    Wednesday, June 13, 2007 2:35 PM
  • Yes, I would find it annoying too.  Unfortunately our clients want this behavior in our web application.  From my research so far, it seems I can't do this with javascript alone.  I was wondering if it would be possible to do this with an ActiveX control?  Any suggestions?
    Wednesday, June 13, 2007 3:41 PM
  • Thanks for the comments, I understand what you say, but yes... I do have a good reason to skip the print dialog box, as the app I'm developing is intented for internal use at my company and users (we suppose) will find the app much more friendly if this step is avoided. So far I haven't been able to find anything related (not even an article stating this is really imposible). I'll keep on my quest... Stick out tongue
    Friday, June 15, 2007 2:53 PM
  • MeadCo ScriptX will do it, but it comes at a price: $599

    If you're willing to pay, it does exactly what you're looking for: http://www.meadroid.com/scriptx/docs/samples/techie.asp

     

    But, I wish SOMEONE would let us know how we can do this without paying so much.  Does anyone know if Microsoft built anything like this in?

    Saturday, June 16, 2007 12:03 AM
  • Version of Word 2003 will bypass the print box. Version of Word 2000 will not bypass print box. I am trying to find how to bypass in Word 2000.
    Friday, July 20, 2007 6:35 PM
  • Hi All,

     

    IE7 supports window.print() as opposed to the earlier versions support for printing using the webbrowser object and the ExecWB method. Window.print() loads the printer selection dialog before spooling the document to the selected Printing device. The ExecWB method of printing requires the setting 'Allow scripting of the Web Browser' to be enabled in IE7. An untried suggestion would be to load the document to be printed in a hidden window (top -1000, left -1000) and to place the window.print() script in the documents onload event. I think this method may be defeated by a users popup blocking settings security settings for scripted windows.

     

    You may get some ideas looking at the printto context menu handler for HTML file types in the shell file type handlers...

     

    rundll32.exe c:\windows\system32\mshtml.dll, PrintHTML "%1" "%2" "%3" "%4"

     

    You could call the above command using Windows Scripting, or you may like to look at creating a custom protocol handler that could be installed on your clients' workstations enabling a hyperlink protocol (for example) like href="printtoBig SmileefaultPrinterName&Document=ClientReport.aspx"

     

    You can use windows scripting from within a web document by using javascripts' ActiveXObject method...

     

    var sURL = document.location.href;

    var WshShell = new ActiveXObject("wscript.shell");

    WshShell.run("rundll32.exe c:\windows\system32\mshtml.dll, PrintHTML " + sURL); // look up the optional arguments to the run method... wait etc.

     

    But this will have covenants depending upon the security zone where your web document resides. (hint: MTW=Mark of the Web)

     

    I personally would try the custom protocol handler route, though I think you are asking for trouble if you do not give the user intervention in the printer selection process. How will you support events like the printer running out of paper or a network connection being down.... whats the old saying(?), if it can happen then it will happen... (sic... I am getting old. I've forgotten who said that quote).

     

    Regards.

     

    Regards.

     

     

    Monday, July 23, 2007 4:46 AM
  •  unique_username wrote:
    As a developer, AND a user, I personally HATE this behavior (skipping the print dialog).

    This is my #1 annoyance with MS Word, thank goodness most applications didn't follow suit.

    I typically have access to at least 4, if not more printers... plus the ability to print to a file, or a PDF.

    If I don't get the opportunity to pick: (a) what printer, (b) what paper size, (c) what orientation, (d) what scale, (e) color vs. black & white, and (f) what print quality, I get very upset.

    These are user options and preferences. Unless you have a very good reason to avoid uses choosing these options, please do not remove the users choice.

    In IE7 now, there is at least the option to do a proper preview/scale/rotation... it's only minor progress, but it beats the heck out of what IE6 provided.

    Steve



    Well thats all well and good for you but as a developer who actually has to develop for actual people some of us need to can the print option. So the original question still stands.

    My customer wants a simple button on his html page that he simply pushes, and out of his printer pops a single sheet of paper, with exactly the information he wants printed. In his case he wants the first page (and only the first page) of the html page where the print button is on. He wants it printed in landscape, and on the default printer. He does not want to have to click on "OK" in the print dialog box, or change any of the settings in the print dialog box. He knows full well that he can do this by pushing ALT-F P... and clicking all the settings he wants. He wants a one button push.

    So is their a way I can set all the answers/options that the print dialog box asks and push that stupid OK button so the dialog box never comes up or not???


    Monday, July 23, 2007 4:13 PM
  • Hi,

     

    I hope they are paying you by the hour. We have all had problem clients that request functionallity that may appear simplistic and menial to them ( I want my web site to work on all browsers!), but which are outside the norm or for the effort required do no justify the return. Which is all well and good so long as you get paid for your efforts.

    The simple answer is that there is no web page scripting that will bypass the printer selection dialog, and you will have to look at a custom browser extension to find a solution.

     

    Some third-party extensions that come to mind are snagit and pdfcreator. These have options to print the currently displayed web page. They may be programmable which would allow you to script them in your web pages.

     

    I hope that when you do find a solution, your client does not phone you up to complain that it is not working, only to find that the printer power plug has been has been knocked out by the cleaner. All good if they are willing to pay.

     

    Regards.

    Monday, July 23, 2007 8:17 PM
  • Thank's for your comment IECUSTOMIZER, at least now I know where not to keep looking... Stick out tongue... I'll take a deeper look at what you say on your past comment and I hope I can find something.... and by the way... no, they are not paying by the hour (maybe that is why it's been so long since I've posted the question and I'm still looking... Stick out tongue).. but although I know what kind of request I've been asked I'll try (as far is reasonable) to give a solution. If I find something... for sure I'll post it here (as far it's is an addecuate and ethical solution ofcourse... Stick out tongue)

    Monday, July 23, 2007 9:47 PM
  • Hi,

    Usually user should have full control of printer devices. However I think you are not aware of other situations where user should not be able to do so!!!
    This affirmation sounds like a heresy compared with your text, but following are situations I found with my customers:

    a)       Print bar codes to a text printer with labels (User should not select another printer other then that);

    b)      Printing small text messages (2 to 6 lines) to a printer with continuous paper, so user could cut a small strip of paper with each message. Otherwise a full paper sheet would be need.

    I am still looking for a solution of this problem, since my customer wants to send output to the printer using only a click and in the quickest way.

    In those situations, print dialog is annoying user and not helping him.

     

    Even using print dialog I could not found a way to get the result of user selection (“Print” or “Cancel”).

    I am using Java comand  “document.execCommand("Print");

     

    Did some one have a solution to get user selection from Print Dialog?

     

    Thank you,

     

    Regards,

     

    Antonio Nuno

    Wednesday, October 24, 2007 12:06 AM
  • If you have a customer that specifically wants this behavior, then by all means apply it where appropriate.

    I would suggest either an Extension that presumably has some sort of higher priveleges, and you can enforce more appropriate logic...

    or

    (kind of hacky) create a tool that "sniffs" for an IE print dialog, matching your needs and specific pages.  AutoHotKey has the ability to jump in here, and automatically hide the print dialog, make certain selections, and send the print job to the given printer.

    For any case outside of these specific scenarios, I would let the user pick what they want.

    PS Although I recommend the extension approach, I have no expertise in building extensions for IE (only Firefox), thus I'm afraid I can't assist.

    Good Luck

    Wednesday, October 24, 2007 1:16 PM
  • unique_username: thanks for the info...

     So far we've triede the extension aproach, but we haven't been able to achieve exactly what we need as there's more to the problem as we intend to run the app on thin clients (but that's another thing). You mention something about AutoHotKey what's that exactly?
    Thursday, October 25, 2007 2:55 PM
  • hi all,
    we have same problem and looking for a solution,  we want to find a solution like http://print.coupons.com has implemented to print coupons. If someone have any idea about that please do inform at this thread.
    with Best Regards
    abbasi541
    Monday, November 12, 2007 7:32 PM
  • chuy244,

    Hmm, if you are going for a pure thin-client (e.g. just the end user's browser) I don't know if I have anything that can help.

    As for the AutoHotKey, http://www.autohotkey.com/ it is a cool little scripting language that you _can_ compile into an executable.  It is designed to do quick automation via hotkeys, but grew into an all purpose windows based script/gui tool.

    E.g. you can write a quick script/app to say... "WHEN IE is the active application, AND the window title contains "your site name", THEN watch for the Print dialog... if it pops (within 2 seconds) of IE losing focus, SEND KEYS/Click buttons X, Y, Z.

    It's not perfect, but it can be a really helpful tool in certain scenarios (like when automatic updates installs new stuff, but you don't want to reboot right now (or in 20min when it reminds you, or in 40min, etc.)... (you just tell it to dismiss the dialog)

    It would be a bit of a stretch for what you are looking for I think.

    You may be better off with a Print2PDF printer added to the user's system, then have an ActiveX or something automate the print job.

    You may also want to check out Flash... they may have some auto-print option that you can hook into?
    Monday, November 12, 2007 9:24 PM
  • I am also looking for same solution where my client wants to print a Web page direct to a network printer without showing the PrintDialog.

     

    Any help appreciated.

     

    Thanks,

    Mahesh

    Wednesday, January 30, 2008 6:02 PM
  • Hi all...!! Well it's solved... (i guess) the thing is we had some development company to come up with a solution and they gave us back this exe file wich is a script (i guess something like IECUSTOMIZER whas suggesting). When  running, this script/program will skip any print dialog box from any aplication such IE or Wordo or anything... as we intent to run only the web browser on a thin client this is ok. I don't really know how this exe file works I'm just guessing the aproach taken. But gues what!!! in the end my boss didn't like it. We took another aproach... now we used Firefox and skipin' the dialog box is really simple with this browser (sorry to say it in this forum.. Stick out tongue). here's how to do it! http://www.asktheadmin.com/2007/12/in-firefox-how-can-i-print-to-my_01.html.

    Hope this is of help.
    Thursday, January 31, 2008 4:52 PM
  • I have the opposite problem, Steve.  When I use file/print, the document in Word 2003 simply prints wthout giving me the options in print dialog box.  It just doesn't appear.  Any help?

    Saturday, February 09, 2008 6:17 PM
  • Yes.  Don't click the Print Icon in Word - Ever. Unless you like wasting paper.

    In Word, always Print Preview, or Click File > Print...


    Now, that said, you might forget sometimes.  If you want, I can whip you up a little app that will ignore clicks on the print button, and call the print dialog up instead! ;-)

    Microsofts design was to make things simple for printing, but I think they confused the home user (with typ. 1 8.5x11 printer) with business users that have 4, 5,6,... 12 printers to choose from.

    Personally, I have an HP Plotter (4 FOOT WIDE) that is my default printer, but DEFINATELY NOT where I want my Word Docs to print to.

    Anyway, if you want the application, just let me know what ver of Office you have. 2000, 2003, etc.
    Wednesday, February 13, 2008 10:17 PM
  • As many people on many websites have mentioned. Client Side printing (w/o) a dialog box popping up is not allowed in IE7, no matter what you do to disable it.  I even tried adjusting the security settings in IE7 to "allow scripting of Internet Explorer web browser control"= Enable.  and it still gave me the popup when I tried to print using java-script.

     

    YES it does appear to work in previous browser versions.

     

    So as last resort I found a piece of software (That you have to install as an active-X) control on the client.  But it seems to be the trick I have been looking for.

     

    Costs are about $500 for mulitple URLS.

     

     

    HERE is the only active-x control I have found which will provide/print this type of

    functionality

    http://www.meadroid.com/scriptx/docs/printdoc.asp#examples

     

    I personally have not written or tested the controls.  But I plan too.

     

    We are trying to convert a point of sale application into a browser based application. So that client can be transported to just about any machine with minimal installation requirements.

     

    To note: we need to print to a receipt printer and also and ID Card printer with very specific printer properties and requirements of what is printed to the printers.  Much Like a Point of Sale Application (POS).

     

    REFERENCE:

    Doug Lubey of Louisiana

    www.DougLubey.com

     

     

     

     

    SEARCH ENGINE REFERENCE:

    printer dialog box popup

    browser disable printer dialog box

    internet explorer disable printer dialog box

    internet explorer 7 disable printer dialog box

    internet explorer 7 disable printer dialog box automatically print

    internet explorer 7 disable printer dialog box automatically print ExecWB

    IE7 disable printer dialog box automatically print ExecWB

    IE7 suppress printer dialog box automatically print ExecWB

    IE7 suppress printer dialog box

    print a webpage and suppress the printer dialog box

    internet explorer 7 suppress printer dialog box for printing documents

    Internet Explorer 7 printer dialog box

    Internet Explorer 7 printer dialog prompt

    internet explorer 7 supress printer dialog box

    asp.net avoid printer dialog box using internet explorer print directly to printer

    asp.net avoid printer dialog box internet explorer

    asp.net avoid print window internet explorer

    internet explorer 7 printer dialog box suppress

    javascript printing disable print dialog box

    CAN NOT DISABLE THE PRINTER DIALOG BOX. using javascript.

    javascript printing

    client side form and printing of documents to a specific printer

    client side format and printing of documents to a specific printer

    Monday, June 09, 2008 7:31 PM
  • Wow, this thread's lifespan is amazing...

     

    We too need to print without intervention.  Our application ideally needs to be on a thin client and receives unsolicited messages that need to be printed automatically.  There might not be someone sitting in front of the tube!

     

    What frosts me is that there's a print button on the tool bar (Alt-R) that skips the dialog.  So why shouldnt JS have access to that function...  : (

     

     

     

    Tuesday, June 10, 2008 11:04 AM
  • In IE7 with many many search and try to use JS to skips print dialog ---and all of that fail Sad.

    and i think we can't do it with js only.

    I have written a add-on (active-x) to install to IE. And every think easy now. I think you should write a add-on. it easy than you spend a lot of time to search on google. (sorry about my english)

    Thursday, June 12, 2008 5:04 AM
  •  

    hi chuy244!Gud day!!!  regarding direct to print in web without displaying the print dialog box. Have u found the solution? I need it so badly. tnx.
    Wednesday, June 18, 2008 12:00 PM
  • ariz007:

     I've posted what I think is the solution to this matter. Using IE so far it seams to me that there is no way to bypass or supress the printing dialog box by means of javascripting (and actually I believe this is true for any other browser in their latest versions); however as formerly posted in this thread an activeX or a script/program running on windows can be developed to bypass the printing dialog, actually some users in this thread have posted sites where you can actually buy an exe file that  will do this; here at my company we hired a software developer to write such program charging for it an equivalent of $500.00 dls. we used it and it worked as expected as long the aplication was running on a windows enviroment, but as we planned this application for thin clients we faced many other implications and finally we gave up with this solution.

     Currently, at least for us, this has been solved by using Firefox as the browser for the application. The thin clients we are using, Neoware thin clients running a Linux core called Neolinux, can run a "Firefox snapin" which is kind of a stand alone firefox browser (no OS beside the linux core and no other aplication running on the thin client). Firefox being more costumisable has allowed us to supress the printing dialog in a very simple way that requires only one line in the about:config list (more of how to do this here: http://www.asktheadmin.com/2007/12/in-firefox-how-can-i-print-to-my_01.html).

     So far this is all what I have about this and as for me the problem is solved I won't go any further with finding a way to supress or bypass the printing dialog box on IE.
    Wednesday, June 18, 2008 4:02 PM
  • Actually for the IE environment there's an ActiveX control that's already part of the OS.  It's free!  Smile

     

    <script language='VBScript'>
    Sub Print()
           OLECMDID_PRINT = 6
           OLECMDEXECOPT_DONTPROMPTUSER = 2
           OLECMDEXECOPT_PROMPTUSER = 1
           call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
    End Sub
    document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
    </script>

    That Sub Print effectively replaces the default print function.  All you then need in Javascript is...

     

    window.print();

     

    Works like a charm! 

     

    I found this solution on the web but I accidentally closed the browser after I implemented it - dont know where I got it...  Thanks to the author though, whoever he/she was!

     

    Curt

     

    Wednesday, June 18, 2008 5:49 PM
  • I'm amazed..!!!!!!!!!!!!!!! wow.......!!!! Surprise!! It actually works..!!! (where were you CurtisDeHaven more than a year ago when I started this thread??... Stick out tongue... heheh...) Any way... here you are Ladys and Gentelmen cortesy of CurtisDeHaven a free ActiveX control that allow you to bypass the printing dialog box on IE I just tested it and works as expected.... I don't get tired of saying it... I'm amazed...!!!!!! I just built a simple webpage with a "Print this" link and I keep clicking it again and again... just to see the document getting to the printer spool and then getting printed (in the same pice of papper of course, gotta save the trees.. Stick out tongue). Thanks a lot man... as maybe you noticed I had given up on this... (now I have a new hope.... hehehe... ).

     

    I have marked the CurtisDeHaven post as an answere, but I'll leave my post as an answere to as even now that I'm able to skip the printing dialog on IE we won't be getting back to using IE for our App as we have found Firefox (at least for our application) much more convinient and someone else could to.

    Thursday, June 19, 2008 12:01 AM
  • Hi,

     

    The free ActiveX control is the WebBrowser control!

     

    The above script will also work in IE7-8, so long as you have enabled "Enable scripting of the WebBrowser" on the security tab of Internet Options.

     

    Regards.

     

    Thursday, June 19, 2008 1:47 AM
  • chuy244

     

    Thanks for your support, but again I cannot take credit for the creativity involved in that solution.  My strengths lie in persistence with yahoo/google searches!  As I mentioned I cant find the original link to this solution but I did find one with the exact same source!  Although this one has a bit more comments... 

     

    http://www.internettg.org/newsletter/dec99/print_test.htm

     

    Note the author's use of "DA" - his solution supports IE4!!!

     

    Obviously my version is whiddled way down, but I have to render this from an ASP.Net/C# page, so less is better...

     

    Hope it helps!!   Enjoy!!

     

    Curt

     

    Thursday, June 19, 2008 3:23 PM
  • wow. it work. i ever think ExecWB function will not work in IE7 but i'm wrong. thank you. But i don't know why my browse don't work with this functione before. but now. it works like a charm! Sad Thank you.

    But anyway. i aready write a activeX for IE because i need change some thing in print dialog like page side. width, height...

    Thank again

    Friday, June 20, 2008 2:05 AM
  • Ok, i was following the post, not because i need to supress the dialog but because i just need to know if the user hit print or cancel on the dialog. i'm tired of this alice-in-wonderland style, onafterprint is firing before the dialog?!?!? to adjust onbeforeprint?!?!?! as if i can't decide?

     

    seems that supressing the dialog will be my best effort to know that the page was printed... but leave the user no choice of printer, format, orientation and all that stuff the printing dialog was made for...

     

    i was happy with the dialog, actually i need it to choose printing target and setting.. just wanted to know if it was printed or canceled.

     

    gosh! i will keep looking

    Sunday, June 22, 2008 10:59 AM
  • Hi,

     

    I whent to the trouble of creating an Addon for IE7 to print directly to the default printer (bypassing the security setting to allow scripting of the WebBrowser control) only to find.... It is already in IE7(and 8, thats where I 'discovered' it). lol.

     

    Here is how you print to the default printer without the print dialog box....

     

    Just click the Print button on the Command bar.... you should then see a small printer icon on the status bar and the current document will be sent straight to the default printer.

     

    There is no need to put a special Print button on your web pages.(Actually there are situations (Public Libraries) where you do not users to be able to print web pages.

     

    Do not click on the drop-down chevron to make a selection from the dropdown menu,, just click the button directly... thats it.

     

    We can all lol now.

     

    Talk about the hidden obvious. So  File>Print menu option will prompt with the printer selection dialog and then print, Command bar Print button will print direct to the default printer without prompting. The Dropdown menu of the Command Bar Print button has three options - Print, Print Preview and Page Setup

     

    Regards.

     

    Tuesday, July 08, 2008 6:33 AM
  • Thanks Rob!  That's good to know.  However, in our case we needed not so much a print link on the page, but rather we had to be able to print "unattended".  Our application is largely js-based.  The browser may receive unsolicited information from the server that needs to be sent to a printer - regardless if someone is sitting in front of the pc or not!  And if someone happens to be using the pc, independent of any work they're doing.  It's just the nature of our application.

     

    Tuesday, July 08, 2008 9:58 AM
  • k, np with that.

     

    You will have full control over your security settings for your browser. Its for users of sites like coupons.com who would like to print a large volume of internet content without being restricted by knowledge of IE's security zone settings.

     

    My second biggest download is for the Print Preview command bar button... very popular with Public Libraries who do not want to waste paper. Using GP they can disable the built-in IE Printing functions and force their users to go through the print preview dialog before committing to print a hard copy.

     

    The issue I think that just plain clicking the Print button on the Command Bar had a different (thought supptle) function to the menu commands. It may be in the IE help file but I haven't looked yet.

     

    Regards.

    Tuesday, July 08, 2008 10:10 AM
  • CurtisDeHaven : this method works like a charm. thanks!  One question, is there anyway we can print to a specific printer instead of default printer ?  Also is there a chance to format the pages via program ex: landscape or Portrait etc?

    Friday, August 22, 2008 7:27 AM
  • >> specific printer instead of default printer ? 

     

    Not that I'm aware of, though my own superiers would like that too!  If anyone figures out how to do that, please post it here.

     

    As far as portrait or lanscape, you probably need to use the print dialog.  I suspect the printer prints it the way it was "last" printed.

    Friday, August 22, 2008 10:40 AM
  • CURTIS have you found a way to activate the "print" mechanism but print another url and the contents of that web page?

    So rather than print the current webpage I can print another pages contents under the same domain name?
    Friday, December 04, 2009 10:15 PM
  • Hi Curt,

    Thanks for sharing the solution, it worked well with my web page programming.

    R,

     

    -G

     

    Friday, August 20, 2010 12:24 AM
  • you get your device list from KEY

    "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices"

    then you change String useing Client Side vbscript the following is snippets from my sub.

    Set objShell = CreateObject("WScript.Shell")
    objShell.RegWrite "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device",{your device string},"REG_SZ"
    
    

    As long has you have shared printers to work with you can attach the same printers to each desktop. I am also using this technique to change my print margins depending on the print job I want to run.

     

     

     

    objShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\my_margin_right",mright,"REG_SZ"
    objShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\my_margin_bottom",mbottom,"REG_SZ"
    objShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\my_margin_top",mtop,"REG_SZ"
    objShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\my_margin_left",mleft,"REG_SZ"
    objShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\my_footer",mfooter,"REG_SZ"
    
    

    I too am still looking for how to set the page size and orientation.  Unfortunately, I think this is a printer property and may not be accessable.

    Friday, September 10, 2010 9:56 PM
  • Great!! This is a truly helpful reply. Awesome!

    I am able to bypass the print dialog in IE on printing.

    Can you just let me know how to change the print preview settings from client side code (VBSCript/JavaScript)?

    I need to change the Print Size percentage of page by client side. If you could give me this it would be really helpful.

    Thanks.

    Prajakta

    Thursday, March 22, 2012 7:13 AM
  • there is No client side script api.

    Rob^_^

    Thursday, March 22, 2012 9:40 AM
  • Haven't you guys heard, that there is a way, using "Subclassing and/or Hooking"...?

    I'm looking for examples using either subclassing or hooking, which allows you to intercept any dialog box anywhere in windows, including webbrowser control or IE's File Download dialog, look up the book "Subclassing and Hooking with Visual Basic" - it is available on google's ebook archive, searchable and readable, i am in the middle of reading it but I am trying to figure out the parameters and what to look for and how to implement this for the File Download dialog box in particular.

    And IDownloadManager implementation will not work for VB6, and i'm tired of seeing that as a solution - because it's not. Using subclassing, you can get all the details of the dialog box, and the details of the controls on the dialog box, then you can automatically change the values in the location section, and click the Save button, all WITHOUT THE DIALOG EVER BEING SHOWN TO ANY OF THE USERS, the download will begin, and the dialog will never be seen, because you are intercepting it and taking control of it instead of the default procedure that would take control of it.

    Search on google to find some examples, I've spent my last two days on this.

    You can read the whole book here (since its no longer copy-right protected):

    http://ebookbrowse.com/subclassing-and-hooking-with-visual-basic-pdf-d319133138

    Mainly for VB6 but includes chapters for VB.NET as well.

    There is a download button on the top if you prefer to download and view/read on your pdf reader or iPad/iPhone/Kindle :). Hopefully, someone figures out a solution, as i know there are solutions in .NET.

    Tuesday, October 16, 2012 7:03 PM