Imagemagick convert svg to png with text creates blank picture

Here is my svg

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svgfile" style="position:absolute; height:1200px; width:1600px;" version="1.1" viewBox="0 0 1600 1200">
<g class='shape' id='draw136.1' shape='text1' style='word-wrap: break-word; font-family: Arial; font-size: 30.599999999999998px;' undo='-1'>
  <switch>
    <foreignObject color='#000000' height='67.53719008264463' width='216.80495662949198' x='740.5638166047088' y='501.5702479338843'>
      <p xmlns='http://www.w3.org/1999/xhtml'>Test Writing in the box</p>
    </foreignObject>
  </switch>
</g>
</svg>

And when I run the following ImageMagick script

 convert 26.svg 26.png

All I get is empty png

So, if I change my svg to the following form

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svgfile" style="position:absolute; height:1200px; width:1600px;" version="1.1" viewBox="0 0 1600 1200">
    <text color='#000000' style='font-family: Arial; font-size: 30.599999999999998px;' height='67.53719008264463' width='216.80495662949198' x='740.5638166047088' y='501.5702479338843'>
    Test Writing in the box
    </text>
</svg>

ImageMagick converts it correctly, but the problem is that my text is on one line, and I need it to be on several lines and limited by the width

Are there any problems with my SVG? or is it an ImageMagick problem?

A good job is wrapping the text in the second SVG. But I'm not quite sure how to do this, and there is a line of text transition according to the width.

Any ideas?

+4
source share

Source: https://habr.com/ru/post/1527756/


All Articles