{"id":19,"date":"2019-02-26T18:37:49","date_gmt":"2019-02-26T18:37:49","guid":{"rendered":"http:\/\/brockster.com\/bsterblog\/?p=19"},"modified":"2019-02-27T00:02:25","modified_gmt":"2019-02-27T00:02:25","slug":"fun-with-the-html-object-tag-and-pdf-files","status":"publish","type":"post","link":"https:\/\/brockster.com\/bsterblog\/?p=19","title":{"rendered":"Fun with the HTML &lt;object&gt; Tag and PDF Files"},"content":{"rendered":"\n<p>[This post was originally published on May 1, 2017.  Updated on February 26, 2019.]<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"331\" height=\"447\" src=\"http:\/\/brockster.com\/bsterblog\/wp-content\/uploads\/2019\/02\/html5_logo-1.jpg\" alt=\"\" class=\"wp-image-58\" srcset=\"https:\/\/brockster.com\/bsterblog\/wp-content\/uploads\/2019\/02\/html5_logo-1.jpg 331w, https:\/\/brockster.com\/bsterblog\/wp-content\/uploads\/2019\/02\/html5_logo-1-222x300.jpg 222w\" sizes=\"auto, (max-width: 331px) 100vw, 331px\" \/><\/figure><\/div>\n\n\n\n<p>Well, it&#8217;s a lot more fun to code web pages here in the 21st century!<\/p>\n\n\n\n<p>With the HTML &lt;object&gt; tag, you can embed a &#8220;preview&#8221; of a file, such as a PDF file, in your plain, old, HTML code.<\/p>\n\n\n\n<p>Just do it like this:<\/p>\n\n\n\n<p><code>&lt;object data=\"name_of_file.pdf#page1\" type=\"application\/pdf\"&gt;&lt;\/object&gt;<\/code><\/p>\n\n\n\n<p>Put some alternative text between the opening and closing &lt;object&gt; tags like this, just in case the user&#8217;s browser does not support the particular file type you are using:<\/p>\n\n\n\n<p><code>&lt;object data=\"name_of_file.pdf#page1\" type=\"application\/pdf\">Sorry, your browser does not support this file type.&lt;\/object><\/code><\/p>\n\n\n\n<p>You can also put the width and height attributes on the tag, like so:<\/p>\n\n\n\n<p><code>&lt;object data=\"name_of_file.pdf#page1\" type=\"application\/pdf\" width=\"100%\" height=\"100%\"&gt;Sorry, your browser does not support this file type.&lt;\/object&gt;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[This post was originally published on May 1, 2017. Updated on February 26, 2019.] Well, it&#8217;s a lot more fun to code web pages here in the 21st century! With the HTML &lt;object&gt; tag, you can embed a &#8220;preview&#8221; of a file, such as a PDF file, in your plain, old, HTML code. Just do &hellip; <a href=\"https:\/\/brockster.com\/bsterblog\/?p=19\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Fun with the HTML &lt;object&gt; Tag and PDF Files<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":5,"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":59,"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/59"}],"wp:attachment":[{"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brockster.com\/bsterblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}