How to print a HTML-page automaticly....

Results 1 to 4 of 4

Thread: How to print a HTML-page automaticly....

  1. #1
    Join Date
    Dec 1969

    Default How to print a HTML-page automaticly....

    I want to create reports from students.<BR>Those reports are created in ASP.<BR><BR>I trying to create 1 HTML-file with all reports in it.( So with page-breaks in it)<BR><BR>But after all reports are created, i want that it prints automaticly. SO without any dialog-box (like the print-button in the toolbar)<BR><BR>Thanx,<BR><BR>Pieter

  2. #2
    Mike Shaffer Guest

    Default RE: How to print a HTML-page automaticly....

    The only way that I know of that you can do this (print without a prompt) is if you are using IE 4.0 or higher. Examine this client-side VBScript code:<BR><BR>&lt;OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"&gt;&lt;/OBJECT&gt;<BR>&lt;SCRIPT LANGUAGE="VBScript"&gt;<BR>Sub vbPrintPage<BR>&nbsp;&nbsp;&nbsp;OLECMDID_PRINT = 6<BR>&nbsp;&nbsp;&nbsp;OLECMDEXECOPT_DONTPROMPTUSE R = 2<BR>&nbsp;&nbsp;&nbsp;CMDEXECOPT_PROMPTUSER = 1<BR>&nbsp;&nbsp;&nbsp;On Error Resume Next<BR>&nbsp;&nbsp;&nbsp;WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER<BR>End Sub<BR>&lt;/SCRIPT&gt;<BR><BR><BR>As for your questions on page breaks, you may want to do some research on CSS and the directed media tag, e.g.<BR><BR>&lt;style media="print" type="text/css"&gt;<BR> •••<BR>&lt;/style&gt;<BR> <BR>and then you can start placing page-breaks where you want them when your page is printed, e.g.<BR><BR>&lt;style&gt;<BR> .pagebreak {page-break-before:always}<BR>&lt;/style&gt;<BR><BR><BR>Hope this helps!<BR><BR><BR>

  3. #3
    Mike Shaffer Guest

    Default By the way...

    While I stated that the DONTPROMPTUSER functionality required IE 4.0 or higher, what I actually meant was IE version 4.[anything]. <BR><BR>Unfortunately, Microsoft removed this functionality in IE 5. :(

  4. #4
    Sven Cipido Guest

    Default RE: How to print a HTML-page automaticly....

    Hi,<BR><BR>I had the almost the same problem. I had a webpage and with my own pritnbutton, I had to create a printerfriendly page which printed automaticly.<BR><BR>I have this 2 solutions for you (Given to me by another member of this board): <BR>1) in IE 5 and NS 4+ you can use the command print()<BR> &#060;a href="javascript:window.self.print();"&#062;Print& #060;/a&#062;<BR> or with a button <BR> &#060;form&#062;<BR> &#060;input type=button name=print value="Print" onClick="Javascript:window.print()"&#062;<BR><BR>B ut this is not working in IE4.<BR><BR>2) Go to following url :, article = "Scripting Support for Web Page Printing".<BR><BR>For my own application I have choosen the second option, the one from Microsoft. It works great and fully in background.<BR><BR>Sven Cipido

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts