[reportlab-users] Can I build a PDF from a template - small freelance job?

David Heath david at davidheath.org
Thu Feb 12 08:09:30 EST 2009


On 2/10/09, David Heath <david at davidheath.org> wrote:

>> some .pdf file called fw2.pdf is merged into the current document and

>> then gets something drawn on top. I doubt that there is an out of the

>> box solution which pulls up .pdf back to the same level as RML and let

>> you change it, but for me the mergePage solved all my templating

>> business, as far as graphics or or letterhead or other prefabbed pdf

>> stuff goes.

>

> Great, that sounds like it would do the job. I just need a 'decorative

> background' above which I'll add additional content.


Due to time pressures, I don't have time to work on this. Are there
any experienced reportlab hackers on this list who would be willing to
do this as a small freelance job?

The requirements are to produce a python script. The script would
generate a single-page PDF file used as a postal address wrapper.

The script will be given as input a PDF 'template' file plus a plain
text JSON of the following structure:

{
"from": "Gordon Brown, 10 Downing Street, London W1A 1AA, UK",
"locale": "us",
"to": ["Daniel Jackson", "124 Pleasant St", "Portsmouth", "Hants", "UK"]
}

locale is either 'us' or 'uk'. For US a US-letter size page should be
produced, for UK an A4 page should be produced (this may be determined
instead by the input template file).

The script will combine the 'template' file and add to it the from and
to addresses. I can envisage several possible levels of functionality:

1. in the most basic version, the sender and recipient addresses would
be positioned on the page in fixed known positions. This is the least
desirable of the three options, but ok if nothing else is possible.
2. in a more sophisticated version, the positioning, bounding box,
font size (size, weight, typeface) of the sender and recipient
addresses would be supplied as input data in the JSON data structure
3. in the most sophisticated version, the positioning of the sender
and recipient addresses would be determined by specially tagged
elements or placeholders in the PDF template which would indicate the
position, font style and bounding box of the elements.

I don't know if (3) is possible at all with reportlab.

If you're interested please contact me privately to discuss.

Thanks

David Heath
david at davidheath.org


More information about the reportlab-users mailing list