Embedded PDF/img display in IE and eclipse browser but not in FF or chrome

Hello,

I’m facing difficulties to display a PDF in different browser than the eclipse internal one…
Here is my code very simple that work’s fine in eclipse browser :


		AbsoluteLayout myTabCours = new AbsoluteLayout();
		myTabCours.setWidth("800px");
		myTabCours.setHeight("640px");		

		Embedded c = new Embedded("Test PDF external");
		c.setSource(new ExternalResource(this.getContext().getBaseDirectory().toString() + "/WEB-INF/Cours/test.pdf"));
		c.setType(Embedded.TYPE_BROWSER);
		myTabCours.addComponent(c);

But not in Chrome => white screen with the following html code associated :


<iframe width="100%" height="100%" frameborder="0" allowtransparency="true" src="myPdfUrlOnDisk" name="PID5"></iframe>

Nor in Firefox => MessageBox : Firefox doesn’t know how to open this address because the protocol (f) isn’t associated with any program

So if anyone already have the same issue, help would be appreciated :stuck_out_tongue:

thanx in advance

pod

I also notice that the problem is the same with image(jpg) in embeded composent!

Working well in Internet Explorer or eclipse internal browser, but not in Firefox and Chrome…

If someone has a clue.

Hi,

I’m not quite sure what your problem is, but most browsers can not normally display PDF embedded in the browser window, or in an iframe. For example, Firefox
requires a plugin
for that. I think that installing Adobe Reader might install also the Firefox plugin, at least in Windows.

Perhaps you should not assume that all browsers are capable of opening PDF docs embedded.

Your use of ExternalResource looks like it should not work. The getBaseDirectory() returns a directory path, not a URL path. You should also not be able to make references to WEB-INF as that that should be a hidden path in servlets. So, I don’t understand how that could work in Eclipse or IE.

As far as I know, Eclipse simply embeds IE in itself (in Windows), so in Windows, Eclipse Browser == IE.

Hi,

Thanks for replying !

Ok I’ve just installed a new firefox plugin for reading PDF, and it doesn’t seems to work better :glare:
And besides I’ve been watching PDF sample here : http://uilder.virtuallypreinstalled.com/run/Embedded_PDF/, that works fine with my firefox…

So it migth be another problem, maybe linked to the second part of your response

You were rigth (while I was responding I’ve tried using a FileRessource instead of ExternalRessource) and it works fine in Chrome !!
Thanks for the advice

Ok, I’m thinking of it, maybe put a simple link to download the PDF file!! (would be an easier solution by the way)

thx for your time