views:

711

answers:

2

Hi, I 'm exploring for a browser solution / API that has the following features:

  • Must support the nowadays default web technologies
  • Must support client side XSLT
  • Must support executing arbitrary Javascript on the pages it loads
  • Must be able to catch events from the web page targeted to the browser or OS (I am specifically interested in window.print())

QtWebkit seemed like the way to go but it still doesn't support XSLT so I had to look for alternatives. SWT Browser is a wrapper around the native browser component of the underlying system and in linux that I 'm interested this would mean the firefox engine that supports the attributes I 'm interested in except that I haven't still found out how to catch window.print() and provide my own implementation instead of the default one that is opening up a print dialog.

Any suggestions?

+2  A: 

If you know a way how to catch the event in javascript an prevent the native dialog from showing, you can use the method shown in this snippet to catch the event in your SWT code.

The other option might be better though: Use mozilla's classes to register your own print handler. Something similar is shown in this snippet for the download handler, but I haven't tested if it is possible for the print handler as well.

The catch for this second option is stated in the snippet's javadoc:

IMPORTANT: For this snippet to work properly all of the requirements for using JavaXPCOM in a stand-alone application must be satisfied (see http://www.eclipse.org/swt/faq.php#howusejavaxpcom).

the.duckman
A: 

FWIW there's another approach for doing this with Mozilla-based SWT Browsers at http://www.eclipse.org/forums/index.php?t=msg&th=166869&start=0& .

Grant Gayed