Hello Everybody,
Is there a way to count total number of pages of word and pdf files with PHP?
Thanks.
Counting Pages
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Counting Pages
Lots of ways using directoryiterator or readdir, but depending upon what you need to do, I like glob():
Code: Select all
$count = count(glob('/dir/{*.pdf,*.doc}', GLOB_BRACE));mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: Counting Pages
Thats not what he asked
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Counting Pages
Ahh, I see. That will count the total number of files, not pages within the files if that's what you wanted.josh wrote:Thats not what he asked
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: Counting Pages
usamaalam, I would look into command line Open Office. I don't know if it does what you want for sure, but it does a lot. I know for a fact I can convert doc to pdf in OO. Then I know for a fact I can use posttext imagemagick extension to convert each page to a JPG. Then I could glob and count the jpgs.
Maybe some one has a clearer solution, or maybe Open Office has a way to get the page count already. Do report back with what you find.
Maybe some one has a clearer solution, or maybe Open Office has a way to get the page count already. Do report back with what you find.