// then we have moved onto a new page, bad bad, as the background colour will be on the old one $pdf->transaction('rewind'); $pdf->ezNewPage(); } } break; } } else { // then this is just text // the ezpdf function will take care of all of the wrapping etc. $pdf->ezText($line, $size, $textOptions); } } } } $pdf->ezStopPageNumbers(1, 1); // now add the table of contents, including internal links $pdf->ezInsertMode(1, 1, 'after'); $pdf->ezNewPage(); $pdf->ezText("Contents\n", 26, array('justification' => 'centre')); $xpos = 520; $contents = $pdf->reportContents; foreach ($contents as $k => $v) { switch ($v[2]) { case '1': $y = $pdf->ezText('<c:ilink:toc' . $k . '>' . $v[0] . '</c:ilink><C:dots:1' . $v[1] . '>', 16, array('aright' => $xpos)); // $y=$pdf->ezText($v[0].'<C:dots:1'.$v[1].'>',16,array('aright'=>$xpos)); break; case '2': $pdf->ezText('<c:ilink:toc' . $k . '>' . $v[0] . '</c:ilink><C:dots:2' . $v[1] . '>', 12, array('left' => 50, 'aright' => $xpos)); break;