Jump to content
We've recently updated our Privacy Statement, available here ×

How to configure a hyperlink from a PDF generated after a JSF response?


edilmaralves

Recommended Posts

Hi,

My webapp is JSF2.2 running into PayaraServer4.

I use this code to generate a PDF file from my JSF page:

byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters,                                               new JRBeanCollectionDataSource(list));response.setContentType("application/pdf");response.setContentLength(bytes.length);ServletOutputStream ouputStream = response.getOutputStream();ouputStream.write(bytes, 0, bytes.length);ouputStream.flush();ouputStream.close();[/code]

but links dont work, into Firefox or Chrome builtin viewers or external program viewers if I save the PDF as a file.

This is the jasper code:

<textField pattern="" isBlankWhenNull="true" hyperlinkType="Reference" hyperlinkTarget="Blank">    <reportElement key="textField-12" style="FonteGeral" positionType="Float" mode="Opaque"                    x="2" y="1" width="40" height="9" isPrintWhenDetailOverflows="true"                    forecolor="#000000" backcolor="#FFFFFF"                    uuid="9dc88c77-3ac9-4dec-99d7-bfc392d18f75"/>    <box>        <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>        <bottomPen lineWidth="0.0" lineColor="#000000"/>        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>    </box>    <textElement textAlignment="Left" verticalAlignment="Top" rotation="None">        <font fontName="Times New Roman" size="7"/>        <paragraph lineSpacing="Single"/>    </textElement>    <textFieldExpression><![CDATA[$F{numConhec}]]></textFieldExpression>    <anchorNameExpression><![CDATA["Test Site"]]></anchorNameExpression>    <hyperlinkReferenceExpression>        <![CDATA["https://www.intersite.com.br"]]>    </hyperlinkReferenceExpression></textField>[/code]
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...