Displaying PDF , Richfaces - jsf

How can I display a PDF document on a rich:popupPanel. I am trying to display PDF document in a popup from a view scoped JSF page.
Issue faced : Parent page stops working when I click on the h:commandLink which fires a new view to display the PDF

The simplest way I know is to use HTML directly. You can use IFRAME or OBJECT.
So just put something like this in your rich:popupPanel:
<rich:panel>
<iframe src="path_to_your_file/sample.pdf"
class="pdfFrame" width="800" height="1000" scrolling="no" />
</rich:panel>
I don't think there's a way to do this with pure JSF tags. The same way is presented on PrimeFaces's showcase:
<h3>PDF</h3>
<object type="application/pdf"
data="/showcase/resources/demo/media/guide.pdf?pfdrid_c=true"
height="300px" width="100%" internalinstanceid="3">
Your browser can't display pdf,
click
to download pdf instead.
</object>

Related

How to get clickable HREF tags in SVG image within Sharepoint Online Modern Pages

I want clickable regions on SVG image displayed on Sharepoint Modern Pages. The image itself renders well, however links are not rendered at all.
The SVG file itself is embedded using Markdown. ![Click for Map](https://dummy.sharepoint.com/sites/LL/SiteAssets/Map.svg)
<svg id="Layer_3" data-name="Layer 3" xmlns="http://www.w3.org/2000/svg" width="517.52" height="238.48" viewBox="0 0 517.52 238.48">
<path id="Dash1" d="M145.3,159.9l-5.11,15.84a12.13,12.13,0,0,1-10.54,8.36v0h92.42l-7.7-24.25Z"/>
</svg>
The SVG file rendered in Chrome allows to click on the image and opens the link. The same file embedded in Sharepoint does not serve the link.
When you load SVG as an image, in this case via the <img> tag it is not interactive. This is a general rule and is not Sharepoint specific.
SVG used as an image has the same capabilities as raster images so that they can be used in the same situations without needing to specially consider their security and privacy implications.
You can use image map to make clickable href in a img tag like this:
<img src="https://www.fnordware.com/superpng/pnggrad16rgb.png" usemap="#image-map">
<map name="image-map">
<area target="_blank" alt="bing" title="bing" href="https://www.bing.com" coords="37,35,363,104" shape="rect">
<area target="_blank" alt="Google" title="" href="https://www.google.com" coords="41,163,365,225" shape="rect">
<area target="_blank" alt="facebook" title="https://www.facebook.com" href="" coords="43,275,365,351" shape="rect">
</map>
For Modern Page, you could add the code snippet above via Modern Script Editor Web Part:
Add The Script Editor Webpart back to SharePoint Modern Experience
Reference:
How to Make image Map and use in SharePoint Online/2016/2013

Is there a inbuilt tag in JSF 2.0 that can support Application/PDF content Type

I'm performing a F:AJAX call where I receive a byte Stream output whose content type is application PDF. I want this bytestream to be loaded in a JSF equivalent tag which should make me specify the content type as "Application/PDF" during tag declaration. Also, f:View fails saying content type not supported. Any JSF specific tags to cater this. Thanks.
Use iframe tag. This line shows how to use it:
<iframe src="foo.pdf" width="600" height="400" scrolling="no"></iframe>
If you also want to hide the (default) border, add frameBorder="0".
There is also pdf.js library that allows to browse pdf in browser. https://blog.oio.de/2014/04/11/integrating-pdf-js-pdf-viewer-web-application/
The answer is no there isn't such a tag.
To be honest there's no need to change it, since using HTML for this is fine and really the simplest way. You can use IFRAME (like Jay Smith shows you) or OBJECT.
The same way is presented on PrimeFaces's showcase:
<h3>PDF</h3>
<object type="application/pdf"
data="/showcase/resources/demo/media/guide.pdf?pfdrid_c=true"
height="300px" width="100%" internalinstanceid="3">
Your browser can't display pdf,
click
to download pdf instead.
</object>

object pdf type is not render in mozilla and chrome

Im doing a document searching system, that shows a list of pdf like response, I´m working with primefaces 5
this is my code
<h:outputLink value="file/#{document.pdfPath}" target="_blank" >view document</h:outputLink>
<div id="pdf2">
<object data='file/#{document.pdfPath}'
type='application/pdf'
width='700px'
height='400px'>
<p>It appears your Web browser is not configured to display PDF files.
No worries, just <a href='file/#{document.pdfPath}'>click here to download the PDF file.</a></p>
</object>
<div id="pdf">
<object data="http://www.gnu.org/software/hello/manual/hello.pdf" type="application/pdf" width="450" height="375"></object>
</div>
But this is the problem in eclipse and IE browser runs perfect,but in chorme and mozilla only show the pdf that doesn´t come from a managed bean.
it is what I´m watching
With chrome
With mozilla
and finally Internet explorer (works perfect here)
Here, from your response headers:
Content-Disposition: attachment; filename="contratotest.pdf"
Your /file servlet is serving the PDF as an attachment. This is intented for the "Save As" dialogue thing. If you intend to display the content inline in the web page instead of as an attachment of the web page, then you need to set it to inline.
response.setHeader("Content-Disposition", "inline");
Or just remove it entirely. It's the default already. You may only need to add an extra parameter to the fallback link to force attachment anyway when clicked.

How to open a modal aspx page from the devexpress aspxpopupcontrol

I have a button which should open a web form from my project in a modal window. How can I achieve that with the devexpress popup control?
Use the Popup Control - Content URL to show another webform in the control. open popup on the button's client click event.
example:
<dx:ASPxPopupControl ID="popup" runat="server" ContentUrl="~/ContentPageWithTextBox.aspx"
Top="100" ClientInstanceName="clientPopup" CloseAction="CloseButton">
<ClientSideEvents Shown="OnShown" />
</dx:ASPxPopupControl>
Check this search Result
Reference:
How to manipulate client-side objects within a ASPxPopupControl with the specified ContentUrl - check example also.
Hope this help...
Here is sample code:
<input id="openBtn" type="button" value="Open popup"
onclick="myPopup.SetContentUrl('http://www.google.com');myPopup.Show();" />
<dx:ASPxPopupControl runat="server" ClientInstanceName="myPopup" Modal="True"
CloseAction="CloseButton" Width="500px" Height="400px"/>
ASPxClientPopupControl members
ASPxPopupControl members
See ASPxPopupControl Online Demos and the Code Central Examples to learn more on how accomplish this task.

IceFaces: inputRichText save on submit not working in IE?

I'm having problems with an ice:inputRichText component and saveOnsubmit in IE. When the form containing the input is submitted, I only get the original text and not any of the changes the user has made.
This is the code I use for displaying the input component:
<ice:inputRichText height="250" toolbar="Transfer" customConfigPath="/FCKconfig.js" id="messageBody" value="#{InvitationPageBean.messageBody}" language="sv" saveOnSubmit="true" />
I'm using IceFaces 1.8.2.
In other browsers, for example Firefox 3.6 and Safari 5, it all works as expected.
Any ideas?
Thanks!
the save, should do it in a .java
and in the xhtml is:
<ice:inputRichText
customConfigPath="/js/Config.js"
toolbar="Mail"
height="275"
width="600px"
value="#inputRichTextBean.value}"
skin="silver"
language="#inputRichTextBean.lang}"
valueChangeListener="#{inputRichTextBean.changeSave}"
/>

Resources