0

I have three ways to create a TOC with DOMPDF, and don't know which to choose ..

The Problem: You know the Page numbers after rendering, but want the TOC in advance of the document.

All three methods use inline PHP to write the content in a global array

  1. After creating the PDF with DOMPDF, create a second PDF with the TOC and merge them, using FPFI

    • FPDI could reduce some styling
  2. After creating the PDF with DOMPDF, and remembering the Contents, generate the PDF a second Time with the TOC, adjusting the Page numbers

    • Dont repeat yourself
    • Consistent Environment
  3. Use a Placeholder for the TOC and fill it after rendering the PDF

    • Don't know if its working

Any Experts in DOMPDF have a favourite solution ?

Wolfgang

Wolfgang Blessen
  • 900
  • 10
  • 29
  • 1
    [Method three works pretty well](http://eclecticgeek.com/dompdf/debug.php?identifier=41aafc153b4d3e640407bec20c77a9ec), with caveats: 1) the TOC can only be one page; 2) you can't link the TOC entries to the appropriate pages. – BrianS May 10 '13 at 14:29
  • Did you ever solve this? I'm wondering the same thing myself. – Duffy Dolan Oct 11 '13 at 13:59
  • @DuffyDolan Not yet, but I will continue working on it in the end of the year. – Wolfgang Blessen Oct 12 '13 at 08:04
  • Thanks for the update @WolfgangBlessen. I'm going to keep at it too. There needs to be a good solution to this common problem. – Duffy Dolan Oct 12 '13 at 13:00

0 Answers0