realbasic-nug
[Top] [All Lists]

Re: HTMLViewer: Print a page using javascript

To: NUG REALbasic mailing list <realbasic-nug@lists.realsoftware.com>
Subject: Re: HTMLViewer: Print a page using javascript
From: "emile.a.schwarz" <emile.a.schwarz@wanadoo.fr>
Date: Sat, 30 May 2009 16:20:22 +0200 (CEST)
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
Hi Carlos, the list,

tested with the most recent REALbasic version on MacBook / macOS X 10.5.7:

>Load a Page:
>HTMLViewer1.LoadURL "http://www.example.com";;
Load the page if it is available ;-)
BUT ONLY IF YOU REMOVE THE ENDING ';'


>HTMLViewer1.LoadURL("javascript:void(window.print());")
>HTMLViewer1.LoadURL("javascript:window.print();")
>HTMLViewer1.LoadURL("javascript:self.print();")
>HTMLViewer1.LoadURL("javascript:this.print();")

None of these works :(


>Note: The browser must have javascript enabled.
On MacBook, it seems that HTMLViever’s JavaScript is enabled.

How to check if JavaScript is enabled ?
For testing pueposes, place the following code in your html test file:



I got: “Is Java enabled? true” when I added the above line in a local html 
file, then loaded in an HTMLviewer [remember MacBook]

NOTA: I took the advice à la lettre; I only placed one of the HTMLViewer line 
(the others were commented):

Function FilePrint() As Boolean
'HVHelp.LoadURL("javascript:void(window.print());")
'HVHelp.LoadURL("javascript:window.print();")
'HVHelp.LoadURL("javascript:self.print();")
'HVHelp.LoadURL("javascript:this.print();")

// load a new page from hard disk
HVHelp.LoadURL 
"file:///FireFox%20Downloads/REALbasic%202009r3/Help/index_cretxt.html"

// try to print
HVHelp.LoadURL("javascript:this.print();")
End Function

Nothing happens.


Emile

>For future reference here are some ways using javascript to print a
>page with HTMLViewer.
>
>Load a Page:
>
>Print the page using javascript:
>(Any of the following works on Windows with an HTMLViewer. Not tested
>on MAC, but probably one of the javascript instructions might work)
>HTMLViewer1.LoadURL("javascript:void(window.print());")
>HTMLViewer1.LoadURL("javascript:window.print();")
>HTMLViewer1.LoadURL("javascript:self.print();")
>HTMLViewer1.LoadURL("javascript:this.print();")
>
>Note: The browser must have javascript enabled.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
<Prev in Thread] Current Thread [Next in Thread>