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

Posted on 2003-03-23
Medium Priority
Last Modified: 2010-04-09
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).
Question by:petegreenup
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 14

Expert Comment

ID: 8195591
Using an Active X is the only way :

<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');

test page <button onclick="print()">print !</button>


Author Comment

ID: 8199896
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?
LVL 14

Accepted Solution

avner earned 360 total points
ID: 8200456
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 :

@media print  
LVL 53

Expert Comment

ID: 8820595
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.

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.

If the user does not know how to close the question, the options are here:


LVL 53

Expert Comment

ID: 9015884
It is time to clean this abandoned question up.

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

popints to avner


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



Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question