• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

How to get page count of document files

Hi

I need to get the page count of doucment files(.doc,.pdf,.ppt,.xml).

Examples

FileInputStream fis = new FileInputStream("one.doc);
fis.getPageCount();

FileInputStream fis = new FileInputStream("one.pdf);
fis.getPageCount();

If one.doc or one.pdf is having 20 pages

int count = fis.getPageCount(); should return value 20

how to achive this









0
vallabhaneni99
Asked:
vallabhaneni99
1 Solution
 
objectsCommented:
you'll need to habdle each different file type seperately
use itext for pdf
try POI for M$ files
and page count doesn';t really make sense for an xml file
0
 
Mayank SAssociate Director - Product EngineeringCommented:
http://www.lowagie.com/iText/

Open-office can also be used for Word: http://api.openoffice.org
0
 
hoomanvCommented:
FileInputStream is for raw data extraction. not useful for handling complex file types like documents/images/etc unless you know the file stucture used to store these type of files.
try the above free libraries to extract/manipulate their contents
0
 
vallabhaneni99Author Commented:
Hi Objects

If  possible plz will you give the example code

0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now