• I used to be able to insert a PDF document from Media library and using this code:
    <embed src="https://localhost/xxxx/wp-content/uploads/2019/10/Website-1.pdf" type="application/pdf" width="774" height="774"></embed>

    There has never been a problem with this – the document resized beautifully on any screen.

    I’ve had to update the theme I am using and to my surprise, the PDF document is not mobile-friendly anymore. Before I contact the theme developers (who are not very responsive), would this have something to do with the theme or WordPress itself? I have WordPress 5.4?

    I use the Classic Editor and would prefer to use it, not the Guttenberg or Elementor.
    I would also prefer not to use a plugin or iframe. Any suggestions would be very welcome. Thank you.

    • This topic was modified 4 years, 7 months ago by mica123.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Have you tried not using a width attribute in your embed? Or changing the width to 100% instead? Then as your content area shrinks, it should be responsive and shrink too.

    Thread Starter mica123

    (@mica123)

    Many thanks for replying. Funnily enough, I tried the 100% for width just before you wrote. It does work but does not shrink properly when it gets below 399px.
    I am not sure what you mean by width attribute? I did put the width in my code but that does not work anymore.

    • This reply was modified 4 years, 7 months ago by mica123.

    The width attribute is simply the width="774" bit! ie the width. Similarly the height attribute is height="some_figure"

    • This reply was modified 4 years, 7 months ago by digbymaass.
    Thread Starter mica123

    (@mica123)

    Thank you. Yes, this is exactly what I did – please see my code in my earlier post above:
    <embed src="https://localhost/xxxx/wp-content/uploads/2019/10/Website-1.pdf" type="application/pdf" width="774" height="774"></embed> But for some reason it doesn’t work anymore in this updated theme. Fortunately, it works with width”=100%”

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Embed PDF without plugin’ is closed to new replies.