Link to home
Start Free TrialLog in
Avatar of petegreenup
petegreenup

asked on

Need a button on a web page, that can auto print to the default printer (meaning, without the print options box popping up)

Hi all.
To be more specific im looking for this button to do three things upon clicking it:

1. Take the data that the user inputs via a form on the same page (Name, Company, Person visiting, Phone number etc...)and add it to a .CSV file.
2. Print a selcect few of the form fields (Name and Company + predefined logo) to a label printer (the only printer on the machine which is attached to lpt0) with out any other boxes popping up.
3. Move to a confimation page.

So I have 1. and 3. figured out and working with frontpage server extensions. Is there any way i can make this same button print immediately without asking the user to choose a printer? ActiveX control maybe?

I know on the Microsoft web site they have done this in the MCP section when asking to print a transcript of your exams. there is a button that does just want i want. but i know there is some ActiveX control code attached to it, and am looking for someone who has free code to let me use, or for someone to explain how it is done, or to point me in the right direction for a tool that will help me do that, and how to use that tool. (i have Microsoft ActiveX control Pad).
Thanks!
Avatar of avner
avner

Using an Active X is the only way :


<html>
<head>
<title>about:blank</title>
<script language="javascript1.2">
<!-- copyright(c) avcoh@yahoo.com
function print() {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);

    execScript("on error resume next: WebBrowser1.ExecWB 6, -1", "VBScript");
    execScript('on error resume next: WebBrowser1.outerHTML = ""', 'VBScript');
}
-->
</script>
<style>

</style>
</head>
<body>
test page <button onclick="print()">print !</button>
</body>
</html>


Avatar of petegreenup

ASKER

Ok great!!! this prints the same webpage, is there anyway i can print either a hidden frame or a spcified part/section of the page. ie just a couple of fields from the form?
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of avner
avner

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp


Cd&

It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
popints to avner

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&