elias-sundqvist / obsidian-annotator

A plugin for reading and annotating PDFs and EPUBs in obsidian.
GNU Affero General Public License v3.0
1.46k stars 68 forks source link

Google Drive Support #75

Open robertofgama opened 2 years ago

robertofgama commented 2 years ago

Hello, first thank you for your plugin, is wonderful, helps me a lot.

So i like to suggest a implementation, would be perfect if you can add a support for Google Drive files, i have a lot of my PDFs hosted there, and now for read them with Annotator plugin i need to download them, but i think than would be perfect if i can just add link of them.

elias-sundqvist commented 2 years ago

You can use https://sites.google.com/site/gdocs2direct/ to generate a direct-link to the drive file.

These links don't end with .pdf or .epub, so you also have to specify the file type in the frontmatter, like this:

---
annotation-target: https://drive.google.com/uc?export=download&id=1-yW9hNOfSAo81EtHbGNc9B3GjJqejOtO
annotation-target-type: pdf
---

Note that this doesn't work on mobile yet, since I have not added a CORS workaround for mobile.

Another option is to use something like google drive sync, and use file:// URLs to access the pdf. (See #16)

robertofgama commented 2 years ago

thanks man, it worked for me, and i already using. But is a problem for private/confidential docs, so if you can put on your roadmap for the future a authentication in google drive api will be great.

Again thanks for make my life easy with your plugin.

Chris-mik commented 2 years ago

Thanks for this nice plugin! Is there any similar method for Onedrive?

elias-sundqvist commented 2 years ago

Thanks for this nice plugin! Is there any similar method for Onedrive?

You could maybe try following these instructions to get a direct link: https://bydik.com/onedrive-direct-link/ I haven't tested it, but it could potentially work.

Otherwise I think the simplest way is probably to sync onedrive to your computer and use a file: url to the path. (see https://en.m.wikipedia.org/wiki/File_URI_scheme#Examples for examples of file: urls.)

If you often want to link to files in a certain local folder, then you can use the "Custom Default Path" setting. and write the file url to the folder (including the final slash). Then you just have to write the pdf name as the annotation target.

Chris-mik commented 2 years ago

Thanks for this nice plugin! Is there any similar method for Onedrive?

You could maybe try following these instructions to get a direct link: https://bydik.com/onedrive-direct-link/ I haven't tested it, but it could potentially work.

Otherwise I think the simplest way is probably to sync onedrive to your computer and use a file: url to the path. (see https://en.m.wikipedia.org/wiki/File_URI_scheme#Examples for examples of file: urls.)

If you often want to link to files in a certain local folder, then you can use the "Custom Default Path" setting. and write the file url to the folder (including the final slash). Then you just have to write the pdf name as the annotation target.

I have followed the "Custom Default Path" and worked perfectly! Thanks 🙏