0

I'm using the following code

  $imagick = new Imagick();
// Reads image from PDF
$imagick->readImage('sample.pdf');
// Writes an image or image sequence Example- converted-0.jpg, converted-1.jpg
$imagick->writeImages('converted.jpg', false);

Fatal error: Uncaught exception 'ImagickException' with message 'UnableToOpenBlob `sample.pdf': No such file or directory @ error/blob.c/OpenBlob/2702' in D:\xampp\htdocs\full_delay\fulcrum\www\www.axis.com\app\imagick\imagick-test.php:15 Stack trace: #0 D:\xampp\htdocs\full_delay\fulcrum\www\www.axis.com\app\imagick\imagick-test.php(15): Imagick->readimage('sample.pdf') #1 {main} thrown in D:\xampp\htdocs\full_delay\fulcrum\www\www.axis.com\app\imagick\imagick-test.php on line 15

1 Answer 1

1

You should provide fullpath of your file. Like error said, there is no file sample.pdf in the directory where your code is executed.

Set a path like this:

$imagick = new Imagick();
// Reads image from PDF
$imagick->readImage('D:\xampp\htdocs\full_delay\fulcrum\www\www.axis.com\app\imagick\sample.pdf');
// Writes an image or image sequence Example- converted-0.jpg, converted-1.jpg
$imagick->writeImages('converted.jpg', false);

Where D:\xampp\htdocs\full_delay\fulcrum\www\www.axis.com\app\imagick\sample.pdf is the path of your file.

Sign up to request clarification or add additional context in comments.

2 Comments

My error got cleared , but I did't got any output. the browser says "The connection was reset"
I haven't used Imagick since a while. I think your code is incomplete. Take a look on this question: stackoverflow.com/questions/9227014/… or the manual: php.net/manual/en/book.imagick.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.