Certificate generator php source code
PHP script to generate certificates for participation in events. This script uses TCPDF library to generate PDF's from HTML templates. Given a CSV file with person's details and data to be printed into PDF's file is possible create customized certificates including background images. There are a range of options (listed bellow) to customize certificates. In order to install
The recommend way to create HTML template is using a HTML editor or a text editor. But it's also possible to use converting tools like ZAMZAR or PowerPoint2HTML to convert PowerPoint presentation to HTML. The problem with using conversion tools is that sometimes the HTML created contains tags not handle by TCPDF and the generate PDF certificate will not work correctly. Be sure that you HTML template contains only TCPDF supported tags. Currently supported tags are: a, b, blockquote, br, dd, del,
div, dl, dt, em, font, h2, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul NOTE: all the HTML attributes must be enclosed in double-quote. Refer to TCPDF documentation to get more details about supported tags. CSS styles must be inline into HTML files in order to be handle by TCPDF. HTML templace placeholdersIt's possible to use placeholders in HTML template to be replaced by data from CSV files (see bellow). The placeholders must use the Jinja syntax, for example: for define placeholder for a "variable" called A special placeholder Creating a PDF certificateThe main file of Certificate Generator is OptionsThere are a set of options available to customize the certificate generator that should be passed at command line:
Add a font to TCPDFThe TCPDF comes with a limited number of fonts. To convert and add a new
font to TCPDF you can use the options php certgen.php -f Ubuntu-Light.ttf In case of success you will received a message with the font name's that should be used in configuration file (see bellow) replacing the
Configuration fileThe are a number of configurations that can be customized in
Examples:See examples files in php certgen.php -i sample.html -o ./output/ -d sample.csv -s "Thanks for participated of our event" -e "participant_email" -m sample_email_message.html -r -a sample_attach.txt The command above will generates a PDF certificate for each attendant listed in ContributingPlease submit bug reports, suggestions and pull requests to the GitHub issue tracker. If you found a mistake in the docs, or want to add something, go ahead and amend the wiki - anyone can edit it. LicenseCertificate-Generatoris publised under GNU GENERAL PUBLIC LICENSE v3.0. |