svg2pdf icon indicating copy to clipboard operation
svg2pdf copied to clipboard

Wrong gradient with dpi other than 72

Open bczhc opened this issue 2 months ago • 2 comments

As the title says. 1.pdf is produced with dpi 72, and 2.pdf with 96, 3.pdf with 48. The gradient is shifted.

Image
demo svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   width="100mm"
   height="50mm"
   viewBox="0 0 377.95323 188.97662"
   version="1.1"
   id="svg1"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <defs
     id="defs1">
    <linearGradient
       id="linearGradient8">
      <stop
         style="stop-color:#00ff09;stop-opacity:1;"
         offset="0"
         id="stop7" />
      <stop
         style="stop-color:#000cff;stop-opacity:1;"
         offset="1"
         id="stop8" />
    </linearGradient>
    <linearGradient
       id="linearGradient4">
      <stop
         style="stop-color:#00f7ff;stop-opacity:1;"
         offset="0"
         id="stop5" />
      <stop
         style="stop-color:#000cff;stop-opacity:1;"
         offset="1"
         id="stop6" />
    </linearGradient>
    <radialGradient
       xlink:href="#linearGradient4"
       id="radialGradient6"
       cx="188.97662"
       cy="94.488312"
       fx="188.97662"
       fy="94.488312"
       r="122.51537"
       gradientTransform="matrix(1,0,0,0.36743513,0,59.769984)"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       xlink:href="#linearGradient8"
       id="linearGradient7"
       x1="66.46125"
       y1="162.01299"
       x2="311.49197"
       y2="162.01299"
       gradientUnits="userSpaceOnUse" />
  </defs>
  <g
     id="layer1">
    <g
       id="g8"
       transform="translate(0,-22.508224)">
      <rect
         style="fill:url(#radialGradient6);fill-opacity:1;fill-rule:evenodd;stroke-width:0.264567;stroke-linecap:square;stroke-miterlimit:0;stroke-dasharray:0.264567, 0.264567;paint-order:stroke fill markers"
         id="rect1"
         width="245.03073"
         height="90.032898"
         x="66.46125"
         y="49.471859" />
      <rect
         style="fill:url(#linearGradient7);fill-opacity:1;fill-rule:evenodd;stroke-width:0.187077;stroke-linecap:square;stroke-miterlimit:0;stroke-dasharray:0.187077, 0.187077;paint-order:stroke fill markers"
         id="rect6"
         width="245.03073"
         height="45.016441"
         x="66.46125"
         y="139.50476" />
    </g>
  </g>
</svg>

bczhc avatar Nov 10 '25 03:11 bczhc