Apply workaround for SVG images on PDFs (#359)

This commit is contained in:
Belle Aerni authored and GitHub committed 2022-10-18 21:56:56 +02:00
1 parent e10c5ee4e5
commit 6f75976467
1 file changed
+6 -1
+6 -1
View File
@@ -1300,7 +1300,12 @@ class Service implements InjectionAwareInterface
$options->set('isRemoteEnabled',true);
}
}
$html .= "<img src=\"$url\" height=\"50\" class=\"CompanyLogo\"></img>";
// Workaround to get SVG images to render. Please see https://github.com/dompdf/dompdf/issues/320
if ('.svg' === substr($url, -4)) {
$html .= '<img src="data:image/svg+xml;base64,' . base64_encode(file_get_contents($url)) .'" height="50" class="CompanyLogo"></img>';
} else {
$html .= '<img src="'. $url .'" height="50" class="CompanyLogo"></img>';
}
$html .= '<hr class="Rounded">';
}