$tmp = ''; foreach ($v['d'] as $section) { $tmp .= $section . "\n\n"; } } else { $tmp = $v['d']; } $tmp = str_replace($s, $r, $tmp); $bits = explode("\n", $tmp); foreach ($bits as $bit) { $data[] = $bit . "\n"; } } } $pdf->ezNewPage(); $pdf->ezStartPageNumbers(500, 28, 10, '', '', 1); $size = 12; $height = $pdf->getFontHeight($size); $textOptions = array('justification' => 'full'); $collecting = 0; $code = ''; foreach ($data as $line) { // go through each line, showing it as required, if it is surrounded by '<>' then // assume that it is a title $line = chop($line); if (strlen($line) && $line[0] == '#') { // comment, or new page request switch ($line) { case '#NP': $pdf->ezNewPage(); break;