WordPress.org

Ready to get started?Download WordPress

Forums

Force download of pdf (4 posts)

  1. danfloun
    Member
    Posted 5 years ago #

    Hey,

    How can I force the download of pdf files instead of them opening in the browser via Adobe pdf plugin.

    I know you can do this through php but is there something that will do this without editing code?

    Cheers
    Danny

  2. thisisedie
    Member
    Posted 5 years ago #

    What does this have to do with WordPress?

  3. danfloun
    Member
    Posted 5 years ago #

    Everything,
    My site sometimes includes links to pdf file of interest but it tries to open them in the browser. I want the user to download them instead.

  4. ClaytonJames
    Member
    Posted 5 years ago #

    This happens because most plugins or handlers installed for .pdf files are set by default to open .pdf's in a browser window (Adobe reader, for one), then give the viewer the option to save a copy of the document locally. You can compress the .pdf and offer the .zip for download. Zip files usually open a dialog for the user, and asks if they want to open or save the file, as opposed to the pdf plugin that usually just opens the document. I think you could also force the download via javascript, but that will indeed require some code editing, and I question how safe it may be. If your http server is under your complete control, you may be able to force the pdf to download by changing your mime.types configuration.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.