Page 1 of 1

convert svg to pdf text rasterized

Posted: 2014-01-06T03:04:14-07:00
by ben-k
Dear forum and all people who will read it.

I run into a problem with my imagick, I use it on my mac with php 5.4. I have installed imagemagick, ghostscript and all thinks via brew.
If I tried to convert a svg file into a pdf with imagick it will raster the text inside the pdf as image. If I use the command line tool convert
everything is fine.

These is my test svg:

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<svg xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:svg='http://www.w3.org/2000/svg' width='396.850393695' height='559.370078732' version='1.1'>
   <g id='layer1'>
      <text x='15.6' y='44.75' font-size='40' fill='#FF0000'>
         <tspan x='15.6' y='44.75'>test</tspan>
      </text>
	</g>
</svg>
if I use this command on commandline:

Code: Select all

rsvg-convert -f pdf -o testsvg.pdf test.svg
everything is fine, text is text.

now I tried it with imagick:

Code: Select all

$svg = "<?xml version='1.0' encoding='UTF-8'?>
<svg xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:svg='http://www.w3.org/2000/svg' width='396.850393695' height='559.370078732' version='1.1'>
   <g id='layer1'>
      <text x='15.6' y='44.75' font-size='40' fill='#FF0000'>
         <tspan x='15.6' y='44.75'>test</tspan>
      </text>
            </g>
</svg>";

$img = new Imagick();
$img->readimageblob($svg);
$img->setformat('pdf');
$img->writeimage('test.pdf');
after it the text is rendered as image not text.

Has anyone an idee what happend, or better how can I fix it :)

Thanks all who give me a moment of his time to read it.

Ben