V
V
VisualIdeas2016-02-13 19:43:49
PHP
VisualIdeas, 2016-02-13 19:43:49

How to get the number of pages in a PDF using PHP and ImageMagick?

So I started to write, and somehow it does not work:

$obPdf = new imagick();
$obPdf->readImage($pdf_path);

echo '<pre>';
print_r($obPdf);
echo '</pre>';
//Выводит пустой объект

$obPdf->clear();
$obPdf->destroy();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Muhammad, 2016-02-13
@VisualIdeas

https://www.kobzarev.com/programming/php-the-numbe...

V
VisualIdeas, 2016-02-15
@VisualIdeas

Found it myself if anyone needs it

$im = new Imagick();
$im->readImage("test1.pdf");
$pages=$im->getIteratorIndex();        
print"$pages";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question