jasper reports - Create an external URL hyperlink with JasperReports -
how include hyperlink (url) in pdf links external site?
using simple string "http://www.stackoverflow.com", link automatically generated. but, how can use url <a href="http://www.stackoverflow.com">click here</a>
?
if use html string, jaspers create link shows code.
using jasperreports 4.0.4 , ireport 4.5.1.
to make textfield hyperlink external url, need add attribute hyperlinktype="reference"
element, , add <hyperlinkreferenceexpression>
tag within it. reference expression put url.
for example:
<textfield hyperlinktype="reference" hyperlinktarget="blank"> <reportelement x="5" y="5" width="200" height="15"/> <textelement/> <textfieldexpression class="java.lang.string"><![cdata["click here!"]]></textfieldexpression> <hyperlinkreferenceexpression><![cdata["http://www.google.com"]]></hyperlinkreferenceexpression> </textfield>
the hyperlinktarget
attribute behaves in same way target
attribute in html.
note textfields, images , charts can hyperlinked in way.
for more in-depth explanation , more examples, see this jasperforge page.
Comments
Post a Comment