I was wondering if I could include fonts on the list of fonts that this plugin has available. If so, how do I do that.
I'm asking because I just found some nice creative fonts i wish my certificate would have
Thanks to anyone who answers
I would also like to add some font so that the certificate can be customised a bit in looks. Any help would be appreciated!!!
I didn't find any utility in the path mentioned above.
Could you please name the file so that i can look for that specific utility file??
See the readme.txt file in this folder for further instructions:
There is no 'util' folder in the path mentioned by you.
We are using moodle 1.9.3.
These files appear to be dead. Is there a place currently available where I can convert fonts for use in fpdf?
Go here to find out more about making your own fonts for tcpdf http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf_fonts
I followed the instructions to a T! I created .php, .ctg.z and .z files and uploaded them to the lib/tcpdf/fonts directory. Then in the certificate.php file I changed the font in the code:
cert_printtext(170, 500, 'C', 'freeserifi', '', 10, utf8_decode($code));
I then got this error: FPDF error: Unidefined font: freeserifi
Any suggestions would be greatly appreciated.
Have you tried cert_printtext(... 'FreeSerifItalic' ...); instead?
In freeserifi.php there is a line $name='FreeSerifItalic';
I have problem too with adding verdana fonts to the certificate, I have tried many possible ways using fpdf and this error made me stuck:
FPDF error: Could not include font metric file
can you or anyone help me in this?
I get this error, when I try to use a customfont that has been converted to .php, .gz, .z
TCPDF error: Could not include font definition file
Can someone help?
Most probably TCPDF is trying to open a non existant fontfile (maybe a problem with the filename ?).
To understand what is happening, you need to enable debugging messages.
With Moodle 2.x go to :
Site Administration -> Development -> Debugging and set the Debug messages dropdown menu to DEVELOPER (if you have never changed it, it should be to NONE previously). Don't forget to click on Save changes.
Now additionnaly to the TCPDF error: Could not include font definition file error message you should see something like :
Warning: TCPDF::include() [function.include]: Failed opening ~ and the complete path to the file TCPDF is trying to open.
That should help you to diagnoze and solve the problem.
If you get any other error message and you can't figure what to do, post the complete error message on this forum and I will try to help you.
One other problem I had when using custom generated fonts with TCPDF (not only in Moodle) was that .php, .gz and .z files were not generated correctly due to the font utility having trouble with the name of the .ttf file. Just renaming the .ttf file with an all lowercase and no spaces characters string solved the problem. Usually just looking at the .php file content you can tell if everything is OK or not. As said in another mesage this will also give you the correct font name also.
I forgot to add that if you are using Moodle 2.2, TCPDF library has been updated to a more recent version and you can use the new addTTFfont method to directly add a new font without using the old utility, and that makes using customized fonts a lot easier. See doc here.
Hello jean-michel vedrine , thank you so much, the problem was that the module was referring to the TCPDF in the lib folder and not the TCPDF within this module
I don't know what Moodle version you are using but with moodle 2.1/2.2 you should not have a TCPDF folder inside the mod/certificate folder because as you said certificate module is using the one in the lib folder wich is a good thing because if different modules use different TCPDF files you will get errors and it will break.
See https://github.com/PukunuiAustralia/moodle-mod_certificate to download the latest version and remove any old file/folder left over from a previous version (but of course be carefull not to remove your customized certificate types, guess why I say that )
HOW TO ADD CUSTOM FONT IN MOODLE CERTIFICATE.
Guys its very simple
Step 1: Download font from google. Download font's filenamee.ttf file. Please find the
Step 2: convert the FontFileName.ttf to TCPDF readable format from following URL below.
Step3:copy all three files that have been created by above URL against your filename.ttf file to your moodle TCPDF folder (moodle\lib\tcpdf\fonts).
Now add the below line to moodle/mod/certificate/type/custom/certificate.php
certificate_print_text($pdf, $x, $y+50, 'C', 'NameOfFont', '', 30, "Certificate of Completion");
Thank you for this guideline.
I know this thread is old but wanted to tell the way I did it
Go to lib/tcpdf/fonts and upload in that folder your ttf font so you will endup with
Then in your certificate.php file add this line
$pdf->addTTFfont('../../lib/tcpdf/fonts/yourfont.ttf', 'TrueTypeUnicode', '', 32);
run the certificate once then change previous line to
//$pdf->addTTFfont('../../lib/tcpdf/fonts/yourfont.ttf', 'TrueTypeUnicode', '', 32);
Next time you want to add a new font just uncomment the line, upload your new font, and change the font name to that line, then you can use the fonts without having to download the tcpdf package
Very helpful your post!!! Thank you!
thanks for that info Tlacaelel,
i did that and that line created the .z folders, now when i'm trying to use the new fonts in my certificate don't work, i need to create the php font?
if the answer is yes, how i can create the php font?
where is certificate.php ?