Click here to Skip to main content
13,764,207 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I am working on a project and I the system allows a user to upload either a PDF file or a .docx file. What I want is that when a file is uploaded, the system should be able to count and display the number of pages the uploaded file has. It a webform application.

What I have tried:

Don't have any idea on how the code looks like.
Posted 4 days ago
Updated 4 days ago

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

That's not simple: you will need to pass the file to something that can read a PDF (or DOCX) and work out the pages count (And that's not simple, because in many cases it will vary according to the currently selected printer's paper size!)

Then you have to ask the app how many pages.
For PDF, start with the iTextSharp API.
For DOCX, you are going to be in the hands of Google - but most of the solutions you will find will reference Word Interop, and that probably won't work on your webserver as it will almost certainly not have Office installed!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06-2016 | 2.8.181113.4 | Last Updated 10 Nov 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100