Convert Html (SVG) to PDF using DomPDF

0

With the code below I am able to generate the PDF normally. Only the "figure" I am generating using SVG is not showing.

What do I have to change for the figure to be included in the PDF?

*** Remembering that I can not change anything in HTML.

<?php
    ini_set("display_errors", 1);
    error_reporting(E_ALL|E_STRICT);
    require "vendor/autoload.php";

    use Dompdf\Dompdf;
    use Dompdf\Options;

    $options = new Options();
    $options->set('isRemoteEnabled', TRUE);
    $options->set('debugKeepTemp', TRUE);
    $options->set('isHtml5ParserEnabled', true);

    $dompdf = new DOMPDF($options);

    $doc = new DOMDocument();
    libxml_use_internal_errors(true);
    $doc->loadHTMLFile("exemplo.html");
    libxml_clear_errors();

    $html = $doc->saveHTML();
    $dompdf->loadHtml($html);
    $dompdf->render();
    $dompdf->stream("exemplo.pdf", array("Attachment"=>0));

?>

example.php

<!DOCTYPE html>
<html>
    <body>
        <svg width="400" height="110">
            <rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
        </svg>
    </body>
</html>
    
asked by anonymous 26.04.2018 / 02:41

0 answers