All the PDF libraries for Perl seem a bit barbaric — stuck in the 1980’s. You have to specify PostScript points to do layout. Java has JasperReports, Ruby has Prawn, and Python has ReportLab. Is there a non-extinct library/module that will let me make a nice looking PDF in less than a week of coding? (I’m a little frustrated by PDF::API2, PDF::Table, etc.) I don’t want to generate HTML and convert it. Perl is ideal for reporting, but the main report file format is not available in a usable way. What libraries do people use?
I need:
- tables
- charts (Images)
- color
- formatting (ideally automatic, not pixel by pixel)
- headers / footers
I’m slightly open to wrapping external (non-Perl) open source tools, if absolutely needed. But not really interested in a major Java server approach. For the bounty, I want a pure Perl approach, since I want to run this on a server that I can’t add more than modules to. If you have a public example that works well, please point me to it.
If LaTeX is too big, perhaps one could use
Inline::Pythonto wrap ReportLab, that everyone seems to like so much (I haven’t used it and am not too proficient at Python).Edit 3:
Here is Edit 2, except split into a modular style, if people like it (and if it is an kind of robust) perhaps I can publish to CPAN. For now place the
.pmfile in a file structure likeInline/Python/ReportLab.pmsomewhere in your@INC(the script’s own base directory is usually in@INC).Then a script could be something like:
Edit 2:
While Edit 1 is still of interest, it seems (tell me if I am incorrect!) that I have figured out how to create an instance of ‘Canvas’ and expose its methods directly:
Edit 2/3: This portion is left as an example of a more manual interface. I think Edits 2/3 give a better interface which leaves the heavy lifting to the original Python class without (too much) wrapping.
Edit 1: I have now exposed some of the functionality by manually hacking in the methods. This means that for every method one wants to use, a wrapper method must be added. While this is already a feasible solution, I wonder if there isn’t some easier way to expose the entire python ‘canvas’ class, but for now this is where I am: