Force view pdf in gDocs viewer or iframe

General discussions related to php

Moderators: macek, egami, gesf

pfernandezm59
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Jun 12, 2013 11:12 am

Force view pdf in gDocs viewer or iframe

Postby pfernandezm59 » Wed Jun 12, 2013 11:19 am

Hey in my first post!!
I'm working with WP and wp-client plugin in order to deliver docs (pdf, jpg, etc) to my customers. I've a page in which each customer can only view or download its own files (private files) with this piece of code (shortcode):

{if isset($category.file)}
{foreach $category.file as $file}
<a href="{$file.url}"{if $file.new_page} target="_blank"{/if}>{$file.title}</a>
{if $file.show_size}
[{$file.size}]
{/if}

When clicked by the user, a href tag produces the download of pdf files. The question is: how can I modify this code in order to force viewing pdf files in an iframe or google docs viewer embed in the same page? (Instead of downloading them).

Thank you very much in advance for your help.

developerahusain
New php-forum User
New php-forum User
Posts: 44
Joined: Tue May 28, 2013 10:04 pm
Location: India,Lucknow

Re: Force view pdf in gDocs viewer or iframe

Postby developerahusain » Wed Jun 12, 2013 11:41 pm

its very easy.

use iframe like this
<iframe src="yourpage.pdf" scrolling="yes" height="500" width="800" frameborder="0"></iframe>

developerahusain


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest