Google-Doc-Embedder
How to Show PDF, Spreadsheet and Word file in WordPress post

How to Show PDF, Spreadsheet and Word file in WordPress post

Nur . Posted in Freebies, How-To 3738 Views

My client want to display pdf files in the post, his website is powered by WordPress, although there are lots of plugins to achieve this task but the requirements was to display pdf content without installing any extra plugin. I have found a solution on WordPress API.

By using this piece of code you can easily embed PDF files into a a page or post for clients, so website visitors can read the PDF document right from the page. The process of embedding PDF files into a WordPress post is fairly simple by using the Google doc technology. This function not only enable you PDF documents but also you can embed Microsoft Word Documents, PowerPoint slides, Excel Spreadsheets, and other elements in your WordPress blog without loosing the quality of text, table and graphics [Dream Template]. Open up your function.php file and add following piece of code in it, which enable you to create a shortcode in WordPress:

function pdflink($attr, $content) {
return '<a href="http://docs.google.com/viewer?url=' . $attr['href'] . '">'.$content.'</a>';
}
add_shortcode('pdf', 'pdflink');

Now for displaying  link of PDF documents, Microsoft Word DocumentsPowerPoint slides, Excel Spreadsheets, and other elements in your WordPress blog in article or post you need add the following lines in the article.

[pdf href=”http://yoursite.com/linktoyour/file.pdf”]View PDF[/pdf]

Upload the required file and get the file link and replace with http://yoursite.com/linktoyour/file.pdf, this will create  pdf link for your pdf document in your site. Although with WordPress latest version you don’t need to use this function to provide the link. WordPress by default now give this facility.

But we want to create PDF or document  link in to display the document content in page or post. So there are WordPress plugins and following code will help you to show the documents in WordPress post or page. Add following code in theme’s function.php file:

function pdfshow($attr, $content) {
return '<iframe src="http://docs.google.com/gview?url='.$attr['href'] .'&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>';
}
add_shortcode('pdfshow', 'pdfshow');

And now for displaying PDF or documents in article or post, add the following lines in the article as a shortcode:

[pdfshow href=”http://yoursite.com/linktoyour/file.pdf”]

Upload the required file and replace this http://yoursite.com/linktoyour/file.pdf with your own download files link.

Embed PDF, Spreadsheet, and others with WordPress Plugins


Google Doc Embedder

Google Doc Embedder lets you embed several types of files into your WordPress pages using the Google Docs Viewer – allowing inline viewing (and optional downloading) of the following file types, with no Flash or PDF browser plug-ins required:

Detail | How to Use

Html To Pdf On Fly For WP And Shortcode Style

with this plug-in for wordpress you can create PDFs from HTML code on fly and save them in a specific folder of your blog. For example, you can create an invoice with this script and archive it.

  • Easy to use
    (just write your html and transform)
  • Include CKeditor, TCPDF and jQuery
  • Some configurable options for your PDF
  • “Downloadable” PDF
  • Preview PDF
  • PDFs Listing
  • Give PDFs links to your clients via shortcode created automatically
  • With shortcode you can show PDFs preview to your client and they can download PDFs
  • ou can style each shortcode and save its configuration

Detail

Web Grabber WordPress Plugin

If you want to embed various contents from public web sites into your WordPress blog, then the Web Grabber WordPress Plugin is the perfect tool that will help you do that.
No frames or iframes involved! Real HTML content, grabbed form the web and displayed in whithin your blog just like you wrote it by yourself.

Live previewDetail

Agency Theme - First Impressions Are Everything     e-Business Express We Help Grow Your Business

Nur

I am a Wordpress, Website Developer and Designer, creator @ WP Arena, Provide Free WordPress consultation and can help to install WordPress in a secure way to small businesses and bloggers.

Free & Professional WordPress Security Service Free & Professional WordPress Security Service

We Love WordPress. WordPress Arena is a place for WordPress Developers and Designers, providing Tips, tricks, tools and resources to build a website or blog on WordPress. We also present The WordPress Showcase for all kind of WordPress Powered Websites.


Copyright © 2014 WP Arena All Rights Reserved

Divi WordPress Theme