SetFont('helvetica', 'B', 15); $this->Cell(0, 15, $header_text, 0, false, 'C', 0, '', 0, false, 'M', 'B'); } } // Page footer public function Footer() { //nothing here for now } } //create new PDF //$pdf = new MyTCPDF(); $pdf = new MYPDF("L", PDF_UNIT, "Letter", true, 'UTF-8', false); $pdf->SetFont('helvetica', '', $font_size); $pdf->SetTitle('SLAA NEI Meeting List'); $pdf->SetMargins($margin_size, $margin_size, $margin_size, true); $pdf->SetAutoPageBreak(TRUE, $margin_size); $pdf->AddPage(); $this_column = ""; $current_day = ""; //$this_column .= $header_text; $this_column .= $intro_text; foreach ($meetings as $meeting){ if($meeting['formatted_day'] !== $current_day){ $current_day = $meeting['formatted_day']; //$pdf->Write(0, '------ ' . $current_day . ' -------', '', 0, 'L', true, 0, false, false, 0); $this_column .= "
========" . $current_day . "========
" ; }else{ //add the divider $this_column .= "
--------------------------
" ; } //add this meeting text to column text $this_column .= $meeting['text'] ; } //add outtro html to column text $this_column .= $outtro_text; //setup coluns and write html $pdf->resetColumns(); $pdf->setEqualColumns($number_of_columns, $column_width); $pdf->selectColumn(); $pdf->writeHTML($this_column, true, false, true, false, 'J'); // seems to make php happy: ob_end_clean(); $pdf->Output('meeting_list.pdf', 'I'); exit; });