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!


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

  • 1
    Please return something in cases where your if statement returns false.
    – fuxia
    Dec 16 '12 at 13:52
  • I guess that would be important!
    – Wyck
    Dec 16 '12 at 17:17

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


and here's a demo of it :


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


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...



Use the plugin specific for embedding PDFs.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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