Displaying User picture in Certificate

Re: Displaying User picture in Certificate

by Jean-Michel Védrine -
Number of replies: 0

You say that you know HTML code for table, then you are done! because there exists a command to write some HTML in the pdf. It doesn't support all HTML formatting but it works well for table.

Here is an example adapted from TCPDF, the library used by the certificate module to generate the pdf file.

// Move the cursor where you want the upper left corner of the table to be.
$pdf->SetXY(20,10);


// Choose table's font.
$pdf->SetFont('freesans','',10);


// Create the HTML content of the table.
$html = '<table border="1" cellspacing="3" cellpadding="4">
    <tr>
        <th>First column</th>
        <th align="right">RIGHT align</th>
        <th align="left">LEFT align</th>
        <th>4A</th>
    </tr>
    <tr>
        <td>1</td>
        <td bgcolor="#cccccc" align="center" colspan="2">A1 ex<i>amp</i>le <a href="http://www.tcpdf.org">link</a> column span.<br />line after br<br /><small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal  bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla<ol><li>first<ol><li>sublist</li><li>sublist</li></ol></li><li>second</li></ol><small color="#FF0000" bgcolor="#FFFF00">small small small small small small small small small small small small small small small small small small small small</small></td>
        <td>4B</td>
    </tr>
    <tr>
        <td>some text</td>
        <td bgcolor="#0000FF" color="yellow" align="center">A2 € &euro; &#8364; &amp; è &egrave;<br/>A2 € &euro; &#8364; &amp; è &egrave;</td>
        <td bgcolor="#FFFF00" align="left"><font color="#FF0000">Red</font> Yellow BG</td>
        <td>4C</td>
    </tr>

    <tr>
        <td>1C</td>
        <td>2C</td>
        <td>3C</td>
        <td>4F</td>
    </tr>
</table>';

// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');

So you only have to:

  • adapt the first lines for the table position and font
  • change the content of $html = '...';

and you are done!

If you have trouble to write the $html = '...'; part, or to include certificate variables in it, ask for help, but post you code so that I can see the problem.