/** * Create PDF object using parameters * * @return PDF */ protected function create_pdf_object() { //Default orientation is Landescape $orientation = 'L'; if ($this->get_instance()->height > $this->get_instance()->width) { $orientation = 'P'; } // Remove commas to avoid a bug in TCPDF where a string containing a commas will result in two strings. $keywords = get_string('keywords', 'simplecertificate') . ',' . format_string($this->get_instance()->coursename, true); $keywords = str_replace(",", " ", $keywords); // Replace commas with spaces. $keywords = str_replace(" ", " ", $keywords); // Replace two spaces with one. $pdf = new pdf($orientation, 'mm', array($this->get_instance()->width, $this->get_instance()->height), true, 'UTF-8'); $pdf->SetTitle($this->get_instance()->name); $pdf->SetSubject($this->get_instance()->name . ' - ' . $this->get_instance()->coursename); $pdf->SetKeywords($keywords); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetAutoPageBreak(false, 0); $pdf->setFontSubsetting(true); $pdf->SetMargins(0, 0, 0, true); return $pdf; }