WordPress.org

Ready to get started?Download WordPress

Forums

PDF display in WordPress 3 (24 posts)

  1. Ballet News Admin
    Member
    Posted 4 years ago #

    Hi, I know that you can link to a pdf document in WP, but I want to actually display the document on the page.

    Can this be done and if yes,how ?

    Would really appreciate a quick answer as I have to complete this task today. Thank YOU !

  2. Rahul Sonar
    Member
    Posted 4 years ago #

    <embed src="NAME OF FILE.pdf" width="500" height="375">

  3. Ballet News Admin
    Member
    Posted 4 years ago #

    Thank you very much. One question : where do I put the coding ? Thanks

  4. Rahul Sonar
    Member
    Posted 4 years ago #

    If you want to display pdf file in your post, go to HTML editor and place this code...

  5. Ballet News Admin
    Member
    Posted 4 years ago #

    thank you. Anywhere in the editor - or where I want the page to display ? I have text to add as well.

    Also, how do I get the PDF into the media gallery in the first place ?

    Thanks

  6. Rahul Sonar
    Member
    Posted 4 years ago #

    I will show you step by step:

    1) Go to media -> Add New, upload a file. Once file is uploaded, you will get File URL. Copy that file URL. (Let me call it MY_PDF_URL)

    This will be a complete URL, with http://yourdomain.com in it..
    2) Now, go to add new post and switch to html editor. Place this code where you want to show the pdf file....

    <embed src="MY_PDF_URL" width="500" height="375">

    -------------

    added: wait.. I think this is not working for wordpress. Because wordpress is changing the complete code.. !!!

    You can place that code in your template files.. or use this plugin..
    http://wordpress.org/extend/plugins/pdf-and-ppt-viewer/

  7. Ballet News Admin
    Member
    Posted 4 years ago #

    sorry I did all that, actually I imported the pdf from my computer. All I get is a big brown square - and that's before I upload the media - when I added your code. Adding the media into the post still just gives me a link and even that goes nowhere

  8. Rahul Sonar
    Member
    Posted 4 years ago #

    using that plugin and steps I provided works together perfectly..

  9. Ballet News Admin
    Member
    Posted 4 years ago #

    Sorry, what plug in ? You gave me code to use. And it doesn't work at all, let alone perfectly !

  10. Rahul Sonar
    Member
    Posted 4 years ago #

    Yes, this is not working for wordpress. Because wordpress is changing the complete code.. !!!

    You can place that code in your template files.. or use this plugin..
    http://wordpress.org/extend/plugins/pdf-and-ppt-viewer/

    using that plugin and steps I provided works together perfectly..

  11. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    Great tip Rahul, but I think for valid XHTML you would probably want to close the embed tag:
    <embed src="MY_PDF_URL" width="500" height="375"/>

  12. Ballet News Admin
    Member
    Posted 4 years ago #

    IT DOESN'T WORK. All it does is link to the document.

    Can you provide clear steps that work please ?

    I have installed and activated the plugin you suggested.

  13. Ballet News Admin
    Member
    Posted 4 years ago #

    Hi, has everyone given up with this ?

    If I could have a step by step list of what to do, using the plugin, that would be really helpful.

    I'm on a deadline and have to get this out in an hour. thankyou so much

  14. Rahul Sonar
    Member
    Posted 4 years ago #

    Thanks for the correction cubecolour..
    Upload that plugin and activate it.

    Then use the code I have provided in your post (HTML editor):

    <embed src="MY_PDF_URL" width="500" height="375"/>

    This will work. See this post:

    http://www.amrita-rao.in/latest-pictures/test/

    Password: 12345678

  15. Ballet News Admin
    Member
    Posted 4 years ago #

    Well, I've had a wordpress expert have a go because obviously I can't get it to work. This is what I was told : For the plugin, in IE I see a blank box come up. It seems to be
    denying cookies to google docs by default (which it uses to display).

    So what do you suggest now ?

    We even tried a diffrent plugin which still didn't work.

    thanks

  16. Rahul Sonar
    Member
    Posted 4 years ago #

    then you can always upload pdf files to your server. Use media library available in wordpress, which will upload documents on your server. Then use that URL in that code.

    I dont know if google docs provide such feature.

  17. Ballet News Admin
    Member
    Posted 4 years ago #

    That's what I did before I posted here. It does not work

  18. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    The code works perfectly for me on a test site I've been messing around with. No plugin required.

    I uploaded the pdf via the media uploader, copied the file's URL to the clipboard & pasted it into the line as the embed source, so the line I put in was:
    <embed src="http://sample.bandrocks.co.uk/files/2010/09/Marketing.pdf" width="640" height="480"/>

    I've only viewed it in Firefox OSX so far, so I don't know yet whether other browsers may not understand it.

    Can you see the embedded pdf on the following page?

    http://sample.bandrocks.co.uk/about/

  19. Ballet News Admin
    Member
    Posted 4 years ago #

    thank you. Yes, I can see the embeded pdf on the link you sent.

    But still, in IE8, it does not work. It has to work across all browsers to be any good for my readers.

  20. Ballet News Admin
    Member
    Posted 4 years ago #

    ps when I use that code, all I get is a link to the pdf, not the embeded pdf itself. That's why we tried two plugins and neither worked. On some browsers they may work, but unless they work over all browswer and IE8 since that is mine, it's hopeless.

    Surely WP has overcome this issue ?

  21. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    I don't believe it is fair to consider this a WordPress Issue.

    I've just had a look at the sample page I posted on my daughter's netbook running windows7 with IE8 & adobe reader installed and I can see the embedded pdf.

  22. 5kywalker
    Member
    Posted 3 years ago #

    cubecolour & Rahul, you're advice throughout this post was excellent. So rather than start my own thread I thought I would continue this one.

    I have built a timeline and would like to display it similar to this one;
    http://www.monitoraudio.co.uk/biography/timeline

    Which I think has been presented using shockwave.

    So far I have tried two approaches;
    1. I have uploaded my timeline as a PDF to my web server, its dimensions are 3363 × 595. Using the code you provided the PDF does not appear, instead I have a striped box in the dimensions of my PDF, but without any content and at the centre 'click to download plugin'.

    2. I have used the WYSWYG 'Insert /Edit embedded media' icon and embedded the PDF as a Shockwave element. Sadly this produces the same result.

    In each case there is no plugin available to download.

  23. voodoojar
    Member
    Posted 3 years ago #

    Do it like this

    <iframe src="http://docs.google.com/gview?url=http://thebookhousepub.com/menus/food2.pdf&embedded=true" style="width:880px; height:1200px;" frameborder="0"></iframe>

  24. godkid
    Member
    Posted 3 years ago #

    the advice given cubecolour and Rahul is sound. The issues experienced I would say is WP related.

    Why?

    IF you switch from HTML to VISUAL mode after writing in your code, WP automatically changes your code to the shockwave plugin display - thereby breaking it.

    My suggestion?

    Complete your post, and RIGHT before publishing, switch to HTML mode and insert the embed code as directed. Hit "Update" WHILE IN HTML MODE and you should be fine. Do NOT update the post while in VISUAL mode.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags