You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Gopi, Sreela" <sr...@atos.net> on 2017/03/07 08:46:52 UTC

How to open a pdf file on click of an action link

Hello,

   Can anyone please tell me how to open a pdf file on click of an action link in Tapestry?


Thank you,
Sreela Gopi



Re: How to open a pdf file on click of an action link

Posted by Lance Java <la...@googlemail.com>.
You'll need to set:
response.setHeader("Content-Disposition", "attachment; filename=" +
fileName);

See StreamResponse usage in PDFLink.onPdf() here
http://t5stitch-lazan.rhcloud.com/pdflinkdemo

On 7 Mar 2017 08:47, "Gopi, Sreela" <sr...@atos.net> wrote:

> Hello,
>
>    Can anyone please tell me how to open a pdf file on click of an action
> link in Tapestry?
>
>
> Thank you,
> Sreela Gopi
>
>
>

Re: How to open a pdf file on click of an action link

Posted by Taha Hafeez <ta...@gmail.com>.
Hi,

There are many examples available. Here is one such nicely written component !

https://github.com/uklance/tapestry-stitch/blob/master/tapestry-stitch/src/main/java/org/lazan/t5/stitch/components/PDFLink.java

In short, return StreamResponse from an event handler. Don’t forget to set content-type and content-disposition.

Regards
Taha

> On 7 Mar 2017, at 14:16, Gopi, Sreela <sr...@atos.net> wrote:
> 
> Hello,
> 
>   Can anyone please tell me how to open a pdf file on click of an action link in Tapestry?
> 
> 
> Thank you,
> Sreela Gopi
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org