Reputation: 81
i am using pdftk to get total page number of a pdf file in php. I am using the code. my pdftk.exe file is in
assets/pdftk folder and my pdf file is in Files folder
$command = '../assets/pdftk/pdftk.exe ';
$command.="../Files/" . $fileNames;
$command.="dump_data | grep NumberOfPages";
exec($command);
i need to get number of pages in a string.how to do this.thanks in advance
Upvotes: 3
Views: 4714
Reputation: 760
This works for me:
$pageCount = intval('pdftk path/to/pdf.pdf dump_data | grep "NumberOfPages" | cut -d":" -f2');
Upvotes: 6