If you want to view, directly from a post (article, page), the content of a PDF file without clicking on it, different plugins can be used or, if you want to avoid loading with foreign content, you can make a small shortcode for something like that. An example is given below, entered in the functions.php file (preferably in a child theme):
1 2 3 4 5 6 7 8 |
function soy_fc_pdf($attr, $url) { extract(shortcode_atts(array( 'width' => '800', 'height' => '600' ), $attr)); return '<embed src="' . $url . '" type="application/pdf" style="width:' .$width. 'px; height:' .$height. 'px;min-width:800px;min-height:600px;margin:0 auto;display:block;">'; } add_shortcode('pdf', 'soy_fc_pdf'); |
Thus, to display the contents of a PDF file, you need to write the following code:
[pdf width="" height="850"]https://tic.ovio.ro/wp-content/uploads/2021/05/docum_1-1.pdf[/pdf]
Of course, this option can be used to embed in any HTML file, in any way, without involving WordPress if only plays the tag “embed”:
<embed src="https://tic.ovio.ro/wp-content/uploads/2021/05/docum_1-1.pdf" type="application/pdf" style="width:860px; height:700px;min-width:800px;min-height:600px;margin:0 auto;display:block;">