Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » PDF Viewer plugin AWT/SWT problem
PDF Viewer plugin AWT/SWT problem [message #448177] Tue, 04 January 2005 22:46 Go to next message
Bernd Hofner is currently offline Bernd HofnerFriend
Messages: 68
Registered: July 2009
Member
I'm looking for a way to display PDF files (usually just a one page
technical drawing) on one page of a MultiPageEditor.
Is there a simple to use PDF plugin around?
I Googled around a bit but couldn't find one.

I found a JavaBean from Adobe wich I tried to integrate, but this didn't
work out:

public class ToolFrameEditor extends MultiPageEditorPart
{
....
addPages() {

Composite composite = new Composite(getContainer(), SWT.EMBEDDED);

Frame awtFrame= SWT_AWT.new_Frame(composite);
awtFrame.setLayout(new BorderLayout());
try
{
pdfViewer= new com.adobe.acrobat.Viewer();
}
catch(Exception e)
{
e.printStackTrace();
}


awtFrame.add(pdfViewer);
try
{
FileInputStream in = new FileInputStream(myFileName);
pdfViewer.setDocumentInputStream(in);

idxPDFPage= addPage(composite);
setPageText(idxPDFPage, "PDF View");
pdfViewer.activate();
}
catch(Exception e)
{
e.printStackTrace();
}

}


The problem is that Adobe pops up a Licence Dialog as soon as the
com.adobe.acrobat.Viewer()
is created.

This dialog has the tendency to stay invisible, which would make
acknowleging it, hmm, difficult.
But even if it does show up, it doesn't react to mouse or keyboard input
(mouse cursor shows as hour-glass).

I guess this happens because the pdfViewer has not been added to the
awtFrame, yet, so that the SWT events
are not passed through.

Can anyone shed some light here?

Thanks,

Bernd
Re: PDF Viewer plugin AWT/SWT problem [message #448195 is a reply to message #448177] Wed, 05 January 2005 14:58 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Can you make it work in a stand alone AWT program?

"Bernd Hofner" <bernd.hofner@gmx.net> wrote in message
news:crf6h8$o2i$3@www.eclipse.org...
> I'm looking for a way to display PDF files (usually just a one page
> technical drawing) on one page of a MultiPageEditor.
> Is there a simple to use PDF plugin around?
> I Googled around a bit but couldn't find one.
>
> I found a JavaBean from Adobe wich I tried to integrate, but this didn't
> work out:
>
> public class ToolFrameEditor extends MultiPageEditorPart
> {
> ...
> addPages() {
>
> Composite composite = new Composite(getContainer(), SWT.EMBEDDED);
>
> Frame awtFrame= SWT_AWT.new_Frame(composite);
> awtFrame.setLayout(new BorderLayout());
> try
> {
> pdfViewer= new com.adobe.acrobat.Viewer();
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
>
>
> awtFrame.add(pdfViewer);
> try
> {
> FileInputStream in = new FileInputStream(myFileName);
> pdfViewer.setDocumentInputStream(in);
>
> idxPDFPage= addPage(composite);
> setPageText(idxPDFPage, "PDF View");
> pdfViewer.activate();
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
>
> }
>
>
> The problem is that Adobe pops up a Licence Dialog as soon as the
> com.adobe.acrobat.Viewer()
> is created.
>
> This dialog has the tendency to stay invisible, which would make
> acknowleging it, hmm, difficult.
> But even if it does show up, it doesn't react to mouse or keyboard input
> (mouse cursor shows as hour-glass).
>
> I guess this happens because the pdfViewer has not been added to the
> awtFrame, yet, so that the SWT events
> are not passed through.
>
> Can anyone shed some light here?
>
> Thanks,
>
> Bernd
>
>
>
>
>
>
Re: PDF Viewer plugin AWT/SWT problem [message #448423 is a reply to message #448195] Mon, 10 January 2005 07:42 Go to previous messageGo to next message
Bernd Hofner is currently offline Bernd HofnerFriend
Messages: 68
Registered: July 2009
Member
Yes, it works fine like this:

public class HelloAcrobat
{

static com.adobe.acrobat.Viewer pdfViewer;

public HelloAcrobat()
{
super();
}

private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);

//Create and set up the window.
JFrame frame = new JFrame("HelloAcrobat");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


try
{
pdfViewer= new com.adobe.acrobat.Viewer();
}
catch(Exception e)
{
e.printStackTrace();
}


frame.getContentPane().add(pdfViewer);
try
{

FileInputStream in = new
FileInputStream("C:\\Profilstrasse\\SSI-CncEditor\\Werkzeuge\\Anlage-1\\PDF\
\RP2808.pdf");
pdfViewer.setDocumentInputStream(in);

pdfViewer.activate();

}
catch (FileNotFoundException x)
{
System.out.println("File not found!");
}
catch(Exception e)
{
e.printStackTrace();
}

frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}}

"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:crgvba$6o6$1@www.eclipse.org...
> Can you make it work in a stand alone AWT program?
>
> "Bernd Hofner" <bernd.hofner@gmx.net> wrote in message
> news:crf6h8$o2i$3@www.eclipse.org...
> > I'm looking for a way to display PDF files (usually just a one page
> > technical drawing) on one page of a MultiPageEditor.
> > Is there a simple to use PDF plugin around?
> > I Googled around a bit but couldn't find one.
> >
> > I found a JavaBean from Adobe wich I tried to integrate, but this didn't
> > work out:
> >
> > public class ToolFrameEditor extends MultiPageEditorPart
> > {
> > ...
> > addPages() {
> >
> > Composite composite = new Composite(getContainer(),
SWT.EMBEDDED);
> >
> > Frame awtFrame= SWT_AWT.new_Frame(composite);
> > awtFrame.setLayout(new BorderLayout());
> > try
> > {
> > pdfViewer= new com.adobe.acrobat.Viewer();
> > }
> > catch(Exception e)
> > {
> > e.printStackTrace();
> > }
> >
> >
> > awtFrame.add(pdfViewer);
> > try
> > {
> > FileInputStream in = new FileInputStream(myFileName);
> > pdfViewer.setDocumentInputStream(in);
> >
> > idxPDFPage= addPage(composite);
> > setPageText(idxPDFPage, "PDF View");
> > pdfViewer.activate();
> > }
> > catch(Exception e)
> > {
> > e.printStackTrace();
> > }
> >
> > }
> >
> >
> > The problem is that Adobe pops up a Licence Dialog as soon as the
> > com.adobe.acrobat.Viewer()
> > is created.
> >
> > This dialog has the tendency to stay invisible, which would make
> > acknowleging it, hmm, difficult.
> > But even if it does show up, it doesn't react to mouse or keyboard input
> > (mouse cursor shows as hour-glass).
> >
> > I guess this happens because the pdfViewer has not been added to the
> > awtFrame, yet, so that the SWT events
> > are not passed through.
> >
> > Can anyone shed some light here?
> >
> > Thanks,
> >
> > Bernd
> >
> >
> >
> >
> >
> >
>
>
Re: PDF Viewer plugin AWT/SWT problem [message #448457 is a reply to message #448423] Mon, 10 January 2005 17:41 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Ok, please submit a bugzilla report including all the infomation (the
working AWT only example and the failing SWT_AWT one). Thanks.

"Bernd Hofner" <bernd.hofner@gmx.net> wrote in message
news:crtbkp$qmn$1@www.eclipse.org...
> Yes, it works fine like this:
>
> public class HelloAcrobat
> {
>
> static com.adobe.acrobat.Viewer pdfViewer;
>
> public HelloAcrobat()
> {
> super();
> }
>
> private static void createAndShowGUI() {
> JFrame.setDefaultLookAndFeelDecorated(true);
>
> //Create and set up the window.
> JFrame frame = new JFrame("HelloAcrobat");
> frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>
>
> try
> {
> pdfViewer= new com.adobe.acrobat.Viewer();
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
>
>
> frame.getContentPane().add(pdfViewer);
> try
> {
>
> FileInputStream in = new
>
FileInputStream("C:\\Profilstrasse\\SSI-CncEditor\\Werkzeuge\\Anlage-1\\PDF\
> \RP2808.pdf");
> pdfViewer.setDocumentInputStream(in);
>
> pdfViewer.activate();
>
> }
> catch (FileNotFoundException x)
> {
> System.out.println("File not found!");
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
>
> frame.pack();
> frame.setVisible(true);
> }
>
> public static void main(String[] args) {
> javax.swing.SwingUtilities.invokeLater(new Runnable() {
> public void run() {
> createAndShowGUI();
> }
> });
> }}
>
> "Steve Northover" <steve_northover@ca.ibm.com> wrote in message
> news:crgvba$6o6$1@www.eclipse.org...
> > Can you make it work in a stand alone AWT program?
> >
> > "Bernd Hofner" <bernd.hofner@gmx.net> wrote in message
> > news:crf6h8$o2i$3@www.eclipse.org...
> > > I'm looking for a way to display PDF files (usually just a one page
> > > technical drawing) on one page of a MultiPageEditor.
> > > Is there a simple to use PDF plugin around?
> > > I Googled around a bit but couldn't find one.
> > >
> > > I found a JavaBean from Adobe wich I tried to integrate, but this
didn't
> > > work out:
> > >
> > > public class ToolFrameEditor extends MultiPageEditorPart
> > > {
> > > ...
> > > addPages() {
> > >
> > > Composite composite = new Composite(getContainer(),
> SWT.EMBEDDED);
> > >
> > > Frame awtFrame= SWT_AWT.new_Frame(composite);
> > > awtFrame.setLayout(new BorderLayout());
> > > try
> > > {
> > > pdfViewer= new com.adobe.acrobat.Viewer();
> > > }
> > > catch(Exception e)
> > > {
> > > e.printStackTrace();
> > > }
> > >
> > >
> > > awtFrame.add(pdfViewer);
> > > try
> > > {
> > > FileInputStream in = new FileInputStream(myFileName);
> > > pdfViewer.setDocumentInputStream(in);
> > >
> > > idxPDFPage= addPage(composite);
> > > setPageText(idxPDFPage, "PDF View");
> > > pdfViewer.activate();
> > > }
> > > catch(Exception e)
> > > {
> > > e.printStackTrace();
> > > }
> > >
> > > }
> > >
> > >
> > > The problem is that Adobe pops up a Licence Dialog as soon as the
> > > com.adobe.acrobat.Viewer()
> > > is created.
> > >
> > > This dialog has the tendency to stay invisible, which would make
> > > acknowleging it, hmm, difficult.
> > > But even if it does show up, it doesn't react to mouse or keyboard
input
> > > (mouse cursor shows as hour-glass).
> > >
> > > I guess this happens because the pdfViewer has not been added to the
> > > awtFrame, yet, so that the SWT events
> > > are not passed through.
> > >
> > > Can anyone shed some light here?
> > >
> > > Thanks,
> > >
> > > Bernd
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
Re: PDF Viewer plugin AWT/SWT problem [message #448490 is a reply to message #448457] Tue, 11 January 2005 13:27 Go to previous message
Bernd Hofner is currently offline Bernd HofnerFriend
Messages: 68
Registered: July 2009
Member
Upps, replyed to wrong thread, here again my answer...


Yes, it works fine like this:

public class HelloAcrobat
{

static com.adobe.acrobat.Viewer pdfViewer;

public HelloAcrobat()
{
super();
}

private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);

//Create and set up the window.
JFrame frame = new JFrame("HelloAcrobat");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


try
{
pdfViewer= new com.adobe.acrobat.Viewer();
}
catch(Exception e)
{
e.printStackTrace();
}


frame.getContentPane().add(pdfViewer);
try
{

FileInputStream in = new
FileInputStream("C:\\Profilstrasse\\SSI-CncEditor\\Werkzeuge\\Anlage-1\\PDF\
\RP2808.pdf");
pdfViewer.setDocumentInputStream(in);

pdfViewer.activate();

}
catch (FileNotFoundException x)
{
System.out.println("File not found!");
}
catch(Exception e)
{
e.printStackTrace();
}

frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}}

"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:crgvba$6o6$1@www.eclipse.org...
> Can you make it work in a stand alone AWT program?
>
> "Bernd Hofner" <bernd.hofner@gmx.net> wrote in message
> news:crf6h8$o2i$3@www.eclipse.org...
> > I'm looking for a way to display PDF files (usually just a one page
> > technical drawing) on one page of a MultiPageEditor.
> > Is there a simple to use PDF plugin around?
> > I Googled around a bit but couldn't find one.
> >
> > I found a JavaBean from Adobe wich I tried to integrate, but this didn't
> > work out:
> >
> > public class ToolFrameEditor extends MultiPageEditorPart
> > {
> > ...
> > addPages() {
> >
> > Composite composite = new Composite(getContainer(),
SWT.EMBEDDED);
> >
> > Frame awtFrame= SWT_AWT.new_Frame(composite);
> > awtFrame.setLayout(new BorderLayout());
> > try
> > {
> > pdfViewer= new com.adobe.acrobat.Viewer();
> > }
> > catch(Exception e)
> > {
> > e.printStackTrace();
> > }
> >
> >
> > awtFrame.add(pdfViewer);
> > try
> > {
> > FileInputStream in = new FileInputStream(myFileName);
> > pdfViewer.setDocumentInputStream(in);
> >
> > idxPDFPage= addPage(composite);
> > setPageText(idxPDFPage, "PDF View");
> > pdfViewer.activate();
> > }
> > catch(Exception e)
> > {
> > e.printStackTrace();
> > }
> >
> > }
> >
> >
> > The problem is that Adobe pops up a Licence Dialog as soon as the
> > com.adobe.acrobat.Viewer()
> > is created.
> >
> > This dialog has the tendency to stay invisible, which would make
> > acknowleging it, hmm, difficult.
> > But even if it does show up, it doesn't react to mouse or keyboard input
> > (mouse cursor shows as hour-glass).
> >
> > I guess this happens because the pdfViewer has not been added to the
> > awtFrame, yet, so that the SWT events
> > are not passed through.
> >
> > Can anyone shed some light here?
> >
> > Thanks,
> >
> > Bernd
Previous Topic:How to prevent a widget to gain focus...
Next Topic:How To: Delete SWT Tree nodes dynamically
Goto Forum:
  


Current Time: Fri Oct 23 01:52:34 GMT 2020

Powered by FUDForum. Page generated in 0.06974 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top