aspose file tools*
The moose likes JSF and the fly likes Display the content of PDF file in a JSF Component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Display the content of PDF file in a JSF Component" Watch "Display the content of PDF file in a JSF Component" New topic
Author

Display the content of PDF file in a JSF Component

Ragav Baskaran
Ranch Hand

Joined: Nov 04, 2007
Posts: 36
Hello EveryOne,

I'm new to JSF and My requirement is to display the content of a PDF file in a UIComponent in such a way that, the content shouldn't be selectable by mouse and there shouldn't be any option to save/copy the PDF content.

Is this possible with any existing JSF component ?

Thanks.
Ragav Baskaran
Ranch Hand

Joined: Nov 04, 2007
Posts: 36
I mean do we have any UI component on which we can get an OutputStream to write the byte content ?

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42612
    
  65
The only way to display PDFs on a web page is via a PDF plugin, and then it'll show only the PDF, not the web page.

It's not really possible to convert PDF to HTML.


Ping & DNS - my free Android networking tools app
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

No. There's no PDF in-page plugin for any popular browser I know of and therefore no JSF tag to support one; probably in part because of the Eolas patent that resulted in a half-billion-dollar judgement against Microsoft. In part, probably because a PDF and its associated navigation controls take up so much screen real estate that it's simpler just to give the whole window to the reader.

You'll do better to avoid JSF for the part of webapp that displays PDF's and just output them through a regular servlet.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ragav Baskaran
Ranch Hand

Joined: Nov 04, 2007
Posts: 36
Thanks for your response.

Also i heard that by writing a custom UI Component could "or may" help to display such file contents ?

Not sure if this is possible as i'm new to JSF..

Does it sounds feasible?

Thanks,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42612
    
  65
Does it sounds feasible?

No.
Jerwin Louise Uy
Ranch Hand

Joined: Oct 27, 2007
Posts: 75
You can always delegate the responsibility of rendering byte content in a servlet, however the component can't control the default toolbars when the adobe plugin kicks in.

Simply create a custom component that extends UIOuput and have all the properties of a iframe html where the url of the servlet can be set.



Essentially, we can bind this component on a managed bean and simply pass the attributes to the servlet through the request/session.

I hope this code snippet will be useful though it is just a rough draft of the code.

Regards.
[ August 08, 2008: Message edited by: Jerwin Louise Uy ]

Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation
email: jerwin.uy@incuventure.net
 
jQuery in Action, 2nd edition
 
subject: Display the content of PDF file in a JSF Component