Jump to content

HTML5 - Reading a directory of word doc files and reading the document properties without opening the file?


iperiotto

Recommended Posts

I have done some research but nothing concrete at this stage. At this moment I think the best approach is to read the word/pdf doc files properties (i.e Title or Tag/Keywords - I am using MS Office 2010) and select accordingly to its HTML page.
The scenario: I need to develop a 'generic' code rather than copying and pasting thousands time the following line of code
<tr>
<td> <a href="../AAA.pdf" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;"> AAA </a>
</td>
</tr>
Imagine a folder with lots of word doc or PDF files. I need to develop a way to automatically populate a table in HTML with those files but using its documents properties (any other suggestions?) to select only the correct files to that specific HTML page. I need to look inside this folder, get just the word/pdf files that have a specific Title or Tag/Keyword from its doc properties and populate the table in HTML.
I know this seems a little odd maybe, but it's for a HTML project that requires me to automatically populate a table with the correct files (e.g. Page 1 would only have a table populated with word/pdf files with 'Page 1 title or Tag/Keyword').
Anyhow, any help or suggestions on how to approach this would really help me.
I thank your time and help in advance.
Many thanks,
IP
Link to comment
Share on other sites

If you're not familiar with PHP, you should read the tutorial.

 

Once you know PHP, you can go through the contents of a directory using scandir() and read files using fopen() and fread(). You can load all the content of a file at once using file_get_contents(), but if you just need to read the first few bytes of the file then fread() is much more efficient.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...