MSzturc / obsidian-better-pdf-plugin

Goal of this Plugin in to implement a native PDF handling workflow in Obsidian
209 stars 16 forks source link

option for displaying pdfs in different locations #7

Open nift-d opened 3 years ago

nift-d commented 3 years ago

it would be nice to link pdfs that are not inside the vault but somewhere else on the filesystem. when I try to do that I get an error showing the url where the plugin tried to find the file and it shows the location of my attachments plus the url I told it to look up. it would be great if I cloud flag the url as "external" or something like that...

MSzturc commented 2 years ago

I will have a look on this after i've decided how i implement mobile support. Specially on iOS it's not that easy to access files outside your vault

kenandotfyi commented 2 years ago

+1 for this. That would be really a killer function because Obsidian and other type of Cloud syncing do not work together very well. My use case was to store all my edited PDFs on my Google Drive and since they are always in sync with my Mac, I link them inside Obsidian for access. Therefore whenever I open a note I always have the actual version of that PDF with annotations, drawings etc. embedded into the note.

The problem here Is just the way the plugin takes the link path. Or default API that Obsidian provides is doing that probably. It is directly adding it to the end of a ghost path which is the vault itself. Normally with "file://" we can link documents from outside the vault. I'm not sure how much of an effort it is to implement but obviously there is a limitation for iOS here. Might not even possible due to security reasons anyway. But that would be really cool to have 🤤.

Thanks a lot for your efforts by the way.

WizzardMaker commented 1 year ago

+1

This feature would be awesome! It would really improve the workflow with all my external pdfs

ShootingKing-AM commented 1 year ago

++1 Its okay if its only shows the file if available. Can show a small warning if the file is not available on mobile platforms for now. My idea was, to have extra "url" like options, "ext_desktop_url" (optional "ext_ios_url", "ext_android_url") This plugin would be awesome with this feature.

ShootingKing-AM commented 1 year ago

Since the dev is not responding quick enough for me, made a hacky way for using pdfs at the other location taking clue from the code, https://github.com/MSzturc/obsidian-better-pdf-plugin/blob/4c2db40728a083a7aa86f1ac0c379e9c9c40f5f3/main.ts#L46

workaround (hacky), for now, can be something like this

pdf
{
    "url": "../../../../Users/Dropbox/meow Dropbox/PYQ/meow.pdf"
}

instead of

pdf
{
    "url": "D:/Users/Dropbox/meow Dropbox/PYQ/meow.pdf"
}

On windows, at least the vault and the external pdf must be on the same drive for .. based directory traversing.

Maybe you can make a workaround of mobile devices by creating two such pdf links. (Don't know how user friendly your mobile OS is)

Eg. Will open on desktop; error on mobile

pdf
{
    "url": "../../../../Users/Dropbox/meow Dropbox/PYQ/meow.pdf"
}

will open on mobile error on desktop

pdf
{
    "url": "../<mobile dropbox path>/meow.pdf"
}