convert svg to pdf text rasterized

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
ben-k
Posts: 1
Joined: 2014-01-06T02:56:32-07:00
Authentication code: 6789

convert svg to pdf text rasterized

Post 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
Post Reply