What are some potential alternatives to TCPDF for converting SVG graphics to PDF in PHP?

TCPDF is a popular library for generating PDF files in PHP, but it does not have built-in support for converting SVG graphics to PDF. One potential alternative is to use libraries such as Dompdf or FPDF, which have plugins or extensions available for handling SVG graphics. These libraries can be used to convert SVG files to PDF format in PHP.

// Using Dompdf library to convert SVG to PDF
require_once 'dompdf/autoload.inc.php';

use Dompdf\Dompdf;
use Dompdf\Options;

// Load SVG content
$svgContent = file_get_contents('example.svg');

// Create a new Dompdf instance
$options = new Options();
$options->set('isHtml5ParserEnabled', true);
$dompdf = new Dompdf($options);
$dompdf->loadHtml($svgContent);

// Render the PDF
$dompdf->render();
$dompdf->stream('output.pdf', array('Attachment' => 0));