Embedded with pdf

Hello!

I have some problems using the Embedded component to show pdf content in my web application.


(1) In toolkit 4.1.2
the browser (FF3.0.5) crashes after one or two page refresh of the following simple example application.


Window mainw = new Window();
this.setMainWindow(mainw);
mainLo = mainw.getLayout();
Embedded ppreview = new Embedded();
try {
   ppreview.setSource(new ExternalResource(PDFURL));
} catch (MalformedURLException e) {
   e.printStackTrace();
}
ppreview.setImmediate(true);
ppreview.setMimeType("application/pdf");
ppreview.setHeight(500);
ppreview.setWidth(545);
mainLo.addComponent(ppreview);


(2) In toolkit 5.3.0RC7
the pdf is not shown at all, but in the debug console there is the message “Unknown Embedded mimetype ‘application/pdf’”…

Best regards, Johannes

Hi!

I gotta admit that don’t remember at all how pdf files were handled in TK4.

In version 5 there is now special support built for pdf to my knowledge. It could be easily done though if needed.

As an easy workaround, I’d suggest you put the embedded into “browsers” mode. Like this:
emb.setType(Embedded.TYPE_BROWSER);

It will practically make an iframe where the resource is set. That should do the trick. In most of the cases this is how pdf would be support. Only Safari supports pdf files as images if I remember correctly.

cheers,
matti