$sigy = 580; $custx = 88; $custy = 580; $wmarkx = 78; $wmarky = 130; $wmarkw = 450; $wmarkh = 480; $brdrx = 10; $brdry = 10; $brdrw = 594; $brdrh = 771; $codey = 660; } // Add images and lines print_border($pdf, $certificate, $brdrx, $brdry, $brdrw, $brdrh); draw_frame_letter($pdf, $certificate); // Set alpha to semi-transparency $pdf->SetAlpha(0.1); print_watermark($pdf, $certificate, $wmarkx, $wmarky, $wmarkw, $wmarkh); $pdf->SetAlpha(1); print_seal($pdf, $certificate, $sealx, $sealy, '', ''); print_signature($pdf, $certificate, $sigx, $sigy, '', ''); // Add text $pdf->SetTextColor(0, 0, 120); cert_printtext($pdf, $x, $y, 'C', 'freesans', '', 30, get_string('title', 'certificate')); $pdf->SetTextColor(0, 0, 0); cert_printtext($pdf, $x, $y + 55, 'C', 'freeserif', '', 20, get_string('certify', 'certificate')); cert_printtext($pdf, $x, $y + 105, 'C', 'freeserif', '', 30, $studentname); cert_printtext($pdf, $x, $y + 155, 'C', 'freeserif', '', 20, get_string('statement', 'certificate')); cert_printtext($pdf, $x, $y + 205, 'C', 'freeserif', '', 20, $classname); cert_printtext($pdf, $x, $y + 255, 'C', 'freeserif', '', 14, $certificatedate);
} else { $credithours = ''; } //Print the html text $customtext = $certificate->customtext; // Add pdf page $orientation = "L"; $pdf = new PDF($orientation, 'pt', 'Letter'); $pdf->SetProtection(array('print')); $pdf->AddPage(); if (ini_get('magic_quotes_gpc') == '1') { $customtext = stripslashes($customtext); } // Add images and lines print_border_letter($certificate->borderstyle, $orientation); draw_frame_letter($certificate->bordercolor, $orientation); print_watermark_letter($certificate->printwmark, $orientation); print_seal($certificate->printseal, $orientation, 590, 425, '', ''); print_signature($certificate->printsignature, $orientation, 110, 450, '', ''); // Add text $pdf->SetTextColor(0, 0, 120); cert_printtext(150, 125, 'C', 'Helvetica', 'B', 30, utf8_decode(get_string("titleletterlandscape", "certificate"))); $pdf->SetTextColor(0, 0, 0); cert_printtext(150, 180, 'C', 'Times', 'B', 20, utf8_decode(get_string("introletterlandscape", "certificate"))); cert_printtext(150, 230, 'C', 'Helvetica', '', 30, utf8_decode($studentname)); cert_printtext(150, 280, 'C', 'Helvetica', '', 20, utf8_decode(get_string("statementletterlandscape", "certificate"))); cert_printtext(150, 330, 'C', 'Helvetica', '', 20, utf8_decode($course->fullname)); cert_printtext(150, 380, 'C', 'Helvetica', '', 14, utf8_decode($certificatedate)); cert_printtext(150, 420, 'C', 'Times', '', 10, utf8_decode($grade)); cert_printtext(150, 431, 'C', 'Times', '', 10, utf8_decode($outcome)); cert_printtext(150, 442, 'C', 'Times', '', 10, utf8_decode($credithours));
function print_border_letter($border, $color, $orientation) { global $CFG, $pdf; switch ($border) { case '0': break; case '1': draw_frame_letter($color, $orientation); break; default: switch ($orientation) { case 'L': if (file_exists("{$CFG->dirroot}/mod/certificate/pix/borders/{$border}-{$color}.jpg")) { $pdf->Image("{$CFG->dirroot}/mod/certificate/pix/borders/{$border}-{$color}.jpg", 12, 10, 771, 594); } break; case 'P': if (file_exists("{$CFG->dirroot}/mod/certificate/pix/borders/{$border}-{$color}.jpg")) { $pdf->Image("{$CFG->dirroot}/mod/certificate/pix/borders/{$border}-{$color}.jpg", 10, 10, 594, 771); } break; } break; } }