Google Document Viewer for WordPress

August
19th,
2010

I actually read about this little feature a while back…like almost a year or so ago. I thought it was a neat feature, I just really had no use for it.

Recently though, I wanted to embed a PDF into a webpage and remembered seeing this article from last year. I immediately went out to create a simple, useful function to be able to use this in WordPress.

After jacking with the code for a bit, I ran it by Shat who always helps fix up my code. He tweaked it, and stripped out extraneous code that I had to make it easier to use. Thus, Shat and I present the Google Document Viewer functions hack.

Add this to your functions.php file and you’re in business to use the Google Document Viewer shortcode to display a PDF, PPT, or a TIFF file inline.

Usage

We’ve made it simple to use, just like all other shortcodes. And by simple, I mean simple! As you see above, the width, height, path, and style are all things to pass to the shortcode. The only one that’s obviously mandatory is the path. The function already sets some height/width settings and those are easily changed in your function. I like 600X800 so that’s what the default here is.

Share Post

TQuizzle

TQuizzle.com is my place to talk about whatever. I really don't post here much anymore what with all the other domains I own, but I'm putting it up on GitHub so that it can be seen for archive puposes.