Get the page count

M

Mihidum

Hi,
I've an ASP.NET web application on which I need to get the word doc page
count. Since I have many word documents to get the page count, I don't want
to use Word Application object as it will consume a lot of resources on the
server.

Is there a possibility to get the page count by reading the word doc into a
stream & by looking for page delimiters?

Or is there a better way to get the page count without using word
applications objects.

Please help.....!
 
J

Jay Freedman

Hi,
I've an ASP.NET web application on which I need to get the word doc page
count. Since I have many word documents to get the page count, I don't want
to use Word Application object as it will consume a lot of resources on the
server.

Is there a possibility to get the page count by reading the word doc into a
stream & by looking for page delimiters?

Or is there a better way to get the page count without using word
applications objects.

Please help.....!

You can use DSOFile.dll (version 2) to read document properties, including page
count, from an Office 97-2003 format document without opening the document. It
doesn't work with Office 2007 format documents, but you may be able to get
something out of the XML in that container.

See http://www.word.mvps.org/FAQs/MacrosVBA/DSOFile.htm.

Also be aware that the page count of a Word document depends on the printer
driver used to do the layout
(http://www.word.mvps.org/FAQs/Formatting/TextReflow.htm), so what you get from
DSOFile is only an approximation.
 
M

Mihidum

Jay Freedman said:
You can use DSOFile.dll (version 2) to read document properties, including page
count, from an Office 97-2003 format document without opening the document. It
doesn't work with Office 2007 format documents, but you may be able to get
something out of the XML in that container.

See http://www.word.mvps.org/FAQs/MacrosVBA/DSOFile.htm.

Also be aware that the page count of a Word document depends on the printer
driver used to do the layout
(http://www.word.mvps.org/FAQs/Formatting/TextReflow.htm), so what you get from
DSOFile is only an approximation.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.

Thanks a lot Jay. You saved my day :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top