问题
I am building a PHP application where the user upload Powerpoint files. I want the other users to view it online instead of downloading. (Using a third party apps like google docs might be a little cumbersome for the users) Is it possible to write a powerpoint viewer code in PHP?
回答1:
You could automate the process of using google docs with php.
Google provides a ppt viewer that can be embed into webpages using the following code
<iframe src="http://docs.google.com/gview?url=http://www.domainname.come/presentation.ppt&embedded=true" style="width:550px; height:450px;" frameborder="0"></iframe>
Now im assuming php handles the uploads your users make, thus it would be easy to find the url to the specific ppt file. You could store this url either in a variable or a database, fetch it when needed and place it in the code above.
I hope I have been able to explain the logic im trying to apply, do let me know if you need more specifications.
回答2:
I suspect it would be much easier to reduce the powerpoint slides to .PNG files, and build a simple PHP script to cycle through the images.
回答3:
You want to re-write Powerpoint in PHP? I'm gonna say... very difficult at best. There are, however, tools out there that make your life easier. Also, there's a "Save as web page" option in Powerpoint, so maybe you could have your uploaders save the powerpoint as a web page, and upload that output, which I would imagine would be pretty easy for you to subsequently put up on the web.
Alternatively, if you're feeling more ambitious, you could read up on the Google docs APIs, and possibly create a portal to upload to Google docs for the contributors, and view Google docs for your visitors. Your PHP frontend could leverage the power of Google docs, but eliminate the cumbersomeness (I'm kind of surprised that's a real word).
回答4:
"Is it possible to write a powerpoint viewer code in PHP?"
Yes. Unfortunately, if you are asking this question, you probably won't be able to do it yourself.
If you want to try it anyways, here's a good place to start: http://msdn.microsoft.com/en-us/library/cc313106(office.12).aspx
Or you can look for a library that does that. They are probably out there, just Google it.
EDIT: Found one here: http://phppowerpoint.codeplex.com/
来源:https://stackoverflow.com/questions/3137826/embed-powerpoint-viewer-on-a-web-page-php