2nd Post: Programmatically controlling printing... 
Author Message
 2nd Post: Programmatically controlling printing...

Hello all.  I've got an ASP page, that once called with response.redirect
"mypage.asp", I'd like to automatically print out.  Can anyone share any
code to programmatically print?  Of course, there's already a default
printer setup on the client end.

Much Thanks!

Roz



Mon, 25 Apr 2005 00:21:14 GMT  
 2nd Post: Programmatically controlling printing...

Quote:

> Hello all.  I've got an ASP page, that once called with
> response.redirect "mypage.asp", I'd like to automatically print out.
> Can anyone share any code to programmatically print?  Of course,
> there's already a default printer setup on the client end.

> Much Thanks!

> Roz

Client side uses JavaScript as default language...

    <body onload='window.print();'>

Client side uses VBScript as default language...

    <body onload='window.print'>

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US



Mon, 25 Apr 2005 01:16:51 GMT  
 2nd Post: Programmatically controlling printing...
Michael,

Thanks for the info.  Yeah, I stumbled upon this method for the window.
However, the window.print method only prints up the Print dialog box.  I
still must click the Print button.  I was hoping to automaticlly print the
page once it was loaded.

Thanks

Roz



Quote:

> > Hello all.  I've got an ASP page, that once called with
> > response.redirect "mypage.asp", I'd like to automatically print out.
> > Can anyone share any code to programmatically print?  Of course,
> > there's already a default printer setup on the client end.

> > Much Thanks!

> > Roz

> Client side uses JavaScript as default language...

>     <body onload='window.print();'>

> Client side uses VBScript as default language...

>     <body onload='window.print'>

> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US



Mon, 25 Apr 2005 01:36:45 GMT  
 2nd Post: Programmatically controlling printing...
Hello Roz

Here is some code that bypasses the Printing dialog box as well.

This goes in the header:
=================
<script laguage="VBScript">
sub window_onunload
        on error resume next
        set WB = nothing
        on error goto 0
end sub

sub print

        OLECMDID_PRINT = 6
        OLECMDEXECOPT_DONTPROMPTUSER = 2
        OLECMDEXECOPT_PROMPTUSER = 1

        on error resume next

        if DA then
              call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)

        else
              call WB.IOleCommandTarget.Exec(OLECMDID_PRINT
,OLECMDEXECOPT_DONTPROMPTUSER,"","","")

        end if

    if err.number <> 0 then
         if DA then
                     alert "Nothing Printed :" & err.number & " : " &
err.description
         else
             handle_error
         end if
    end if
    on error goto 0
end sub
</script>
=================
This goes in the body just before the closing <BODY> tag:
=================
<script language="vbscript">
if DA then
        wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
else
        wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
end if

document.write  "<OBJECT ID=""WB"" WIDTH=0 HEIGHT=0 CLASSID=""CLSID:"
document.write wbvers & """> </OBJECT>"
</script>

Thanks
Bryant W. Wilkins


Quote:
> Hello all.  I've got an ASP page, that once called with response.redirect
> "mypage.asp", I'd like to automatically print out.  Can anyone share any
> code to programmatically print?  Of course, there's already a default
> printer setup on the client end.

> Much Thanks!

> Roz



Mon, 25 Apr 2005 01:42:10 GMT  
 2nd Post: Programmatically controlling printing...
Hello Roz

One more thing.  In openning BODY tag place in the following
'onload="window.print()"'

Thanks
Bryant W. Wilkins


Quote:
> Hello Roz

> Here is some code that bypasses the Printing dialog box as well.

> This goes in the header:
> =================
> <script laguage="VBScript">
> sub window_onunload
>         on error resume next
>         set WB = nothing
>         on error goto 0
> end sub

> sub print

>         OLECMDID_PRINT = 6
>         OLECMDEXECOPT_DONTPROMPTUSER = 2
>         OLECMDEXECOPT_PROMPTUSER = 1

>         on error resume next

>         if DA then
>               call WB.ExecWB(OLECMDID_PRINT,

OLECMDEXECOPT_DONTPROMPTUSER,1)

- Show quoted text -

Quote:

>         else
>               call WB.IOleCommandTarget.Exec(OLECMDID_PRINT
> ,OLECMDEXECOPT_DONTPROMPTUSER,"","","")

>         end if

>     if err.number <> 0 then
>          if DA then
>                      alert "Nothing Printed :" & err.number & " : " &
> err.description
>          else
>              handle_error
>          end if
>     end if
>     on error goto 0
> end sub
> </script>
> =================
> This goes in the body just before the closing <BODY> tag:
> =================
> <script language="vbscript">
> if DA then
>         wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
> else
>         wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
> end if

> document.write  "<OBJECT ID=""WB"" WIDTH=0 HEIGHT=0 CLASSID=""CLSID:"
> document.write wbvers & """> </OBJECT>"
> </script>

> Thanks
> Bryant W. Wilkins



> > Hello all.  I've got an ASP page, that once called with
response.redirect
> > "mypage.asp", I'd like to automatically print out.  Can anyone share any
> > code to programmatically print?  Of course, there's already a default
> > printer setup on the client end.

> > Much Thanks!

> > Roz



Mon, 25 Apr 2005 01:49:26 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. programmatically point to file(s) in Outlook mailbox folder: 2nd post

2. Trouble Printing (2nd Post)

3. Printing an image and grid - 2nd post

4. Calendar Control (2nd Post)

5. 2nd Post - ADO Data COntrol

6. programmatically controlling header/footer on doc printed from WebBrowser control

7. Printing Image of all controls in picture box to 2nd picturebox

8. 2nd Post RE:Automation Problem

9. Dynamic forms on the fly(2nd post)

10. 2nd post

11. InetTransferLib - 2nd Post

12. 2nd post - Disable wheel on mouse

 

 
Powered by phpBB® Forum Software