switch ($line[0]) { case '1': $tmp = substr($line, 2, strlen($line) - 3); $tmp2 = $tmp . '<C:rf:1' . rawurlencode($tmp) . '>'; $pdf->ezText($tmp2, 26, array('justification' => 'centre')); break; default: $tmp = substr($line, 2, strlen($line) - 3); // add a grey bar, highlighting the change $tmp2 = $tmp . '<C:rf:2' . rawurlencode($tmp) . '>'; $pdf->transaction('start'); $ok = 0; while (!$ok) { $thisPageNum = $pdf->ezPageCount; $pdf->saveState(); $pdf->setColor(0.9, 0.9, 0.9); $pdf->filledRectangle($pdf->ez['leftMargin'], $pdf->y - $pdf->getFontHeight(18) + $pdf->getFontDecender(18), $pdf->ez['pageWidth'] - $pdf->ez['leftMargin'] - $pdf->ez['rightMargin'], $pdf->getFontHeight(18)); $pdf->restoreState(); $pdf->ezText($tmp2, 18, array('justification' => 'left')); if ($pdf->ezPageCount == $thisPageNum) { $pdf->transaction('commit'); $ok = 1; } else { // 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 {