ps2pdf (vector to vector)

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
macmagick

ps2pdf (vector to vector)

Post by macmagick »

Is ist possible to configure the delegates.xml so that an eps as input is not beeing rasterized while beeing converted to pdf (or eps again).

I can convert my eps to pdf as root in my shell using ps2pdf – and everything is perfect. How to do the same from within Imagick or PHP?
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: ps2pdf (vector to vector)

Post by mkoppanen »

Hi,

you can add new delegates into the delegates.xml file. You can read using the delegate using:

$im->newPseudoImage(100,100, 'xyz:file.jpg');

and writing

$im->writeImage('xyz:file.jpg');
Mikko Koppanen
My blog: http://valokuva.org
macmagick

Re: ps2pdf (vector to vector)

Post by macmagick »

That makes some things clear. By using readImageBlob() the eps is beeing rasterized already?

There's nothing like a newPseudoImageBlob()? Actually my input is pure postscript (from a variable). Do I have to write the variable down by like tempnam() and writing/reading through a handle etc? I configured <delegate decode="eps" encode="pdf" ...> to use ps2pdf and did the following:

- tempfile $temp by tempnam()
- fwrite my var (postscript as string) into $temp
- $im->newPseudoImage(100,100,"eps:".$temp);
- $im->writeImage("pdf:mypdf.pdf")

The resulting mypdf.pdf is rasterized!

I tried the same with eps2ps: there I got my eps in the left down corner on a A4 page: just telling you this for it shows the delegates are beeing used – sort of?

My delegation: <delegate decode="eps" encode="pdf" mode="bi" command=""/usr/local/bin/ps2pdf" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 "-sDEVICE=pdfwrite" "-sOutputFile=%o" "-f%i""/>

And still: I'd prefer not to write any tempfiles by myself.
Post Reply