tags:

views:

733

answers:

2

Hi

I am using the dompdf library of php to generate PDF report from an HTML template. In that html template there is a section table of contents. When genrating PDF i need to update the page number of table of contents. Does anyone know how I can achieve this in dompdf library of php?

Thanks in advance.

A: 

You may have solved this already? I've not used dompdf, but i did a similar thing in Zend_Pdf: I made a blank page for the table of contents and then went on creating all the other later pages, keeping an array of page_number => title. At the end I went back and updated the contents page using the reference saved earlier...

Steve
A: 

Generating a Table of Contents from HTML (with h1,h2,h3), I did the following:

  • First give every header an unique ID (because we are using PrinceXML) and is a good pratice.
  • Then create an OL/LI structure of it, although that piece of code can contain bugs.

See: http://pastie.org/655728

Michiel