Getting Safari to open PDF files in Preview, NOT Safari (under Mavericks)

Discussion in 'Apple' started by DaveC, Nov 7, 2013.

  1. DaveC

    DaveC Guest

    In past OS X versions I've used a Terminal command to set my PDF viewer
    preference to Preview rather than Safari. This is the method for Mavericks,
    supposedly:

    <http://apple.stackexchange.com/questions/106660/how-make-safari-7-open-pdf-
    files-in-preview-instead-of-opening-them-in-page>

    The desired result is that after clicking on a link that is the URL to a PDF
    file, Preview launches and the PDF file displays in that application. 

    For me this does not happen. Instead, a new web page opens in Safari and
    garbage fills the page.

    Any idea how I can get a PDF file on the web to download and open in Preview

    Thanks,
    Dave

    OS X 10.9 Mavericks
    Mac mini (2011_5,3): 2.7 GHz dual i7 / 16 GB / 250 GB & 750 GB
     
    DaveC, Nov 7, 2013
    #1
    1. Advertisements

  2. The standard way for quite some time was to select the PDF file in the
    Finder, then click Command-I to Get File Information. In that dialog,
    there's a "Open With" drop down selector. The default application for
    ..PDF is displayed. If you click on the default and let the selection
    drop down to Safari, it will open that file with Safari. If you click
    on the Change All button, all files with the .pdf extension will be
    opened with Safari.
     
    Michael Vilain, Nov 7, 2013
    #2
    1. Advertisements

  3. That setting is for double-clicking on files that have already been
    downloaded. The question was about how to open PDF web pages this way.
     
    Barry Margolin, Nov 7, 2013
    #3
  4. Inside of Safari or any other web-browser, I've used a separate utility
    that sets the "helpers" database. I've used it since 10.2 and it still
    works.

    https://www.macupdate.com/app/mac/14618/rcdefaultapp
     
    Michael Vilain, Nov 7, 2013
    #4
  5. DaveC

    Doc O'Leary Guest

    Uh, perhaps that "garbage" *is* the PDF. Which is to say, the server
    might be more at fault than your Mac. How about giving a URL so that we
    have some chance of seeing what you're seeing?
     
    Doc O'Leary, Nov 7, 2013
    #5
  6. DaveC

    DaveC Guest

    Inside of Safari or any other web-browser, I've used a separate utility
    Thanks for that possibility Michael. I installed it.

    But my experience is unchanged. When I click on a link that is a PDF file it
    opens in a browser window.

    I've configured RCD as best I can figure it out. Seems that for PDF it's
    already pretty well set-up. Under "Extensions" I did check the box "Override
    file creator" for PDF.

    This is an example of what I want to open in Preview:

    <www.irs.gov/pub/irs-pdf/f8880.pdf>

    Nothing fancy about the file...

    Ideas?

    Thanks!
     
    DaveC, Nov 7, 2013
    #6
  7. The main issue is that you have to convince Safari that it should
    download the file instead of just linking to it. Once it downloads, the
    preference from Get Info or RCDefaultApp will take effect.

    You can force a download with Option-click.
     
    Barry Margolin, Nov 7, 2013
    #7
  8. DaveC

    notme Guest

    The main issue is that you have to convince Safari that it should
    Which makes it a 2-step process.

    In Snow Leopard I could Cmd-Click on a link and it would 1) download the PDF
    and 2) open it in Preview in 1 step.

    I'm looking to duplicate that process in Mavericks.

    Thanks.
     
    notme, Nov 7, 2013
    #8
  9. Have they removed the "Open safe documents after downloading" option
    from Preferences->General?
    Cmd-Click is "Open link in new window", isn't it?

    Whether it does #2 is controlled by the above preference.
     
    Barry Margolin, Nov 7, 2013
    #9
  10. DaveC

    Lewis Guest

    That is *not* for Mavericks. that worked in 10.6 (and maybe 10.5?) but
    it doesn't work in 10.9.
     
    Lewis, Nov 7, 2013
    #10
  11. DaveC

    DaveC Guest

    Have they removed the "Open safe documents after downloading" option
    It's there in Mav. But it lies. No opening after downloading. Still opens in
    Safari.
    Right you are. But click the link or Cmd-click, both will open the PDF in a
    Safari window.
    Supposedly. But it doesn't. Hence my questions here.

    Thanks.
     
    DaveC, Nov 7, 2013
    #11
  12. DaveC

    DaveC Guest

    DaveC, Nov 7, 2013
    #12
  13. DaveC

    David Empson Guest

    That article says the method which _previously_ worked (defaults write
    com.apple.Safari WebKitOmitPDFSupport -bool YES) does not work any more
    with Safari 7. Incidentally, the same applies to Safari 6.1.

    With that setting, earlier versions of Safari would download a PDF with
    a simple click on a link, rather than displaying the PDF in Safari. (You
    also had to get rid of the Adobe PDF plugin, if you had installed Adobe
    Reader.)

    I already had that setting enabled, and had the same problem with Safari
    6.1 and 7. Until a better solution presents itself, I've turned off that
    setting with:

    defaults write com.apple.Safari WebKitOmitPDFSupport -bool NO

    This restores the standard behaviour of Safari, and PDFs are now
    displaying in Safari (rather than seeing a page full of the raw data of
    the PDF in text form). From there, I can save them.

    Alternatively, I can secondary click on the link and choose Download
    Linked File, but this is a nuisance as some web sites don't make it
    clear that the link you are about to click on is a PDF rather than
    another web page.
     
    David Empson, Nov 7, 2013
    #13
  14. The setting in TinkerTool that used to do this is also now gone,
    presumably because the current version of Safari no longer supports it.
    The only way to do this now seems to be "Download Linked File" on the
    contextual menu.
     
    Neill Massello, Nov 7, 2013
    #14
  15. I think the issue is whether Safari considers PDF files to be "safe".

    I use Chrome, not Safari. Sometimes it downloads a PDF and opens it
    immediately. Other times it downloads the PDF and then displays a
    warning at the bottom that the file may be dangerous, do you want to
    keep it?

    So it seems like there are different kinds of PDF files, and some of the
    contents may render them "unsafe". When they're not safe, you have to
    open them manually.
     
    Barry Margolin, Nov 7, 2013
    #15
  16. DaveC

    Lewis Guest

    No, it's the combination of Safari 7 and the old defaults write preference.
     
    Lewis, Nov 7, 2013
    #16
  17. DaveC

    dorayme Guest

    Which is not so bad surely, it is not as if there is any time
    consuming double downloading. But, no, I know, it is not exactly what
    you want. Another 2-step process, I might as well mention, is to let
    it open in Safari and right or control click and your contextual menu
    might say, as does mine, Open in Preview. Another plugin I have,
    Schubert's, has a button on it to give you an option to open in
    Preview (or whatever you want).
     
    dorayme, Nov 7, 2013
    #17
  18. DaveC

    dorayme Guest

    Interestingly, there are *some* PDFs that will happily open in iCab in
    Schubert's PDF plugin but will give an error when the Open in External
    Viewer button (in that plugin) is pressed. I don't think in this case
    it is about safety, but I don't know this. On Snow Leopard.
     
    dorayme, Nov 7, 2013
    #18
  19. In order to view a PDF file from Safari, the server must send the proper
    headers. When I used curl to download the file, I saw a valid MIME type.

    I had to be sure to remove the Adobe PDF plugins from /Library/Internet
    Plugins/{AdobePDFViewer,AdobePDFViewerNPAPI}.plugin

    Then Safari correctly displayed the file.

    The RCDefaultApp pref sets the download behavior for various MIME types
    and extensions. It won't override the behavior of entering a URL with a
    PDF file into the URL bar and having Safari or any other browser issue a
    "GET" to fetch the file. AFAIK, that's how browsers work and you can't,
    short of using a script or some other chicanery, change that behavior.

    $ curl -v http://www.irs.gov/pub/irs-pdf/f8880.pdf -o x.pdf
    * About to connect() to www.irs.gov port 80 (#0)
    * Trying 23.72.181.73...
    * Adding handle: conn: 0x7fec08807200
    * Adding handle: send: 0
    * Adding handle: recv: 0
    * Curl_addHandleToPipeline: length: 1
    * - Conn 0 (0x7fec08807200) send_pipe: 1, recv_pipe: 0
    % Total % Received % Xferd Average Speed Time Time Time
    Current
    Dload Upload Total Spent Left
    Speed
    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
    0* Connected to www.irs.gov (23.72.181.73) port 80 (#0)
    < HTTP/1.1 200 OK
    < Last-Modified: Fri, 11 Oct 2013 01:55:03 GMT
    < ETag: "306bb-16828-4e86d68224bc0"
    < Accept-Ranges: bytes
    < Content-Length: 92200
    < Content-Type: application/pdf
    < Date: Thu, 07 Nov 2013 22:59:10 GMT
    < Connection: keep-alive
    <
    { [data not shown]
    100 92200 100 92200 0 0 292k 0 --:--:-- --:--:-- --:--:--
    687k
    * Connection #0 to host www.irs.gov left intact
     
    Michael Vilain, Nov 7, 2013
    #19
  20. DaveC

    Wes Groleau Guest

    I do not know how to change the choice from in-line viewer to Preview.

    But I suspect that seeing "garbage" instead of what you are supposed to
    see is because the web server identified the item as something other
    than PDF, i.e., as 'test' or 'html'

    As others asked, can you provide the URI?

    If not, turn on your Develop menu and see if that will help you
    troubleshoot.

    Or just change browsers permanently or temporarily.
     
    Wes Groleau, Nov 7, 2013
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.