0

is there's a way to show a PDF file inside Post in wordpress ? i used tag but if someone have Internet Download Manager , Dialog will appear to Download the PDF file if visitor click cancel they will not be able to see it ONLY download it so is there's a way to Stop automatic download
there's many plugins for that but image quality is too bad

please some one help me ,

thanks

  • Since you had tried existing solutions and quality is not sufficient, what other answer are you looking for? You will never have same degree of control over PDF as over HTML page. – Rarst Jun 23 '14 at 14:15
1

The only reliable cross browser solution is to embed the .pdf in a iframe.

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

function my_pdf_embed($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 );

        //change the size to your liking
        $html = '<iframe width="500" height="500" src="'.$src.'"></iframe>';
        return $html; // return new $html    
    }
        return $html;
}
  • How can I apply this to a custom post ? – Pete Jan 19 '17 at 15:59
0

The Embed PDF Plugin allows you to embed a pdf inside a viewer on your post or page.

  • This plugin hasn't been updated in over 2 years :/ and it is not work – Joseph Jun 24 '14 at 20:51

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.