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);
PDF_get_pdi_value
(PHP 4 >= 4.0.5, PECL pdflib >= 1.0.0)
PDF_get_pdi_value — 数値型の PDI パラメータを取得する [古い関数]
説明
float PDF_get_pdi_value
( resource
$p
, string $key
, int $doc
, int $page
, int $reserved
)数値型を有する PDI ドキュメントパラメータの内容を取得します。
この関数は PDFlib バージョン 7 で廃止されました。 かわりに PDF_pcos_get_number() を使用してください。
gregors at rose-hulman dot edu ¶
9 years ago
ian dot kinnear at optus-ebiz dot com ¶
11 years ago
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);
