PDF2JPEG conversion font problem

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
rassol

PDF2JPEG conversion font problem

Post by rassol »

Hello!
I need to convert pdf to jpeg. So I use next code:

Code: Select all

$im = new Imagick('some.pdf');
$im->setImageColorspace(255);
$im->setCompression(Imagick::COMPRESSION_JPEG);
$im->setCompressionQuality(30);
$im->setImageFormat('jpeg');
$im->writeImage('some.jpg');
$im->clear();
$im->destroy();
Code successful converts pdf to jpeg, but with wrong font (or wrong text decoration - I don't no).
I tried some solutions:
1) Add font from pdf to ~/.fonts/
2) Add code:

Code: Select all

$im->setFont('times_new_roman.ttf');
3) Add ~/.magick/type.xml (using script imagick_type_gen)
But everything takes no effect.
Hope you can help me find a solution. You're the last hope)

Here you can download zip (rassol.zip) with generated image and pdf
Post Reply