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 17:46  |
Eclipse User |
|
|
|
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 09:58   |
Eclipse User |
|
|
|
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 02:42   |
Eclipse User |
|
|
|
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 12:41   |
Eclipse User |
|
|
|
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 08:27  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Wed Jul 23 14:35:39 EDT 2025
Powered by FUDForum. Page generated in 0.08109 seconds
|