[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: displaying a PDF on a Mac, Linux, Windows SWT app

Hi,

On MacOS X 10.4 (Tiger), I was able to display pdf files with SWT's Browser
widget:

import org.eclipse.swt.*;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class SimpleBrowser {
    
    public static void main(String [] args) {
        Display display= new Display();
        Shell shell= new Shell(display);
        
        Browser browser= new Browser(shell, SWT.NONE);
        browser.setUrl("file:///Users/weinand/Desktop/SWT/SWT.pdf");
        
        shell.setLocation(100, 100);
        shell.setLayout(new FillLayout());
        shell.layout(true);
        shell.open();
        
        while (!shell.isDisposed())
            if (!display.readAndDispatch())
                display.sleep();
        
        display.dispose();
    }
}

HTH,
--andre



On 26.5.2005 23:42 Uhr, in article
92f7e54fbc8c6c3216cfcbe887aec7e0$1@xxxxxxxxxxxxxxx, "Scheidecker Antunes"
<scheideckerantunes@xxxxxxxxx> wrote:

> Hello,
> 
> By looking at older posts I understand that it is possible to display a
> PDF inside a browser widget of an SWT app.
> 
> For that I assume that the browser widget calls the underlining browser
> from the hosting OS to diplay the PDF as the browser has the acrobat
> plugin.
> 
> I am new to SWT so I need some help. I need to have this code tested on
> Mac, Linux and Windows.
> 
> What I need to write is a very basic application to display a PDF file
> inside a SWT browser widget.
> 
> First, besides the swt.jar what order jars do I need in order to deploy
> it? I understand that I will need swt-mozilla.jar for linux, is it
> correct? How about Mac and Windows?
> 
> Does anyone has a simple code snipet to display a PDF file inside a
> browser widget? I need this for my school.
> 
> Thank you in advance,
> 
> C.F.
>