If you are having troubles getting the page count make sure you have Root caplitalized correctly.
$numPages=pdf_get_pdi_value($p,"/Root/Pages/Count",$input,0,0);
(PHP 4 >= 4.0.5, PECL pdflib >= 1.0.0)
PDF_get_pdi_value — Получает числовой параметр PDI [устарело]
$p
, string $key
, int $doc
, int $page
, int $reserved
) : floatПолучает содержимое параметра документа PDI с числовым типом.
Функция устарела с версии PDFlib 5, используйте вместо нее PDF_pcos_get_number().
If you are having troubles getting the page count make sure you have Root caplitalized correctly.
$numPages=pdf_get_pdi_value($p,"/Root/Pages/Count",$input,0,0);
From the pdflib manual...
key: Specifies the name of the parameter
doc: a valid PDF document handle retrieved with PDF_open_pdi()
page: A valid PDF page handle (not page number!). For keys which are not page-related page must be -1
Example:
$numPages=pdf_get_pdi_value($p,"/root/Pages/Count",$input,0,0);