Display PDF, Excel, Word or TEXT in HTML page

liunx

Guest
I have a PHP code that retrieve different documents from a database and able to display it by itself on a web browser. However, I would like to display it in one of my HTML page. I am able to use<br />
<img src=http://www.webdeveloper.com/forum/archive/index.php/"..."><br />
to display images. But no luck on other document formats. What should I do display other formats?<br />
I am a newbie in HTML and PHP programming. So please tell me in steps how to code.<!--content-->I was told to use<br />
<embed type="..." src=http://www.webdeveloper.com/forum/archive/index.php/"..."><br />
but what should I put in the type attribute? I only found info about embedding video and sound but nothing else.<br />
How do I use "embed" tag?<!--content-->I am able to display pdf file using<br />
<embed type="application/pdf" src=http://www.webdeveloper.com/forum/archive/index.php/"..."><br />
However, I can't do the same for word, excel or text document. Does nayone know where to Download <!--more--> a plug-in for those documents?<!--content-->In my knowledge, you can't do that for word, excel etc.<!--content-->According to a document "Exploring Ways To Embed Documents in Intranet Pages", there are web browser plug-ins available for Word and Excel. So far, I haven't found one in microsoft web site yet.<!--content-->You already know wht would go in type but for rest of us who want to know<br />
tye="mime type for the file"<br />
which can be found in NS browsers<br />
by using <br />
navigator.navigator.mimeTypes[x].type<br />
<br />
Khalid<!--content-->it's not ideal by a long shot, but if your viewr has office 2k + installed then just hyperlinking to the document will open the document in a browser window - ie if you fo a hyperlink to a .doc file, when they click on it it will open in the browser window (or a frame if you wish it to) etc, just like adobe does now.<br />
<br />
Not sure if that's much use though, since if your viewers dont have office 2k+ then it will just try to Download <!--more--> the document i would guess.<br />
<br />
PS William you didnt by any chance go to Stonyhurst college in lancashire did you??!! It's just I was at school with a william cheung...<!--content-->hey guys, i dont know how much help i can be, but i do know that you can embed excel in to the browser<br />
<br />
go to <!-- w --><a class="postlink" href="http://www.ptvprime.com">www.ptvprime.com</a><!-- w --> and click Download <!--more--> schedule usa (right above the 24 spining) good luck<!--content-->Sorry, I am not the William that you know.<br />
I did look at ptvprime.com web site. It uses frame to display excel document. When I use the same technical and it display my PHP source code instead of executing the PHP program to retrieve the excel document from database.<!--content-->well cant help u there sorry<!--content-->surely the php side of it has to be in generating the link to the excel document? i wouldnt have thought you could do php to open the document without somesort of a http redirect or something. i would use php to generate a link to the excel file (or files) and then when they're clicked they will open up.<br />
<br />
then again, could be wrong!<!--content-->I am now using my second choice. Create a hyperlink. When user clicks the link, the PHP program will fire up and display the documents in a separate page. Meanwhile, I am still looking for a solution that could let me display the document without user interaction.<!--content-->You can make a Word document on a Web page by simply linking to it. This also works with PDFs:<br />
<br />
<A HREF=http://www.webdeveloper.com/forum/archive/index.php/"the_word_document.doc">Load Word plugins</A><!--content-->If it is a physical file, I already found a solution by using frame. However, it is not. I am using link to display the document right now. But that is not what I really want to do. A temporary solution only.<!--content-->I don't think I caught what you wanted to do eventually, then... what was it?<!--content-->Here is what you can do and it will work for NS browsers for sure,provided the system already have MSOffice installed.<br />
from the NS Browser Toolbar <br />
click on Edit<br />
+preferences<br />
+Navigator<br />
+Applications or Helper applications depending upon the NS version<br />
<br />
in here you can add new mime types for excel and word.<br />
the excel file extensions are as below<br />
XLS XLT XLM XLD XLC<br />
<br />
mimetype = applications/vnd.ms-excel<br />
<br />
for ms word<br />
<br />
file extension DOC<br />
mimmetype = applications/vnd.ms-word<br />
<br />
This will force the NS browser to open the underlying object with these utlities.<br />
Oh BTW once u set the above then you have to point to applications as well.<br />
C:/msoffice/excel.exe and such<br />
<br />
Khalid<!--content-->ahhh i think i'm getting you now - you know explorer can open word docs, but as you're not using frames you dont want to do it this way since then you've effectively jumped out of your website. What i think you want to achieve is like when you click on a link from a hotmail message, where it opens the link underneath a "you are still using hotmail" bar...<br />
<br />
one way you could do this i guess is to use the php to create a frameset - that way you could have a bar at the top (with a "click here to return to my site" button on it) and dynamically create the php to load the document below it. if you do it that way then the majority of your site can be frameless, but you can have "document.php" as the php which generates a frameset dynamically (by calling document.php?document="this file.doc"), which will put "this file.doc" in the lower frame.<br />
<br />
Is that any help to you?<!--content-->My documents are stored in database. They could be called up by a PHP program. The original design is to call up the PHP program and retrieve the document and display on the same web page along with other information. As I could not find a solution for this approach, the alternate approach is to create a link in the web page. When user clicks the link, it will call up the PHP program and display the document in a separate page. Therefore, for the whole process, the document will never be stored to a physical file.<!--content-->I also thought about helper application. However it has 3 problems.<br />
1) As you say, it for sure will work in NS. But what about IE. The marketplace of IE is larger than NS. It won't make sense to get a solution only working for NS but not IE. Also, except IE and NS, there are other browsers around as well.<br />
2) Using Helper Application, I have to have all my clients config their web browsers. Not quite possible.<br />
3) It will bring up a second screen. Similar approach to my alternate approach and not as universal as my alternate approach.<!--content-->Hi John, your idea sounds interesting. Let me think about it first. Thanks.<!--content-->
 
Back
Top