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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Gopi, Sreela
Hello,

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


Thank you,
Sreela Gopi


Reply | Threaded
Open this post in threaded view
|

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

Lance Java
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" <[hidden email]> 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
>
>
>
Reply | Threaded
Open this post in threaded view
|

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

Taha Hafeez Siddiqi
In reply to this post by Gopi, Sreela
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 <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]