I am trying to add a TOC to a PDF using the example above. In certain cases (i.e. when there are more than 10 docs added to the master PDF) the TOC can spill on 2 or more pages. In that case the page numbers on the TOC (i.e. First document … 2) are incorrect. The link works correctly, but the number is incorrect. If the TOC is 2 pages long the first document starts on page 3 (not 2).
Attached is my code.
What can I do to correct?