Try to convert OpenOffice to PDF, but it takes a long time and the format changes
Reply content:
Thank you for your invitation. (please send me a question such as file format or protocol format analysis.)
It's simple if you just get the number of pages.
manual operation: (Code operation please refer to)
Because now it's all in docx format. I'll talk about the manual scheme.
1. Change the name of the docx file extension to zip;
2. Open this zip file, three folders and an XML file will appear by default;
3. Enter the Docprops folder, there are two files: Core.xml and app.xml;
4. Open the App.xml and find the " x "This line, here is the number of pages of the docx file.
principle:
The docx document is essentially a compressed file in a zip format, and the attribute information for the docx document is recorded in the corresponding XML file. Details can be explored on their own.
Microsoft Official definition: DOCX
Microsoft Corporation
Microsoft Official definition: DOC
Understanding Word Ms-doc Binary file formats Thank you for your invitation.
Didn't do anything like that, but Baidu was handy ...
After 2007 Word files can refer to Faizhongxuan's answer ...
But he gave the manual version of the ...
It should not be a problem to change the manual version to automatic version. Then I say another method, PHP5 seems to be able to call COM, and Office has a COM interface, so you can directly from inside PHP call, the specific interface can refer to MSDN, directly to the name guess also sorta.
The disadvantage of course is that it must be run on Windows and install Office first, and it is slow to call (actually started a word process in the background), with the advantage of supporting all formats including Doc and docx. All word operations can be done in addition to the number of pages read.
Just get the file attributes, remember that there are some Windows API can be used, specifically needs to be supplemented by others. Why not try Phpoffice, Phpoffice Phpword Ah, actually someone and I like the demand. Look here, there are examples of Cheng:
Php-how to get the number of pages in a Word Document on Linux?