Minimal example with xhtml2pdf is:

        from xhtml2pdf.pisa import CreatePDF
        from tg import render_template (or from tg.render import
render as render_template for TG2.1)

        html = render_template({"param1": value1, "param2": value2},
                                          "genshi", "myapp.templates.page",
                                          doctype=None)

        f = StringIO()
        CreatePDF(StringIO(html), f)
        f.seek(0)
        return f

There is even an example to integrate it as a middleware somewhere if
I'm not wrong.

On Wed, Jun 20, 2012 at 3:08 PM, Timuçin Kızılay
<[email protected]> wrote:
> I need that too.
> maybe a quick example to generate pdf files would be better suited. Not
> convert html to pdf but generating directly to pdf would be better.
>
>
>
> On 20-06-2012 15:58, abc_coder wrote:
>>
>> Hi All
>>
>> I want to convert my web page to pdf, write it to file and allow users
>> to download it for print.
>> But I don't have any idea how do this with current version of tg.
>> I found some examples for xhtml2pdf but I couldn't make it working with
>> my app.
>> The doc for xhtml2pdf are very poor and I had problems with finding any
>> examples.
>>
>> I tried also shell script wkhtmltopdf but it's not working for pages
>> with authentication.
>>
>> Is there any easy way of doing that? how can I get data from genshi
>> template to convert it to pdf?
>>
>> I would be very grateful for giving some good code examples.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to