{"id":215,"date":"2013-10-21T12:34:32","date_gmt":"2013-10-21T17:34:32","guid":{"rendered":"https:\/\/justinparrtech.com\/JustinParr-Tech\/?p=215"},"modified":"2014-06-13T16:49:04","modified_gmt":"2014-06-13T21:49:04","slug":"how-to-embed-a-pdf-in-a-wordpress-post","status":"publish","type":"post","link":"https:\/\/justinparrtech.com\/JustinParr-Tech\/how-to-embed-a-pdf-in-a-wordpress-post\/","title":{"rendered":"How to embed a PDF in a WordPress Post"},"content":{"rendered":"<p><span style=\"text-decoration: underline;\"><strong>Problem:\u00a0<\/strong> <\/span><\/p>\n<p>How to embed a PDF or other type of document inside of a WordPress post.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Additional Information:<\/strong><\/span><\/p>\n<p>There are multiple WordPress plugins that use Google Doc Viewer or some other third party to display PDF content.\u00a0 Each (modern) browser has PDF viewing capability built in, or there is a browser plugin that can view the content inline.\u00a0 For example, both Adobe Reader and Foxit Reader have the capability to view a PDF document if you paste the URL in to the address bar.<\/p>\n<p>In the event that the browser does not have PDF viewing capability, the user will simply be prompted to download the PDF<\/p>\n<p><!--more--><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Solution:<\/strong><\/span><\/p>\n<p>Use an iframe.<\/p>\n<p>In the WordPress post editor, click the &#8220;Text&#8221; tab on the right.\u00a0 Add an iframe tag at the position where you want the content to appear:<\/p>\n<p>&lt;iframe src=&#8221;\/content\/Test_Embed.pdf&#8221; height=&#8221;1000&#8243; width=&#8221;100%&#8221; \/&gt;<\/p>\n<p>The above tag produces this result when published:<\/p>\n<p><iframe loading=\"lazy\" src=\"\/JustinParr-Tech\/wp-content\/uploads\/Test_Embed.pdf\" width=\"100%\" height=\"1000\"><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Additional Considerations:<\/strong><\/span><\/p>\n<p>The PDF itself must be viewable on the internet.\u00a0 This can be accomplished a couple of ways&#8230;<\/p>\n<p>1.\u00a0 Use &#8220;Media&#8221; and publish the PDF.\u00a0 It won&#8217;t be in a recognized format, but will provide a slug that can be used with the iframe tag.\u00a0 The relative URL for the object tag will be:<\/p>\n<p><span style=\"color: #00ffff;\">\/wp-content\/uploads\/filename.pdf<\/span><\/p>\n<p>If your base WordPress folder is not the root web, you&#8217;ll need to include the base folder:<\/p>\n<p><span style=\"color: #00ffff;\">\/JustinParr-Tech\/wp-content\/uploads\/Test_Embed.pdf<\/span><\/p>\n<p>This method is useful because it allows posts to be created using only the WordPress GUI, without any file transfer tools or any other special tools.<\/p>\n<p>&nbsp;<\/p>\n<p>2.\u00a0 Create a content folder outside of the WordPress folder structure, and upload the file to your server under<\/p>\n<p><span style=\"color: #00ffff;\">\/content\/some_file.pdf<\/span><\/p>\n<p>This method provides the greatest flexibility, when using a separate static content server.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Conclusion:<\/strong><\/span><\/p>\n<p>Using a third-party embedded application (Even Google Doc viewer) complicates the publishing and viewing process &#8212; for example, some companies block Google Docs in order to maintain control over their data.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem:\u00a0 How to embed a PDF or other type of document inside of a WordPress post. &nbsp; Additional Information: There are multiple WordPress plugins that use Google Doc Viewer or some other third party to display PDF content.\u00a0 Each (modern) browser has PDF viewing capability built in, or there is a browser plugin that can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-215","post","type-post","status-publish","format-standard","hentry","category-wordpress-stuff"],"_links":{"self":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/comments?post=215"}],"version-history":[{"count":10,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts\/215\/revisions"}],"predecessor-version":[{"id":971,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts\/215\/revisions\/971"}],"wp:attachment":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/categories?post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/tags?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}