4

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 an 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 here is that my text is on one line, and i need it to be on multiple lines and bounded by the width

Is there any problem with maybe my SVG ? or is this an ImageMagick problem?

A good work around is the wrap the text in the second SVG. But i am not quite sure how to that, and have the text jump line according to the width.

Any ideas ?

Max Doumit
  • 1,065
  • 12
  • 33
  • 4
    I'm guessing ImageMagick doesn't support `foreignObject` with html inside. See http://stackoverflow.com/questions/4991171/auto-line-wrapping-in-svg-text for some alternative solutions. – Erik Dahlström Feb 20 '14 at 12:18

0 Answers0