Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Showing a PDF file with the Browser component
Showing a PDF file with the Browser component [message #1222626] Fri, 20 December 2013 23:15 Go to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 235
Registered: January 2012
Senior Member

We tried to show a PDF file (located on the server file system) with the Browser component, using

browser.setUrl("file:/...");

but had no success.

What are we doing wrong? Is there another way to do this?

Thank you
Vincenzo
Re: Showing a PDF file with the Browser component [message #1223409 is a reply to message #1222626] Mon, 23 December 2013 09:52 Go to previous messageGo to next message
Markus Knauer is currently offline Markus KnauerFriend
Messages: 179
Registered: July 2009
Senior Member

Your browser (i.e. the client) doesn't have access to the filesystem of the server, therefore you cannot use a file://... based URL. You need to use a http://... URL instead, and you need to provide a download for this file, e.g. by registering your PDF file as a resource.

Thanks,
Markus
Re: Showing a PDF file with the Browser component [message #1223737 is a reply to message #1223409] Tue, 24 December 2013 10:01 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 235
Registered: January 2012
Senior Member

Hi Markus,
ok, this makes sense!
But then I have a question: in order to provide a download for this file I suppose I have to copy it into the deployed app folder structure (e.g. /var/tomcat/webapp/myapp/...). Is this correct or is it possible to register a resource outside of the application folder structure?
Considering that the file is coming from the Upload RAP component I suppose that I have to:
1) retrieve dinamically the deployed app folder
2) copy the uploaded file into a folder inside the deployed app structure
3) register it
4) open it with a http:// URL

Is this the correct way?
If yes how can I solve the point 1) ?
If not what is a more correct way?

Thank you very much
and Happy Chrismas!

Vincenzo
Re: Showing a PDF file with the Browser component [message #1224694 is a reply to message #1223409] Fri, 27 December 2013 13:57 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 235
Registered: January 2012
Senior Member

Hi Markus,
I found this post, which was quite interesting:
http://www.eclipse.org/forums/index.php/mv/msg/34747/112842/#msg_112842

following this suggestion (that is: making a servlet provide the download stream for the document) we are able to use successfully the browser to show PDF as well as other kind of files.
So first of all we would like to know if this is a correct pattern.

However we are encountering a very strange problem, which is showing up just with PDF files (PNG or JPEG do not show this problem). It seems that every time a PDF is opened in this way, any Dialog or Hint (on mouse hover) goes 'under' (z-index) the PDF itself.
I am attaching images for showing the effect.
Any suggestion for solving this issue?

Thank you very much
Vincenzo

[Updated on: Fri, 27 December 2013 13:58]

Report message to a moderator

Re: Showing a PDF file with the Browser component [message #1224742 is a reply to message #1224694] Fri, 27 December 2013 17:14 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Vincenzo,

Using a servlet is the preferred way to deliver content.

For the pdf/z-index issue, this is a known problem with PDF in iframes
(see [1] and [2]). I think this was discussed in a bug, but I currently
can't find it.

Regards,
Ralf

[1] http://stackoverflow.com/questions/593176/div-layer-on-top-of-pdf
[2]
http://stackoverflow.com/questions/12911428/z-index-does-not-work-in-ie7-ie8-with-pdf-in-iframe

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Showing a PDF file with the Browser component [message #1225074 is a reply to message #1224742] Sat, 28 December 2013 17:06 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 235
Registered: January 2012
Senior Member

Hi Ralf,
thank you!
The problem is still there with IE 11, all ok instead with FF or Chrome.
It's indeed very annoying and it reach its worst behaviour when the dialog pops up completely under the pdf, so, being modal, the entire application is just frozen!
I tried to remove the pdf before a dialog is showed, but the user experience is so bad and however some error dialog may appear in an unpredictable way.

Is there a way (yes I am aware of the strange question and I know this is not related to RAP) to constrain dialogs to show in a given area/rectangle, so to avoid the overlapping with the browser widget?
Any suggestion is greatly appreciated!
Thank you

Vincenzo
Re: Showing a PDF file with the Browser component [message #1225077 is a reply to message #1224742] Sat, 28 December 2013 17:19 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 235
Registered: January 2012
Senior Member

Other approach:
in RAP would it be possible to change the z-index of the browser widget via CSS, as suggested in
http://stackoverflow.com/questions/11982282/menu-item-is-hiding-behind-iframe-when-iframe-contains-pdf
and
http://stackoverflow.com/questions/12911428/z-index-does-not-work-in-ie7-ie8-with-pdf-in-iframe?rq=1
?
Thank you
Vincenzo
Re: Showing a PDF file with the Browser component [message #1225697 is a reply to message #1225077] Mon, 30 December 2013 14:39 Go to previous message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 235
Registered: January 2012
Senior Member

Hi,
at present, the best solution I found is to show messages in a custom modal shell, without trim and title.
The shell is tied to a given location and size, so to avoid the overlapping with browser widget.
Any comment is greatly appreciated!
Thank you

Vincenzo
Previous Topic:[ANN] RAP 2.2 released
Next Topic:How to improve the performance of the rap app when many widgets are used?
Goto Forum:
  


Current Time: Thu Apr 18 08:17:51 GMT 2024

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

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

Back to the top