[reportlab-users] Reportlab under Zope 3

Dinu Gherman gherman at darwin.in-berlin.de
Wed Sep 26 05:52:48 EDT 2007


Andy Robinson:


> On 26/09/2007, Michael A Rowley, MD

> <michael at westmarionfamilymedicine.com> wrote:

>> Hello all,

>>

>> Does anyone know of a Zope project that uses reportlab to produce

>> documents, specifically one that uses the Zope unittest to test the

>> produced pdf files.

>>

> I am not aware of anything.

>

> If you want to test correctness of the generated PDF (e.g. "I expect

> this file to contain 6 pages and the account number text to appear on

> page 6"), we don't actually release our PDF parser as open source, so

> I doubt there are many people actually pulling the files apart and

> verifying the contents in unit tests.


Probably I'm one of those, then! At least sometimes. ;-)

As Marco said, you can do some interesting stuff using pyPDF. I'm
using it in some overview tools of mine, see table below (with my
own code for stuff like the number of images). If you want to
verify the figures, google for the filenames... ;-)

$ fi.py --attrs counter:npages:nimgs:author docs/*
counter npages nimgs author file
0 1 1 Kathrin 377338_010b10807m.pdf
1 1 0 Kathrin 377339_012b10807w.pdf
2 2 0 Kathrin 377340_014b10807m.pdf
3 1 1 Kathrin 377341_018b10807m.pdf
4 2 1 Kathrin 377344_020b10807d.pdf
5 6 5 Kathrin 377345_022b10807d.pdf
6 5 7 Kathrin 377347_028b10807m.pdf
7 8 14 Kathrin 377352_034b10807s.pdf
8 10 0 Kathrin 377359_044b10807e.pdf
9 5 2 Kathrin 377361_054b10807j.pdf
10 6 14 Kathrin 377364_060b10807m.pdf
11 5 5 Kathrin 377365_066b10807s.pdf
12 5 5 Kathrin 377368_072b10807a.pdf
13 1 0 Kathrin 377369_079b10807l.pdf
14 10 6 Kathrin 377371_080b10807e.pdf
15 5 8 Kathrin 377372_092b10807l.pdf
16 6 5 Kathrin 377375_100b10807f.pdf
17 9 4 Kathrin 377376_106b10807l.pdf
18 9 4 Kathrin 377379_106b10807l.pdf
19 9 4 Kathrin 377380_106b10807l.pdf
20 9 4 Kathrin 377383_106b10807l.pdf
21 2 0 Kathrin 377385_116b10807v.pdf
22 4 4 Kathrin 377386_118b10807q.pdf
23 4 4 Kathrin 377388_122b10807e.pdf
24 2 0 Kathrin 377390_126b10807w.pdf
25 8 17 Kathrin 377392_130b10807c.pdf
26 2 2 Kathrin 377393_140b10807k.pdf
137 117 total

Of course, there is even more interesting stuff like extracting
content for verification, etc. I've done this for images. And
even cooler stuff can be done when you analyse the PDF structure.
I'm attaching a short example as illustration (open the .dot file
with GraphViz).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: text1234.dot
Type: application/octet-stream
Size: 1757 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070926/05df5bcf/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text1234.pdf
Type: application/pdf
Size: 6370 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070926/05df5bcf/attachment-0001.pdf>
-------------- next part --------------


All this isn't quite finished, but very promising...

Regards,

Dinu


More information about the reportlab-users mailing list