From ee37ccf7e564b21928102165574f59e449b893da Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 11 Apr 2013 18:42:23 +0800 Subject: [PATCH] Added a helper function that calls the most commonly used TCPDF functions to render provided content on the PDF --- elements/element.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/elements/element.class.php b/elements/element.class.php index 5e65d7e..9b464e2 100644 --- a/elements/element.class.php +++ b/elements/element.class.php @@ -211,6 +211,19 @@ class customcert_element_base { 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. * Can be overriden if more functionality is needed.