views:

1052

answers:

3

I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus.

I did read through this question, but I really don't need a report generator and most of the responses there seemed like real overkill for what I'm trying to do. (I don't need templates or LaTeX-grade layout control.)

+1  A: 

I think going through Latex is the easiest way, and not overkill at all. Generating a working PDF file is quite a difficult activity, whereas generating a Tex source is much easier. Any other typesetting change would probably work as well, such as going through reStructuredText or troff.

Martin v. Löwis
+5  A: 

For one of my projects, I have tested and/or implemented probably six or seven different methods of going from an image to a PDF in the last six months. Ultimately I ended up coming back to ReportLab (which I had initially avoided for reasons similar to those you described) because all of the others had glaring limitations or outright omissions (such as the inability to set document metadata).

ReportLab isn't as difficult to handle as it appears at first glance and it may save you a lot of headache-laden refactoring later on. I would strongly suggest you go ahead and use it and therefore know that if you ever want to be able to do more you will have the ability too rather than do what I did and bounce back and forth between a number of different utilities, libraries, and formats.

EDIT:

It is also worth mentioning that you can bypass the Platypus layout system that comes with ReportLab if all you want to do is put bit a of text and imagery on a page.

bouvard
Seconded, ReportLab is fine. It's a little old-fashioned and crufty in some of its interfaces, but it's covered everything we've ever needed from it and never fallen over.
bobince
Thirded? A "report" with just some text and images on it is very simple to layout. Also getting to the canvas and drawing lines is pretty simple too.
Sam Corder
Wow, after some tinkering, ReportLab is exactly what I was looking for. Thanks!
Electrons_Ahoy
A: 

Is the reportlab code not ok? The reason why using LaTeX might not be overkill is because pdf is a really low-level format. In pdf you do not get line-breaks automatically, you have to calculate line-widths yourself.

Stephan Eggermont