Skip to content

Commit

Permalink
Fixes minor bugs with new lines in certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Corso committed Jun 13, 2016
1 parent e3b04f8 commit f2da831
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions php/generate-certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ function qsm_addon_certificate_generate_certificate( $quiz_results, $return_file
$pdf = new PDF_HTML();
$pdf->AddPage( 'L' );

// Add logo
if ( ! empty( $certificate_settings["logo"] ) ) {
$pdf->Image( $certificate_settings["logo"], 0, 0, $pdf->w, $pdf->h );
// Add background
if ( ! empty( $certificate_settings["background"] ) ) {
$pdf->Image( $certificate_settings["background"], 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight() );
}
$pdf->Ln( 20 );

Expand All @@ -75,11 +75,12 @@ function qsm_addon_certificate_generate_certificate( $quiz_results, $return_file
// Add content
$pdf->SetFont( 'Arial', '', 16);
$content = apply_filters( 'mlw_qmn_template_variable_results_page', $certificate_settings["content"], $quiz_results );
$content = nl2br( $content, false );
$pdf->WriteHTML( "<p align='center'>$content</p>" );

// Add background
if ( ! empty( $certificate_settings["background"] ) ) {
$pdf->Image( $certificate_settings["background"], 110, 130 );
if ( ! empty( $certificate_settings["logo"] ) ) {
$pdf->Image( $certificate_settings["logo"], 110, 130 );
}

// Generate the pdf
Expand Down

0 comments on commit f2da831

Please sign in to comment.