dompdf / php-svg-lib

SVG file parsing / rendering library
GNU Lesser General Public License v3.0
1.4k stars 77 forks source link

Division by zero #61

Closed dannydinges closed 3 years ago

dannydinges commented 3 years ago

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

bsweeney commented 3 years ago

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

dannydinges commented 3 years ago

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.

bsweeney commented 3 years ago

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.