SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to let user download a PDF file or view it in a PDF client (WP 2012 child)

    I want to let the end user click a button or hyperlink to download a PDF file from the site or open it in the PDF client installed on the user's computer.

    Adding a normal hyperlink displays the contents of the PDF in the internet browser and is not suitable for more than a small amount of content.

    I would appreciate any suggestions.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    Quote Originally Posted by johnrp View Post
    Adding a normal hyperlink displays the contents of the PDF in the internet browser and is not suitable for more than a small amount of content.
    Only some browsers do that; others just download it for you. But browsers are a perfectly good tool for viewing PDFs, in my experience anyway, so I'm not sure why you say it's not suitable for a long document to display in a browser.

    You can force a PDF to download, but I'm not sure it's a good idea to interfere with normal browser behavior.

  3. #3
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,149
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    As an end user, I prefer to view PDFs, even large PDFs, in the browser. Then I can choose to save it somewhere only if I decide to keep it. Ralph's right that you can still force it to always download, I believe with Content-Type: application/octet-stream, but I urge you to not do that.
    "First make it work. Then make it better."

  4. #4
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks for the responses.
    The PDF files have a fair bit of content arranged with bookmarks to give the user an overview of what is there and a way to navigate directly to what they want to view.
    In Firefox I was not able to activate the bookmarks and found navigating the content more difficult than in a PDF client.
    Also many users will want to save the content to use as an off-line reference.

  5. #5
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved!
    I have just worked out how to display bookmarks as a treeview in Firefox so this does what I want.

    Thanks for the benefit of your experience.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    Quote Originally Posted by johnrp View Post
    Also many users will want to save the content to use as an off-line reference.
    As Jeff said, there's always the option to Save As ... though people don't necessarily know that—always the problem with technology.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •