PHP code example of laratusk / larasvg
1. Go to this page and download the library: Download laratusk/larasvg 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/ */
laratusk / larasvg example snippets
use Laratusk\Larasvg\Facades\SvgConverter;
// Default provider (Resvg)
SvgConverter::open(resource_path('svg/file.svg'))
->setFormat('png')
->setDimensions(1024, 1024)
->toFile(storage_path('app/output.png'));
// Switch provider per call
SvgConverter::using('inkscape')
->open(resource_path('svg/file.svg'))
->setFormat('pdf')
->toFile(storage_path('app/output.pdf'));
SvgConverter::using('cairosvg')
->open(resource_path('svg/file.svg'))
->setFormat('pdf')
->setScale(2.0)
->toFile(storage_path('app/output.pdf'));