PHP code example of kartsims / easysvg

1. Go to this page and download the library: Download kartsims/easysvg library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kartsims / easysvg example snippets




$svg = new EasySVG();
$svg->setFont("om_telolet_om-webfont.svg", 100, '#000000');
$svg->addText("Simple text display");
$svg->addAttribute("width", "800px");
$svg->addAttribute("height", "120px");
echo $svg->asXML();



$text = "Simple text display\netc.";

$svg = new EasySVG();
$svg->setFontSVG("om_telolet_om-webfont.svg");
$svg->setFontSize(100);
$svg->setFontColor('#000000');
$svg->setLineHeight(1.2);
$svg->setLetterSpacing(.1);
$svg->setUseKerning(true);
$svg->addText($text);
// set width/height according to text
list($textWidth, $textHeight) = $svg->textDimensions($text);
$svg->addAttribute("width", $textWidth."px");
$svg->addAttribute("height", $textHeight."px");
echo $svg->asXML();

$this->setFontSVG($path);
$this->setFontSize($size);
$this->setFontColor($color);