dompdf/php-svg-lib

Division by zero

dannydinges opened this issue · 3 comments

Using dompdf and getting a Division by zero on this svg chart. The piece of the pie chart is very small which is what I believe is causing the issue. Any way around this?

<svg version="1.1" width="120" height="120" xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
    <rect width="100%" height="100%" fill="#fff" stroke-width="0px"/>
    <path fill="#45b7cd" stroke="#fff" stroke-width="2px" stroke-linejoin="round" id="eA"
          d="M85 60A25 25 0 1 0 85 60L110 60A50 50 0 1 1 110 59.99z"/>
    <path fill="#cd4555" stroke="#fff" stroke-width="2px" stroke-linejoin="round" id="eC"
          d="M85 60A25 25 0 0 0 85 60L110 59.99A50 50 0 0 1 110 60z"/>
</svg>

ErrorException
Division by zero
vendor/phenx/php-svg-lib/src/Svg/Tag/Path.php:447

Did you intend to close this issue? This issue was previously reported in #3.

I found a workaround. I was able to increase the size of the svg which created a value greater than 0. Then I scaled in the dompdf document.

I'll go ahead and create a new issue for us to look into the underlying problem since this seems like a deficiency in how the library handles this particular use case.