Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Print Dialog Control

Options
  • 04-01-2001 11:15am
    #1
    Closed Accounts Posts: 35


    I wish to display a print dialog control to popup modally on a web page when the user clicks a button on the page. I want to access (and manipulate) all the properties both before and after the user selection on that popup screen, so as I can control (to some extent what it is that it printed.

    Any suggesstions!


Comments

  • Registered Users Posts: 194 ✭✭Sputnik


    Might help if we knew what language you were useing.


  • Registered Users Posts: 12,309 ✭✭✭✭Bard


    One language you can be sure he's using is HTML anyway...

    The following code will pop up the dialog box. I don't think there's much you can do to tweak the properties.

    To pop it up automatically on loading the page:
    <META http-equiv="refresh" content="0;url=javascript:window.print()">
    

    To pop it up on a link:
    <a href="javascript:window.print()">Print this page</a>
    

    bard2.gif


  • Registered Users Posts: 12,309 ✭✭✭✭Bard


    That only works in Internet Explorer, to the best of my knowledge. Generally, it's not a good idea to try to mess with operating system functions like 'print' and dialog boxes, mainly due to the different O/S'es and browsers that people use. I implemented the above on a web page on an Intranet site on which I knew all the users were using at least version 5.1 of IE.


  • Closed Accounts Posts: 35 bwoods


    Thanks for the help guys.

    The language I am using could be either client side Java Script or Client Side VB Script(Which ever works best).

    I need it to be browser independant. I also don't want it to print the contents of the window, rather the contents of an ActiveX Control (Which is Form Software/ Formflow), which is on the screen.

    I also will need it to print other pages not loaded into the control, that will be specified in the Print Dialog. I cannot use it's print Dialog because of this.

    I could put a couple of controls on the page, like

    Number of Copies:
    Pages : 1 to XXX, etc

    But it might be a bit messy.

    The Print Dialog control on the ActiveX control doesn't give me those options.

    Any other help would be great.

    Thanks again

    Brendan


  • Registered Users Posts: 3,316 ✭✭✭ButcherOfNog


    use a serverside component to control the printing. just get a list of the servers print queues etc and let the user choose 1 etc etc etc. you can then maniplate the printing whatever way you want to.

    if theres a need for printing from the client side then you need to use whatever is provided with the plugin, even if it is limited


  • Advertisement
  • Registered Users Posts: 194 ✭✭Sputnik


    opps, misread the question, that'll learn me to pay attention.


  • Registered Users Posts: 2,660 ✭✭✭Baz_


    Ah welcome Sputnik...


  • Registered Users Posts: 194 ✭✭Sputnik


    Ya, decided to put in an appearance.


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    <font face="Verdana, Arial" size="2"><META http-equiv="refresh" content="0;url=javascript:window.print()"></font>

    So although there is a standard way, that is part of javascript, that will allow you to detect page load, you are going to use a non-standard http header, which does not have to be honoured, and which could cause an error in situations where the standard way can't (NS2.0+ with js turned off).

    what's wrong with:
    onload=function(){print()}
    or <body onload="print()">
    ?
    of course you should test for the presence of the print method by using:
    if(self.print)print()

    This works with NS4+, IE5+(not beta).

    There is a kludge with IE4 that enables you to print as well (write in a webbrowser control object, call the print method and then delete the webbrowser control).

    You don't get that much control, for the simple reason that you would be able to do nasty stuff to a viewer in that case (e.g. you're surfing along and then some fscker prints out gibberish on all your pages).

    Best way for better print control from and ActiveX object is to create your own ActiveX object, which includes the one you are using, and which then prints from its own code. Personally I don't think embedded ActiveX controls should be allowed to print except through bringing up a user dialog, for the security reasons I mentioned.


Advertisement