2011/9/18 León Domingo <[email protected]> > Hi, > I've created a little function that makes use of wkhtmltopdf (http:// > code.google.com/p/wkhtmltopdf/) to get PDF content from HTML content. > > I would like to use some controllers to get a PDF version of the HTML > content defined in the corresponding template. > > I've been making some experiments with a middleware class. > > It works but I need something to know if I have to make the > translation or not > > and I don't know how I can "mark" the response to do so. In the other > hand, I don't know if this is the right way to do that. >
We are using xhtml2pdf in our project; it had a WSGI Middleware already, that looks for 'pisa.topdf' in request environ; if present, it translates html to pdf and also sets the default filename. In the controller, if the response would be ok, I do request.environ["pisa.topdf"] = "filename.pdf" In my opinion this is exactly the "wrong thing to do", talking to middleware using environ, or even talking at all... but it works. -- 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.

