Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

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!
0
petegreenup
Asked:
petegreenup
  • 2
  • 2
1 Solution
 
avnerCommented:
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>


0
 
petegreenupAuthor Commented:
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.
0
 
avnerCommented:
The only way you can print parts of the page is by adding CSS to explicity set parts of the page to be hidden.

For example if you have button you don't want to display :

<button class="noprint">don't print me</button>

Then in the style tag :

<STYLE>
@media print  
{
     button.noprint{
               display:none;
          }
}
</STYLE>
0
 
COBOLdinosaurCommented:
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:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
COBOLdinosaurCommented:
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&

0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now