Support » Plugin: Simple Download Monitor » Force download of PDF

  • Resolved asw

    (@astreetweb)


    I want my pdf files to download instead of open in browser window. I tried adding download to link url but the file just still just opens instead of downloading e.g.

    My File

    How can I force a download with this plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi, you can use the following shortcode.

    [sdm_download_link id=255]

    Or the following code.

    <a href="[sdm_download_link id=255]" target="_blank">Download Link</a>

    Let me know if this is what you are looking for.

    Regards

    asw

    (@astreetweb)

    No, target_”blank” opens document in new window. I found a solution. To .htaccess file add:

    AddType application/octet-stream .pdf

    This will cause ALL pdfs to download instead of open in browser window – which, in my case, is what I wanted. It looks like, if you are using W3TC, you need to paste it AFTER the “W3TC Page Cache core” stuff. YMMV

    Plugin Contributor mbrsolution

    (@mbrsolution)

    I am glad you resolved your issue. Well done 🙂

    I am sorry that I forgot to point you in the right direction. Here is a URL force-a-file-to-download-instead-of-showing-up-in-the-browser to achieve what you wanted.

    I am trying to do the same thing, but am not very familiar with setting up .htaccess file. Where do I need to put the
    AddType application/octet-stream .pdf
    part?
    My .htaccess file looks like that:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Do I have to put it inside the <IfModule> part?

    • This reply was modified 3 years, 7 months ago by sinitita.
    Plugin Contributor mbrsolution

    (@mbrsolution)

    @sinitita, can you start a new support thread. This one is marked as resolved.

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Force download of PDF’ is closed to new replies.