admin管理员组文章数量:1327524
Is there a way to show a PDF file inside Post in Wordpress? I used the tag but if someone has Internet Download Manager the Dialog will appear to Download the PDF file and then if they click cancel they will not be able to see it, they can ONLY download it
Is there's a way to stop automatic download?
There are many plugins for that but the image quality is too bad.
Is there a way to show a PDF file inside Post in Wordpress? I used the tag but if someone has Internet Download Manager the Dialog will appear to Download the PDF file and then if they click cancel they will not be able to see it, they can ONLY download it
Is there's a way to stop automatic download?
There are many plugins for that but the image quality is too bad.
Share Improve this question edited Aug 14, 2020 at 12:17 ChrisM 1271 silver badge8 bronze badges asked Jun 23, 2014 at 11:24 JosephJoseph 12 bronze badges 1- 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 Commented Jun 23, 2014 at 14:15
2 Answers
Reset to default 1The 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;
}
The Embed PDF Plugin allows you to embed a pdf inside a viewer on your post or page.
本文标签: pluginsEmbed PDF into wordpress
版权声明:本文标题:plugins - Embed PDF into wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742187535a2429615.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论