# One-click PDF files opening in default system app

**URL:** <https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918>\
**Category:** Feature requests\
**Tags:** ui-ux\
**Created:** [September 4, 2022, 2:06pm UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918 "2022-09-04T14:06:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cycreek](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cycreek/32/34173_2.png) [@cycreek](https://forum.obsidian.md/u/cycreek)\
**Post date:** [September 4, 2022, 2:06pm UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/1 "2022-09-04T14:06:20Z")

</div>

### Use case or problem

In my workflow, I have to open and annotate many documents such as Word, Excel and PDF files. When left-clicking on Office files in the File Explorer, they usually open right away in their default app. However, PDF files don’t open in Preview (Mac) but rather in what seems like an embedded web version of a PDF reader.

### Proposed solution

The solution is right-clicking on the document and choose “Open in default app” but I feel like this is an extra step that could be simplified by **creating a new setting such as “Always open PDF files in default app”.**

---

<div class="post-metadata">

**Author:** ![Ashton\_Huang](https://forum.obsidian.md/user_avatar/forum.obsidian.md/ashton_huang/32/29355_2.png) [@Ashton\_Huang](https://forum.obsidian.md/u/Ashton_Huang)\
**Post date:** [September 5, 2022, 8:25am UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/2 "2022-09-05T08:25:27Z")

</div>

+1  
Want that too

---

<div class="post-metadata">

**Author:** ![jesseb34r](https://forum.obsidian.md/user_avatar/forum.obsidian.md/jesseb34r/32/35464_2.png) [@jesseb34r](https://forum.obsidian.md/u/jesseb34r)\
**Post date:** [October 8, 2022, 2:06am UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/3 "2022-10-08T02:06:58Z")

</div>

I would love this. If I want to see it in obsidian I can always embed but opening outside has a ton of friction right now.

---

<div class="post-metadata">

**Author:** ![justephens](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/j/f475e1/32.png) [@justephens](https://forum.obsidian.md/u/justephens)\
**Post date:** [January 23, 2023, 5:56am UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/4 "2023-01-23T05:56:59Z")

</div>

Would also really appreciate having an option to set this behavior as default.

---

<div class="post-metadata">

**Author:** ![y.jiji](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/y/45deac/32.png) [@y.jiji](https://forum.obsidian.md/u/y.jiji)\
**Post date:** [February 25, 2023, 6:07am UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/5 "2023-02-25T06:07:27Z")

</div>

I like this idea

---

<div class="post-metadata">

**Author:** ![tronicdude](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/94ad74/32.png) [@tronicdude](https://forum.obsidian.md/u/tronicdude)\
**Post date:** [March 4, 2023, 9:15am UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/6 "2023-03-04T09:15:36Z")

</div>

I would love for this to actually be implemented properly. In the meantime, my crummy solution is to use [Obsidian Shell Commands](https://github.com/Taitava/obsidian-shellcommands) and [Obsidian Advanced URI](https://github.com/Vinzent03/obsidian-advanced-uri) plugins.

In Shell Commands, add the following command

```plaintext
if [[{{file_extension:no-dot}} == "pdf"]]; then
var={{file_path:absolute}}
open "obsidian://advanced-uri?vault=Ext%20Brain&commandid=app%253Ago-back" #got this from advanced uri command "Copy URI for command" selected "No File" then "Navigate Back"
open $var
fi

```

Be sure to replace the advanced URI link with your own vault name.

Hit “Events” for that command, and activate “Switching the active pane”

This is a zsh script running on macOS; for other operating systems replace `open` with whatever equivalent.

It’s a simple script, it just goes back to your original note and opens the pdf with the system viewer.

A more sophisticated & correct way to do it would be making an extension and hijacking the mouse click event.

---

<div class="post-metadata">

**Author:** ![tronicdude](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/94ad74/32.png) [@tronicdude](https://forum.obsidian.md/u/tronicdude)\
**Post date:** [March 4, 2023, 11:16am UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/7 "2023-03-04T11:16:15Z")

</div>

```plaintext
if [[{{file_extension:no-dot}} == "pdf"]]; then
var={{file_path:absolute}}
open "obsidian://advanced-uri?vault=Ext%20Brain&commandid=app%253Ago-back" #got this from advanced uri command "Copy URI for command" selected "No File" then "Navigate Back"
open "obsidian://advanced-uri?vault=Ext%20Brain&eval=if%28app.workspace.getActiveFile%28%29.extension%3D%3D'pdf'%29%7Bapp.workspace.activeLeaf.tabHeaderCloseEl.click%28%29%7D"
open $var
fi

```

Updated it so it’ll close the pdf if there’s no note to navigate back to. Note you’ll have to enable “Allow executing arbitrary code via eval” in Advanced URI plugin settings.

---

<div class="post-metadata">

**Author:** ![tronicdude](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/94ad74/32.png) [@tronicdude](https://forum.obsidian.md/u/tronicdude)\
**Post date:** [March 9, 2023, 6:40am UTC](https://forum.obsidian.md/t/one-click-pdf-files-opening-in-default-system-app/42918/8 "2023-03-09T06:40:26Z")

</div>

SIKE I made a real extension that does this.  
Here ya go [GitHub - aidan-gibson/obsidian-opener: Opens pdfs with default system app and opens md in new/existing tabs.](https://github.com/aidan-gibson/obsidian-opener)
