使用插件：Google Doc Embedder
Lets you embed MS Office, PDF, and many other file types in a web page using the Google Docs Viewer (no Flash or PDF browser plug-ins required).
- Upload the entire
google-document-embedderfolder to the
- Activate the plugin through the ‘Plugins’ menu in WordPress.
Upload the documents to your site using the media upload facility built into WordPress, via FTP, or link to documents on another (public) site. Use the Media Library or Google Doc Embedder button in the Visual editor to build the appropriate shortcode, or use the documentation.
For basic manual instructions, please see the FAQ. For advanced usage, see the web site.
Go to “GDE Settings” (under “Settings” in the admin panel) to change defaults, or override individually using the shortcode syntax in the FAQ.
Once the plug-in is successfully installed and activated in WordPress (this is straightforward – see theinstallation instructions if needed), you can embed your document into either a page or a post using the syntax below. GDE integrates with the WordPress visual editor, and to a lesser degree the Media Library and HTML (text) editor, to automate many of these functions.
The shortcode uses the following attributes. For information about setting defaults (so you don’t have to use most of these shortcode options), see the Settings page.
||(required) The fully qualified URL pointing to the file you wish to embed. If many of your files start with the same root directory, you can set a File Base URL in your viewer profile and only enter the unique part of the filename here instead of the full URL.|
||(optional) Enter a number (in px) or a percent value to override the program’s default document width.|
||(optional) Enter a number (in px) or a percent value to override the profile’s default document height. Because of the way CSS works, you probably want to enter a pixel value here as a percentage may not function as you expect.|
||(optional) Specify a page number to begin viewing the embedded document.|
||(optional) Enter the profile ID or name from the profile list for the settings you want to use for the document. If none is specified, the default profile is used.|
||(optional) Enter a value (1 to show, 0 to hide) to override the default display setting for the download link. Note that this setting is ignored on private documents.|
||(deprecated) Enter a supported language’s ISO 639-1 Language Code to override the global Default Language setting. This feature will be removed in a future version as it is now redundant; please set your language preferences in your viewer profiles instead.|
||(removed) This feature is no longer relevant or supported in GDE 2.5+. If needed, you can turn off error checking globally from the Advanced tab in GDE Settings.|
If you wish to use CSS to style the plug-in’s output, each element has its own class name you can add to your theme’s stylesheet:
.gde-frame – the embedded viewer itself
.gde-text – the download text
.gde-link – the download link
.gde-error – inline error messages, if enabled (2.3+)
Just about every aspect of the viewer’s appearance can be modified to match your site if you are savvy with CSS and developer tools like Firebug. The Enhanced Viewer will let you easily change page background and border colors as well as modify or hide the toolbar. For full customization, you can provide your own CSS file. You can use the sample “dark” profile provided with the plugin to get started.
[gview file=”http://tahoroom-tahoroom.stor.sinaapp.com/uploads/2012/12/1209.0065.pdf” profile=”3″ height=”700px” width=”1000px” save=”1″]