Hi,
I have a solution for this using wkhtmltopdf.
Firstly, render the template, then create a temporaty file, convert it into
PDF with wkhtmltopdf, and return the PDF content of the generated file
(temporary too) modifying the header list.
...
s = render('myproject:templates/mytemplate.pt',
dict(foo=1, bar=2), request=request)
# "topdf" gets the template, creates the temporary file, calls
"wkhtmltopdf" and returns the pdf content
pdf = topdf(s.encode('utf-8'), page_size='A3', orientation='landscape')
response = Response(pdf)
response.content_type = 'application/pdf'
response.headerlist.append(('Content-Disposition',
'attachment;filename=prueba.pdf'))
Regards,
León Domingo
Ender - Factoría de Software
[email protected] <[email protected]>
Avda. Cerro del Águila, 7. S23 - 2ª Planta
28703 S.S. de los Reyes (MADRID)
Tlf. 902 01 44 01
<http://www.ender.es/>
<http://www.facebook.com/home.php?#%21/pages/San-Sebastian-de-los-Reyes-Spain/Ender-Factoria-de-Software/142213119143359?ref=ts>
* <http://www.ender.es>*
On 6 April 2012 09:17, Ottavio <[email protected]> wrote:
> Il giorno venerdì 6 aprile 2012 08:49:50 UTC+2, malthe ha scritto:
>
>> You can use Chameleon to generate HTML which you'll then give to a PDF
>>
>> formatter such as the CSS3-capable PrinceXML – that's a commercial
>> offering though.
>>
>> An alternative is Apache FOP – that's free, but input is XML, not HTML.
>>
>> \malthe
>>
> what I'm thinking about is more ore less wrapping reportlab or some other
> library in a renderer.
>
> FOP is a java program, I don't have java on my servers...
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pylons-discuss/-/q7bAbZ6ncS8J.
>
> 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/pylons-discuss?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.