Get Page Count of PDF in PHP

Aspose.PDF - Get Page Count

To get page count of Pdf document using Aspose.PDF Java for PHP, simply invoke GetNumberOfPages class.

PHP Code

# Create PDF document

$pdf = new Document($dataDir . 'input1.pdf');

$page_count = $pdf->getPages()->size();

print "Page Count:" . $page_count . PHP_EOL;

Download Running Code

Download Get Page Count (Aspose.PDF) from any of the below mentioned social coding sites: