Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to insert a Pdf visualizer to read my wp articles. So I can print go through pages like the one in www.scribd.com Is there any plugin for that? I tried "Google Doc Embedder" plugin but I couldn't make it work..

Thanks for your help!

share|improve this question
add comment

4 Answers

You can put this in your theme functions.php file, It will work in any browser ( I tested this since it uses an iframe) and auto embed .pdf files from the media tab when you click "insert into post".

You can alter the width and height parameters for the size when its added to the editor.

add_filter('media_send_to_editor', 'my_filter_pdf', 20, 3);

function my_filter_pdf($html, $id) {
    $attachment = get_post($id); //fetching attachment by $id passed through

    $mime_type = $attachment->post_mime_type; //getting the mime-type
    if ($mime_type == 'application/pdf') { //checking mime-type
        $src = wp_get_attachment_url( $id );

        $html = '<iframe width="500" height="500" src="'.$src.'"></iframe>';
        return $html; // return new $html    
    }
        return $html;
}

I made a plugin version here for you, create a php folder and inside that a .php file in your WordPress /plugins folder and paste this into it. https://gist.github.com/2176359

share|improve this answer
1  
Please return something in cases where your if statement returns false. –  toscho Dec 16 '12 at 13:52
    
I guess that would be important! –  Wyck Dec 16 '12 at 17:17
add comment

here's a pdf viewer based on html5 and js which firefox added to its extensions :

http://andreasgal.com/2011/06/15/pdf-js/

and here's a demo of it :

http://mozilla.github.com/pdf.js/web/viewer.html

but I don't know how you make your articles into pdf's.

share|improve this answer
add comment

You could find out what isn't making the Google Doc Embedder plugin work for you. As the developer of that plugin, I can hopefully provide some support to whatever issue you're having...

http://wordpress.org/tags/google-document-embedder#postform

share|improve this answer
add comment

Use the plugin specific for embedding PDFs.

And don't forget to accept one of the answers given to you.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.