Table of Contents

class pdfpug.modules.TableOfContents(**kwargs)

The TableOfContents element automatically searches the entire document for tier h1 and h2 headers and compiles the overall structure of the document. One needs to only add the table of contents element to the PdfReport class using the add_element() function.

>>> from pdfpug.modules import TableOfContents, Header
>>> from pdfpug import PdfReport
>>> toc = TableOfContents()
>>> report = PdfReport()
>>> report.add_element(toc)
>>> report.add_element(Header('PdfPug'))
>>> report.generate_pdf('pdfpug.pdf')