PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 18, 2022

[FIXED] how can I embed a pdf in a wordpress.com post? why do <iframe>,<embed>, <object> not work / disappear from post

 January 18, 2022     html, wordpress     No comments   

Issue

I'm trying to embed a pdf document in a wordpress post using

<iframe src="https://path.to/my.pdf" height="900" width="1200"></iframe>

The embedded document shows up in the preview while editing when using the visual editor, but it doesn't show up when I publish the post.

Also, when I open the post for re-editing, the <iframe> block is missing.

Following the answers here I also tried using <embed> and <object>, the result is the same.

Am I doing something wrong?


Solution

According to this official wordpress.com documentation there is a oembed feature enabled for any plan.
Embedding a PDF File

So embedding is done by simply pasting your file url to your content.
(similar to the auto embed feature for youtube urls).

As Brad noted

Keep in mind, not all browsers can even open PDFs.

(Even though integrated pdf support is really decent – pretty much any chromium, webkit or Firefox) You should also provide a simple file link opening/downloading your pdf in a new tab. This way, you will also get a better reading experience as your pdf viewport isn't reduced by any layout margins.

Edit:
I can confirm, this embedding method is working as described – also on a free wordpress.com plan.



Answered By - herrstrietzel
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing