SVG vectorial image with ImageSVG()

SVG vectorial image with ImageSVG()

by Khalil Radhi -
Number of replies: 0

I am sorry if this has been discussed before, but I couldn't find any relevant information using the site search.

Looking at TCPDF website, one can easily make out that vector graphics is possible with TCPDF; however, the certificate activity is a bit limited in this area.

I was able to use vector graphics directly into the certificate, and it works beautifully. No matter how big the certificate is scaled, it would retain its resolution.

The problem is that the image upload option within moodle's certificate activity settings does not accept .svg file types. It is currently limited to .jpg and .png.


This makes it difficult for course developers who are not admin users to change the graphics on the certificate as and when required.

It would be great if the option to use .svg graphics is added to the certificate activity. The code would remain the same; however the image won't stretch, it will re-scale.

This is an example of the code I have used to have a vector graphic background (border image) for my certificate: (the file I have edited is \mod\certificate\type\A4_non_embedded\certificate.php)

$pdf->ImageSVG($file='Certificate01.svg', $brdrx, $brdry, $brdrw, $brdrh, $link='', $align='', $palign='', $border=0, $fitonpage=false);
Note that the Certificate01.svg file in this instance is placed at /mod/certificate/
Average of ratings: -