Forum


Replies: 3   Views: 127
Insert svg file in html

Posted by admin  · 06-01-2025 - 10:57

Hello,

Please note that you can find samples using all the features of phpdocx on the API pages. For example, on  the img tag documentation page: https://www.phpdocx.com/htmlapi-documentation/html-standard/insert-image-Word-document-with-HTML

The following simple sample adds an SVG image transforming HTML:

$html = '<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/mt.svg">';
$docx->embedHTML($html);

You can also use base64 content (all licenses) or an svg tag (with a Premium license).

As explained in our previous reply, PHP ImageMagick must be installed and enabled to add SVG content. Otherwise, SVG contents won't be added.

Regards.