[reportlab-users] Reportlab performance

Henning von Bargen H.vonBargen at t-p.com
Mon May 17 03:04:23 EDT 2010


Another idea that came to my mind:

To generate a TOC in a single pass (for most cases),
one could do some more magic with ReportLab.

If you don't need page numbers for those pages
that contain the TOC itself
(and start with page "1" as the first page after the TOC),
you could tweak ReportLab as follows:

1. Generate the content, collecting page references
for the TOC.
2. Generate the TOC (since all page references are
solved, no problem) and mark the TOC pages somehow.
3. In the final step of the PDF creation process, when
the /Pages object is written, just put the TOC pages
before the content pages.

A single pass does not work if a content page contains
a forward reference (but this is not TOC specific).

Henning


More information about the reportlab-users mailing list