Added a helper function that calls the most commonly used TCPDF functions to render provided content on the PDF

This commit is contained in:
Mark Nelson 2013-04-11 18:42:23 +08:00
parent 49a04bc7a3
commit ee37ccf7e5

View file

@ -211,6 +211,19 @@ class customcert_element_base {
return false; return false;
} }
/**
* Common behaviour for rendering specified content on the pdf.
*
* @param stdClass $pdf the pdf object
* @param stdClass $content the content to render
*/
public function render_content($pdf, $content) {
$pdf->setFont($this->element->font, '', $this->element->size);
$fontcolour = TCPDF_COLORS::convertHTMLColorToDec($this->element->colour, $fontcolour);
$pdf->SetTextColor($fontcolour['R'], $fontcolour['G'], $fontcolour['B']);
$pdf->writeHTMLCell(0, 0, $this->element->posx, $this->element->posy, $content);
}
/** /**
* Handles deleting any data this element may have introduced. * Handles deleting any data this element may have introduced.
* Can be overriden if more functionality is needed. * Can be overriden if more functionality is needed.