PHP code example of pavlm / ffi-librsvg

1. Go to this page and download the library: Download pavlm/ffi-librsvg 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/ */

    

pavlm / ffi-librsvg example snippets



use pavlm\Rsvg\Rsvg;

0 0 100 100">  <rect x="10" y="10" width="80" height="80" fill="green" />  </svg>';

print Rsvg::convertSvg2Png($svgData);


curl https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg | \
 tee /tmp/tiger.svg | \
 php bin/rsvg-cli.php | \
 tee /tmp/tiger.png | \
 display