You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nathan Beemer <be...@ksu.edu> on 2009/08/14 21:48:27 UTC

Render Page to file, etc

I have a need to make my Tapestry 4.1 Pages available in pdf format but
having no luck to-date on my own.
My apologies if soliciting this list is inappropriate here, but I do have a
consulting budget available to get this done if anyone is interested.

Re: Render Page to file, etc

Posted by Nathan Beemer <be...@ksu.edu>.
#1 is the real trick. The way I finally got a working implementation was to
simply establish an HttpSession to Tapestry to call up the Page requested.
Basically mimicing a web browser. I can then capture the OutputStream that
way and convert to String, etc for rendering to pdf.

There's extra overhead, plus special account handling for this "worker"
session since the Tapestry application is user restricted, but it works.

Time permitting, I'll investigate the blog you reference since it might be a
cleaner solution.

Thanks for the pointers!


On Mon, Aug 24, 2009 at 3:26 PM, Andreas Andreou <an...@di.uoa.gr> wrote:

> The process should be:
> 1) render the page to a String, perhaps
> http://www.behindthesite.com/blog/C1931765677/E2094832857/index.html can
> help
>
> 2) convert the html String to pdf, see
> http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html and/or
>
> http://codedeliver.blogspot.com/2009/07/converting-xhtml-html-to-pdf-with-css.html
>
> So, it's possible to create a Tapestry service that will do the above
> and write the pdf
> to the output stream... or, perhaps even better, write a ServletFilter
> that swaps the
> response stream with its own, forwards to the Tapestry servlet and
> when that returns
> does the post-processing (of converting the contents of its internal
> stream from html to
> pdf)
>
>
> On Mon, Aug 24, 2009 at 10:19 PM, Andreas Andreou<an...@di.uoa.gr>
> wrote:
> > The process should be:
> > 1
> >
> > On Fri, Aug 14, 2009 at 10:48 PM, Nathan Beemer<be...@ksu.edu> wrote:
> >> I have a need to make my Tapestry 4.1 Pages available in pdf format but
> >> having no luck to-date on my own.
> >> My apologies if soliciting this list is inappropriate here, but I do
> have a
> >> consulting budget available to get this done if anyone is interested.
> >>
> >
> >
> >
> > --
> > Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> > Tapestry / Tacos developer
> > Open Source / JEE Consulting
> >
>
>
>
> --
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Render Page to file, etc

Posted by Nathan Beemer <na...@gmail.com>.
i'm using pd4ml with no complaints.

not to say there aren't other libraries just as good if not better


On Sep 17, 2009, at 11:28 PM, Andreas Andreou wrote:

> great! So, since you went all the way, which tool / library you
> suggest to convert html to pdf ?
>
> On Fri, Sep 18, 2009 at 3:46 AM, Nathan Beemer <nathan.beemer@gmail.com 
> > wrote:
>> your suggestion to use servlet Filter was just what I needed...  
>> page pdf
>> render now working
>>
>> many thanks!
>>
>>
>> On Aug 24, 2009, at 2:26 PM, Andreas Andreou wrote:
>>
>>> The process should be:
>>> 1) render the page to a String, perhaps
>>> http://www.behindthesite.com/blog/C1931765677/E2094832857/ 
>>> index.html can
>>> help
>>>
>>> 2) convert the html String to pdf, see
>>> http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html  
>>> and/or
>>>
>>> http://codedeliver.blogspot.com/2009/07/converting-xhtml-html-to-pdf-with-css.html
>>>
>>> So, it's possible to create a Tapestry service that will do the  
>>> above
>>> and write the pdf
>>> to the output stream... or, perhaps even better, write a  
>>> ServletFilter
>>> that swaps the
>>> response stream with its own, forwards to the Tapestry servlet and
>>> when that returns
>>> does the post-processing (of converting the contents of its internal
>>> stream from html to
>>> pdf)
>>>
>>>
>>> On Mon, Aug 24, 2009 at 10:19 PM, Andreas Andreou<an...@di.uoa.gr>
>>> wrote:
>>>>
>>>> The process should be:
>>>> 1
>>>>
>>>> On Fri, Aug 14, 2009 at 10:48 PM, Nathan Beemer<be...@ksu.edu>  
>>>> wrote:
>>>>>
>>>>> I have a need to make my Tapestry 4.1 Pages available in pdf  
>>>>> format but
>>>>> having no luck to-date on my own.
>>>>> My apologies if soliciting this list is inappropriate here, but  
>>>>> I do
>>>>> have a
>>>>> consulting budget available to get this done if anyone is  
>>>>> interested.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>>>> Tapestry / Tacos developer
>>>> Open Source / JEE Consulting
>>>>
>>>
>>>
>>>
>>> --
>>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>>> Tapestry / Tacos developer
>>> Open Source / JEE Consulting
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> -- 
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


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


Re: Render Page to file, etc

Posted by Andreas Andreou <an...@di.uoa.gr>.
great! So, since you went all the way, which tool / library you
suggest to convert html to pdf ?

On Fri, Sep 18, 2009 at 3:46 AM, Nathan Beemer <na...@gmail.com> wrote:
> your suggestion to use servlet Filter was just what I needed... page pdf
> render now working
>
> many thanks!
>
>
> On Aug 24, 2009, at 2:26 PM, Andreas Andreou wrote:
>
>> The process should be:
>> 1) render the page to a String, perhaps
>> http://www.behindthesite.com/blog/C1931765677/E2094832857/index.html can
>> help
>>
>> 2) convert the html String to pdf, see
>> http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html and/or
>>
>> http://codedeliver.blogspot.com/2009/07/converting-xhtml-html-to-pdf-with-css.html
>>
>> So, it's possible to create a Tapestry service that will do the above
>> and write the pdf
>> to the output stream... or, perhaps even better, write a ServletFilter
>> that swaps the
>> response stream with its own, forwards to the Tapestry servlet and
>> when that returns
>> does the post-processing (of converting the contents of its internal
>> stream from html to
>> pdf)
>>
>>
>> On Mon, Aug 24, 2009 at 10:19 PM, Andreas Andreou<an...@di.uoa.gr>
>> wrote:
>>>
>>> The process should be:
>>> 1
>>>
>>> On Fri, Aug 14, 2009 at 10:48 PM, Nathan Beemer<be...@ksu.edu> wrote:
>>>>
>>>> I have a need to make my Tapestry 4.1 Pages available in pdf format but
>>>> having no luck to-date on my own.
>>>> My apologies if soliciting this list is inappropriate here, but I do
>>>> have a
>>>> consulting budget available to get this done if anyone is interested.
>>>>
>>>
>>>
>>>
>>> --
>>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>>> Tapestry / Tacos developer
>>> Open Source / JEE Consulting
>>>
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Tapestry / Tacos developer
>> Open Source / JEE Consulting
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


Re: Render Page to file, etc

Posted by Nathan Beemer <na...@gmail.com>.
your suggestion to use servlet Filter was just what I needed... page  
pdf render now working

many thanks!


On Aug 24, 2009, at 2:26 PM, Andreas Andreou wrote:

> The process should be:
> 1) render the page to a String, perhaps
> http://www.behindthesite.com/blog/C1931765677/E2094832857/index.html  
> can help
>
> 2) convert the html String to pdf, see
> http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html and/or
> http://codedeliver.blogspot.com/2009/07/converting-xhtml-html-to-pdf-with-css.html
>
> So, it's possible to create a Tapestry service that will do the above
> and write the pdf
> to the output stream... or, perhaps even better, write a ServletFilter
> that swaps the
> response stream with its own, forwards to the Tapestry servlet and
> when that returns
> does the post-processing (of converting the contents of its internal
> stream from html to
> pdf)
>
>
> On Mon, Aug 24, 2009 at 10:19 PM, Andreas Andreou<an...@di.uoa.gr>  
> wrote:
>> The process should be:
>> 1
>>
>> On Fri, Aug 14, 2009 at 10:48 PM, Nathan Beemer<be...@ksu.edu>  
>> wrote:
>>> I have a need to make my Tapestry 4.1 Pages available in pdf  
>>> format but
>>> having no luck to-date on my own.
>>> My apologies if soliciting this list is inappropriate here, but I  
>>> do have a
>>> consulting budget available to get this done if anyone is  
>>> interested.
>>>
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Tapestry / Tacos developer
>> Open Source / JEE Consulting
>>
>
>
>
> -- 
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


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


Re: Render Page to file, etc

Posted by Andreas Andreou <an...@di.uoa.gr>.
The process should be:
1) render the page to a String, perhaps
http://www.behindthesite.com/blog/C1931765677/E2094832857/index.html can help

2) convert the html String to pdf, see
http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html and/or
http://codedeliver.blogspot.com/2009/07/converting-xhtml-html-to-pdf-with-css.html

So, it's possible to create a Tapestry service that will do the above
and write the pdf
to the output stream... or, perhaps even better, write a ServletFilter
that swaps the
response stream with its own, forwards to the Tapestry servlet and
when that returns
does the post-processing (of converting the contents of its internal
stream from html to
pdf)


On Mon, Aug 24, 2009 at 10:19 PM, Andreas Andreou<an...@di.uoa.gr> wrote:
> The process should be:
> 1
>
> On Fri, Aug 14, 2009 at 10:48 PM, Nathan Beemer<be...@ksu.edu> wrote:
>> I have a need to make my Tapestry 4.1 Pages available in pdf format but
>> having no luck to-date on my own.
>> My apologies if soliciting this list is inappropriate here, but I do have a
>> consulting budget available to get this done if anyone is interested.
>>
>
>
>
> --
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


Re: Render Page to file, etc

Posted by Andreas Andreou <an...@di.uoa.gr>.
The process should be:
1

On Fri, Aug 14, 2009 at 10:48 PM, Nathan Beemer<be...@ksu.edu> wrote:
> I have a need to make my Tapestry 4.1 Pages available in pdf format but
> having no luck to-date on my own.
> My apologies if soliciting this list is inappropriate here, but I do have a
> consulting budget available to get this done if anyone is interested.
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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