473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Accessing a document's properties/metadata

Howdy,

Is it possible (and if it is how?) to have php display the details of a
word/excel/pdf document's properties/metadata?

I can go into MS Word...File...Properties and assign things like Title,
Subject, Author, Comments, etc... What I need to do now is put thse
files on a server and have php display some of those properties for me.

(Is that the same as metadata?)

Is that possible and if it is how do I go about getting started?

TIA,
J-

Sep 6 '06 #1
3 8123
<jr*****@gmail.comwrote in
news:11**********************@d34g2000cwd.googlegr oups.com...
Howdy,

Is it possible (and if it is how?) to have php display the details of a
word/excel/pdf document's properties/metadata?

I can go into MS Word...File...Properties and assign things like Title,
Subject, Author, Comments, etc... What I need to do now is put thse
files on a server and have php display some of those properties for me.

(Is that the same as metadata?)

Is that possible and if it is how do I go about getting started?
This infos are near the end of DOC file. Open DOC file in some hexa-editor
and look at the end of file. You can see something like this

W o r d D o c u m e n t   
???? .$  S u m m a r y I n f o
r m a t i o n (
)   D o c u m e n t S u m m a r y I n f o r m a t i
o n 8  ????????

All texts are in unicode (UTF-16). You can open this file via PHP in binary
mode and extract what you want :-)

--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Sep 6 '06 #2
Is it possible (and if it is how?) to have php display the details of a
word/excel/pdf document's properties/metadata?
You can do this via PHPs COM support, but only if you are hosted on
Windows with MS Office installed.

// for MSExcel use:
$objOfficeApp = new COM("excel.application") or die("unable to
instantiate MSExcel");
// for MSWord use:
//$objOfficeApp = new COM("word.application") or die("unable to
instantiate MSWord");

$objOfficeApp->Workbooks->Open( "c:\\temp\\test.xls" );
//$objOfficeApp->Documents->Open( "c:\\temp\\test.doc" );

$objDocProps =
$objOfficeApp->ActiveWorkBook->BuiltInDocumentProperties();
//$objDocProps =
$objOfficeApp->ActiveDocument->BuiltInDocumentProperties();

$count = $objDocProps->count();

while( $objDocProp = $objDocProps->Next() )
{
if( $objDocProp->Name() == 'Title' )
{
print 'Title: ' . $objDocProp->Value() . "\n";
break;
}
}

// *** IMPORTANT: release all resources correctly to avoid memory
leaks...

unset($objDocProp);
unset($objDocProps);

$objOfficeApp->ActiveWorkBook->Close();
//$objOfficeApp->ActiveDocument->Close();
$objOfficeApp->Quit();
unset($objOfficeApp);

---
Steve

Sep 6 '06 #3

jr*****@gmail.com wrote:
Howdy,

Is it possible (and if it is how?) to have php display the details of a
word/excel/pdf document's properties/metadata?

I can go into MS Word...File...Properties and assign things like Title,
Subject, Author, Comments, etc... What I need to do now is put thse
files on a server and have php display some of those properties for me.

(Is that the same as metadata?)

Is that possible and if it is how do I go about getting started?

TIA,
J-
Indexing Service is a good way to do this. See:

http://groups.google.com/group/comp....770bae0271ad11

http://groups.google.com/group/comp....4edd50c1a40666

Sep 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Griff | last post by:
I am trying to write a program in VB6 to get at file properties (Owner, Title, etc ). I can access them using scripting, Set objShell = CreateObject("Shell.Application") Set objFolder =...
1
by: Patrick Conway | last post by:
Hi! I'm building a Windows form that allows users to view a list of files (and their properties(metadata)) stored in a certain directory. All of the files in the directory are a result of a...
1
by: GautamKumar | last post by:
I want to access(SET) all the properties of IIS programmatically using C# I need to set the IIS properties through the code.plzz let me know wat class we have to use to access these properties or...
2
by: chauncy | last post by:
Hi, I have a databound dropdown filled with data. The text value is a file path that I want to use to open that file in a new browser window. I can do this with a html dropdown because I can...
1
by: Jeff Smith | last post by:
Can I load custom web user controls dynamically and access the properties and methods without having to explicitly define custom control types (example 2 below). I have custom web control named...
0
by: Bishop | last post by:
I've figured out how to create a custom TreeNode with custom properties and I can view those properties at runtime, but I'm not sure how to change them after I've added the custom node to the tree....
4
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null....
5
by: eros | last post by:
<html> <head> <SCRIPT type="text/javascript"> <!-- Beginning of JavaScript - //追加 button function Tsuika_onclick(strbtn){ alert(strbtn); // alert1 ...
0
by: Matt Nunnally | last post by:
Hi, I have a DLL I created in .NET. I have certain exposed properties that I have exposed that are declared as Integer or Byte arrays. Trying to access those certain properties through unmanaged...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.