9

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?

thinzar00
  • 588
  • 2
  • 5
  • 13

5 Answers5

20

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.

TDsouza
  • 910
  • 2
  • 13
  • 38
  • 1
    But any one easily can download , how to restrict download? – Suresh Sekar Jun 08 '16 at 05:53
  • @Chintan I had posted this almost 7 years back. A lot has changed with google docs since. For a better understanding I'd recommend you go through this URL. https://support.google.com/docs/answer/183965?co=GENIE.Platform%3DDesktop&hl=en – TDsouza Aug 25 '20 at 15:54
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.

Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
  • That would be a cumbersome process considering the uploads are being made by the users, which could mean there would be way to many uploads in a given time frame. – TDsouza Jul 25 '13 at 05:04
  • Flagger: its one thing to downvote if you don't like the answer. Its entirely another to flag a perfectly reasonable answer and run. – Ira Baxter Jul 25 '13 at 05:11
  • The only reason I downvoted was because based on the asker's scenerio, it was technically infeasible(Given the possible amount of uploads) making it rather unhelpful, yes as far as I know, your suggestion is possible to implement, but then with technology everything is, what matters is how feasible it really is. I apologize if this went down bad. – TDsouza Jul 25 '13 at 05:19
  • Why do you say it is infeasible? If he can find a tool that does the conversion as an invokable process, then this is rather straightforward to automate, so I think your conclusion is unreasonable. More infeasible is the idea that OP is going code a Powerpoint renderer in PHP; even you didn't suggest that, nor did you downvote OP's question. Finally, if you did think my answer infeasible, a downvote on your part is reasonable behavior (and you could then comment as your finally did, perhaps causing a reasonable discussion) A flag is reserved for an answer that violates norms. – Ira Baxter Jul 25 '13 at 05:22
  • That's exactly what I have done, I have downvoted not flagged this answer, and I think it's easier to find a ppt viewer like google docs as compared to a ppt to png converter that allows integration and automation. This is what made me feel it was infeasible. Once again mate, I down-voted not flagged your answer. – TDsouza Jul 25 '13 at 05:27
  • Somebody apparantly flagged the answer (-2 score) at almost the same time you downvoted. Usually coincidences that close aren't coincidences. Assume the lecture on flag etiquette isn't for you. Sorry. – Ira Baxter Jul 25 '13 at 05:29
  • ohh that's ok, given the age of this post, your bound to think it was me. haha, I think there is some error on stackoverflow as well. Cause here I see a 0 score to your answer and not a -2. – TDsouza Jul 25 '13 at 05:35
  • Seems I've been confused about downvotes for a loooooooooooong time. A downvote causes the answer score to go down 1; causes author's rep to go down 2. I have long thought -2 rep change was caused only by a flag but apparantly I've had that wrong. So it *was* your downvote, and there was no flag. While we may disagree on my answer, you've been a good citizen. – Ira Baxter Jul 26 '13 at 06:47
1

"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/

quantumSoup
  • 27,197
  • 9
  • 43
  • 57
1

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).

Lazy Bob
  • 449
  • 3
  • 9
  • aha.. after some research, I think it's better to use google docs than developing it from scratch. Thanks anyway. – thinzar00 Jun 29 '10 at 08:29
  • >> Also, there's a "Save as web page" option in Powerpoint There was, but it's gone, in either PPT 2007 or 2010 (if memory serves, it disappeared from the UI first, then was removed from the API in the next version). @Lazy Bob's answer wasn't incorrect when written. MS has made it so now (certainly from Office 2013 onward) alas. There *are*, however, third party add-ins that will convert PPT to HTML. – Steve Rindsberg Sep 10 '21 at 16:16
1

Powerpoint files can be embedded on a webpage using the API provided by Microsoft.

<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=https://yourdomainname.com/your_powerpoint_file.pptx" width="100%" height="565px" frameborder="0"> </iframe>
Md. Zubaer Ahammed
  • 931
  • 11
  • 13