Hi all,
I don't think there's an established Opal 'generate PDFs' option at the moment.
Optimising print layout/css so that a human doing print or print->save-as-pdf gets something sensible is something that definitely works, but it depends on what your users need obviously.
Every time I've ever implemented PDF-based report generation for e.g. non-Opal projects, it's been a massive pain to maintain...
A bit like fancy HTML emails!
The
Django docs suggest using reportlab, which looks like it hooks quite nicely into Django views.
I think it depends a lot on how complicated your output document is going to be.
In general, when we have users who want PDF documents I encourage them to consider other options - although that's not always possible :)
We are planning to look more closely at generating data-centric reports in the next few months in a project for one of the hospitals we work with.
That should end up with:
- An interface for user-specified report formats e.g. which fields, columns etc for data extracts, producing a single merged csv file
- An API for programmer defined complex reports, which would enable things like fields which are the result of computations (end date - start date for instance)
We have some mockups of the extract interface and have had some very high level discussions about potential report APIs, but would be v. interested if you've seen particularly good report building APIs elsewhere for us to take a look at for inspiration.
(I've only ever seen APIs I'm not keen on to be honest !)
Hope that helps !