Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Displaying PDF in eclipse via ActiveX control hangs randomly
Displaying PDF in eclipse via ActiveX control hangs randomly [message #442510] Mon, 06 September 2004 14:39
Eclipse UserFriend
Originally posted by: moritz.thomas.empolis.com

Hi,

I'm trying to embed the Acrobat ActiveX control into eclipse. My code is
very much based on the example in:
http://www-106.ibm.com/developerworks/opensource/library/os- activex/

In general this works. The first pdf file (actually it's all single pages)
displays in about 0.5 seconds. Howeveer for roughly 70% (number differs
depending on phase of moon) of the subsequent page views, the display takes
about 10 seconds.

Often it helps to maximize and then minimize the view - the next page
displays fast again.

For reference I'm posting the key pieces of code below.

Thanks in advance
moritz

public boolean loadFile(String file)
{
long time = System.currentTimeMillis();

int[] rgdispid = automation.getIDsOfNames(new String[]{"LoadFile"});
int dispIdMember = rgdispid[0];

Variant[] rgvarg = new Variant[1];
rgvarg[0] = new Variant(file);

Variant result = automation.invoke(dispIdMember, rgvarg);

System.err.println("LoadFile " + file + " took "
+ ((float) (System.currentTimeMillis() - time) / 1000F));

return result.getBoolean();
}

protected void activate()
{
if (!activated)
{
activated = controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE) ==
OLE.S_OK;
}
}

protected void show(String file)
{
activate();

// OleAutomation oleAutomation = new OleAutomation(controlSite);
OlePDF pdfViewer = new OlePDF(controlSite);

try
{
boolean loaded = pdfViewer.loadFile(file);

if (loaded)
{
pdfViewer.setShowToolBar(false);
pdfViewer.setZoomScroll(80f, 300f, 800f);
}
else
{
throw new RuntimeException("LoadFile failed");
}
}
finally
{
pdfViewer.dispose();
}
}
Previous Topic:[Question- How to use "Shoutcut Key" in the TableViewer]
Next Topic:It's possible to clean up a composite?
Goto Forum:
  


Current Time: Fri Apr 19 20:38:14 GMT 2024

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

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

Back to the top