Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Finding Page Count in any file  RSS feed

 
Srinivas Blore
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to find out the page count in any file (doc,ppt,pdf,image,etc...). Is there any universal API to deal with any file irrespective of the file extension.Its bit urgent. Please let me know your inputs on this.
I had gone through iText API for converting the files into PDF. But I dont think so it converts any file into PDF.

Thanks,
Srinivas.
 
Tony Docherty
Bartender
Posts: 3264
81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

This is not possible. Every file type has a different format, some have no concept of pages and those that do have a different way of representing page breaks.

Take a plain text file (ie .txt) as an example, the number of pages in that file depends on how many lines the printer will print on each piece of paper. This will vary with the paper size, the font size, how close the printer can print to the edge of the paper etc.
Or an image file - where are the page breaks in an image file?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I'd look into what Apache Tika can do. Its sole purpose is to handle structured document formats, and put abstractions on top of them as far as possible. This might be a good start (just ignore what it says about Alfresco).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!