22 0
Contact Author Sign in to rate

Open linked pdf, docx, epub, audio/video, etc. in external Program

0.07MB. Updated 2022-07-15.
The author has shared 75 other item(s).


This description only refers to the add-on version for Anki 2.1.30+ Apple/MacOS are only partially supported, see the section "Apple/Mac" below. This add-on converts file names (and page numbers) from separate fields in your note to a clickable hyperlink that opens this file in an external application you set. This add-on allows you create a clickable hyperlink during reviews "my lecture notes.pdf - 123". When you click the hyperlink your pdf viewer will open the file "my lecture notes.pdf" on page 123. AnkiMobile and AnkiDroid don't support add-ons so this add-on is only useful on Windows, MacOS, and Linux. This add-on also works in the editor which is part of the Add window, the EditCurrent window and the bottom of the browser. If the field where you put the filename or path of the linked pdf file is not empty you'll have a context menu entry "open external_source" (or however you named this field, see the config section below). So when editing notes you can also quickly open linked files. I have used this add-on to open pdf files in Acrobat Reader, office documents in LibreOffice Writer, epub files in the calibre ebook-viewer, audio files in vlc at positions in the middle, text files in my wiki software ZIM, mindmaps in Freeplane, etc. Caveats: Use this at your own risk. # use You can download the following screencasts (gifs) by right-clicking them. Then select "save image as" from the context menu (tested in Chrome and Firefox). Then open these gifs with a program that supports to pause gif files. On Windows I use the popular image viewer IrfanView that can also display gifs. IrfanView has "Options->Start/Stop Animation" and you can adjust the speed with [SHIFT][CTRL][+] or [SHIFT][CTRL][-]. On Linux I use mpv. # Apple/MacOS I don't have a Mac so I can't adjust and test this add-on for MacOS. In MacOS some things are different so this add-on doesn't fully work on MacOS. Newer MacOS versions restrict which apps can read or modify which files (check System Preferences -> Security & Privacy -> Privacy). This security feature will interfer with my add-on and you might have to make some adjustments there. If you just want a simple pdf viewer have a look at the add-on pdf viewer. If you have solved these permission issues, about displaying pdfs: The default app for displaying pdfs in MacOS is "Preview". But there is no command line parameter like "--page" when opening "Preview" to go to a specific page. So this add-on uses a workaround with AppleScript which is slow and due to the way it works you'll briefly see a flickering box before the targeted page is opened. To use Preview use these settings - Extensions: pdf - command/program: preview - command parameters to open on specific page: PATH#page=PAGE You can also use the pdf viewers from Google Chrome (use command/program: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) or Firefox (command/program: /Applications/Firefox.app/Contents/MacOS/firefox). Safari didn't work for me. # Setup initial setup: For instructions about downloading and pausing or slowing down these screencasts see the preceeding paragraph before the first screencast. There are three steps to do: 1. Add two additional fields to all note types. The default names for these fields are "external_source" and "external_page" but you can adjust these field names in the add-on configuration. See Screencast 1 for details 2. You must add a hyperlink to the template in the "Card Types for ... " window. This add-on adds a button for this at the bottom of this window named "Ext-Docs-Link". See Screencast 2 for details 3. You must setup your external programs. In the main window go to Tools->Add-ons, then select this add-on and click the button "config". See Screencast 3 for details # Screencast 1 - Adding Fields # Screencast 2 - Adjusting the Card Templates # Screencast 3 - setup your external program If this is too complicated or doesn't work and you just need a pdf viewer have a look at the add-on pdf viewer which doesn't need any config. # Use I put the files I link to from my notes/cards into a the folder I set under "Default folder for relative paths" in the add-on settings (for each file type). Then it's enough to put in the file name. I can quickly fill out relative paths with an add-on like Field History. This approach makes sure that my links always work (after adjusting just one setting) and I don't move and break files by accident. The backslash is only used as a folder separator. You may not use "\" in a filename. # experimental feature: links from within any field Read this section carefully and fully before you use this feature. In the add-on config you can check "enable experimental feature (check the ankiweb description for details)". After restarting the following should work. Let's say you have a file named France.pdf in a folder that you have set under Default folders for relative paths for a program/extension. Then you write ___france____7 anywhere into a field in a note. Then during reviews this gets transformed into a clickable hyperlink that will open the file France.pdf on page 7. In the editor you can double-click it to open it in a pdf viewer. There are many limitations: - This is hardly tested and only for filenames (for files that are in a folder set in Default folders for relative paths). - Filenames may not contain spaces (whitespace)!!!! - All occurrences of "___" are transformed. If you have "___" in other places in your notes you'll get weird links that lead to errors when you click them. - If you run into problems and report them to me I don't know if and when I'll address them. - This add-on does not work on mobile (Ankimobile, Ankidroid, Ankiweb). Add-ons don't work on mobile. - A newer version of Anki will break this add-on at some point. I have released multiple popular add-ons over the last two years and I have updated all of them to the latest versions with little delay. But I might switch careers etc so that I have less time at this point. Who knows? So you might end up with unusable strings though I guess that with manual work and some regular expressions you should be able to transform them into something useful? # bugs, problems etc. When you click a link and nothing happens: Maybe it's a bug in my add-on or maybe there's a problem in your config - my config is not the easiest to use so maybe it's the latter and you can fix it for yourself. To find out run Anki from the command line. On MacOS the anki binary you can run from the command line is usually /Applications/Anki.app/Contents/MacOS/Anki (in 2020-11). Run this command from the app Terminal. In Windows it's C:\Program Files\Anki\anki-console.exe (though it's different for the alternate versions) which you need to run from "Command Prompt". Then Anki will print diagnostic messages in the terminal window. Whenever you click a link my add-on inserted into a card you should see the command my add-on tries to execute. Try to run this command from the Terminal/Command Prompt: If it doesn't work outside of Anki the problem is not my add-on but the config. If it works let me know. Feedback, improvements, and error reports are welcome. It's best to post these in my github repo where I can respond multiple times. # alternatives To incrementally process pdfs have a look at the add-on Searching, PDF reading & note-taking in "Add" dialog. If you just want a simple pdf viewer have a look at the add-on pdf viewer. For editing images and sound files from your cards have a look at OpenInExternalEditor,Rename,Duplicate for Image,Audio,Video. # versions - 2022-07-14 fixes for in-field links with "___"/"____"; optionally use internal pdf viewer from the add-on "pdf viewer", at least one bug fix ... (.45+ only) - 2022-03-06 misc: fix previewer, fix some other bugs, change defaults for links inside fields once more. - 2022-02-23 fix defaults for links inside field - 2021-12-12 fix import error in yesterday's version, cleanup imports - 2021-12-11 some fixes for 2.1.50/qt6, no error when external binary doesn't exist - 2021-06-03 fix for windows, e.g. for vlc - 2021-01-23 fix context menu - 2021-01-15 some bug fixes, some internal code changes - 2020-12-13 support multiple source/page fields per note, experimental feature for links to external files from within any field. - 2020-11-31 add print debugging - 2020-11-30 fix prior release, fix ebook-viewer defaults for windows. - 2020-11-24 some compatbility with Apple/Mac (see section MacOS above), some code cleanup - 2020-11-13 fix issue 4 and 6: also works if filed_for-fielname is not ending with the file extension (e.g. test.html#someid now works), browsers like chrome can be used as a pdf viewer - 2020-07-20 fix opening system apps on linux when using the binary from ankiweb. I remove some environment variables that anki set which directed to the anki binary path (e.g. LD_LIBRARY_PATH). - 2020-07-14 update for 2.1.28, ignore whitespace behind filename - 2019-11-14 - 2019-11-11 - 2019-10-21 - 2019-09-16 initial release


As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:


If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author


on 1660227485
What an absolute piece of gem. Incredible concept, beautiful execution, and good support from the developer. The setup is a little bit tricky but when you get past that it is really worth it. Thank you for sharing this add-on.

Initially I had a problem with Foxit reader on Windows not going to the pages that it was supposed to, but I found the solution in the forum. Here is the link in case someone else encounters this problem: https://forums.ankiweb.net/t/open-linked-pdf-docx-epub-audio-video-etc-in-external-program-official-thread/15723/7
on 1653330457
Works perfect here. Thank you for this addon.
on 1646198438
great addon. i used this to add my text book and school videos to all of my anki cards with the batch editor. it works great and even can fetch from a flashdrive (which is helpful for file sharing). i was going crazy trying to figure out why it wasnt working because i was trying to open the files in the preview window (it only works during "real" review, not in the preview window) i sometimes use the preview window to study. if there is an easy solution please make it work in the preview window! otherwise it works fantastic and this has really improved my studying. now when i get a card from a year ago i can easily rewatch the school video without having to think twice about digging thru files to find the specific video!
Comment from author
thanks for this review and report: I uploaded a new version that should fix the previewer. If not let me know. I'm not notified about new ratings. So please post in the official forum at https://forums.ankiweb.net/t/open-linked-pdf-docx-epub-audio-video-etc-in-external-program-official-thread/15723 where I'm notified and where we could exchange multiple messages.
on 1645343444
Thank you for your addon, If you using Windows OS, I recommand a pdf reader named 'BookX Note Pro' to you, which can copy source link every page you like, then you just paste the link to anki surounding by hyper link tag, it work well.
on 1644989109
hi I am new to anki indeep,
however this is 1 card 1 hyperlink, can it be 1 card, multiple hyperlink? i.e.


what is duke's criteria? (hyperlink to IE.pdf #page 123)
what is the treatment of IE? (hyperlink to IE.pdf #page 124)

it helps.

Comment from author
you could try the "inline-links (experimental)" functionality so that you write e.g. __IE.pdf____123

The downside is that I haven't tested this a lot and don't have time for this.

But you could also rely on general tools like a powerful clipboard manager or some scripting utility where you can set a global custom shortcut that runs a custom workflow on the selected text. I.e. it copies your selection, splits it on "____", removes the preceeding "__". then the first part is combined with your pdf folder and then a pdf viewer is called ... on windows you could use AHK . also check clipboard managers that allow you to manipulate the text from your clipboard.
on 1639225152
Thanks for your amazing addon. But I keep getting this after the latest update (I'm on 2.1.47 anki version, debian buster):

An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.

When loading '⁨Open linked pdf docx epub audiovideo etc in external Program⁩':
⁨Traceback (most recent call last):
File "aqt/addons.py", line 230, in loadAddons
File "/home/m830/.local/share/Anki2/addons21/879473266/__init__.py", line 80, in <module>
from . import config_window
File "/home/m830/.local/share/Anki2/addons21/879473266/config_window.py", line 30, in <module>
from .config_add_edit_entry import (
File "/home/m830/.local/share/Anki2/addons21/879473266/config_add_edit_entry.py", line 21, in <module>
from .config_defaults_menu import (
File "/home/m830/.local/share/Anki2/addons21/879473266/config_defaults_menu.py", line 5, in <module>
from anki.utils import (
ImportError: cannot import name 'point_version' from 'anki.utils' (/usr/local/share/anki/bin/anki/utils.pyc)
Comment from author
Thanks for the bug report. I've uploaded a new version that should fix this. Update your add-ons. If you find bugs please let me know. It's best to click the "contact author" button in the upper right of this page and post in the thread linked. For posts in the forum I get notification emails whereas I don't get any notification about reviews posted on this page.
on 1634222879
attach a video
how i can use it

Comment from author
Thanks for the hint. I re-added the missing screencasts.
on 1629061445
Such a brilliant Idea, Great work, really make study much easier.

I downloaded the gif, then using an online converter to make mp4 files.

Thank you very much!
on 1615314410
Very well made and helpful
on 1614642526
Amazing plugin, I had a problem with the vlc but now its ok.
11/10 would kiss the dev.
on 1613841020
It works perfectly.
on 1610749396
good bug fix
on 1609828407
The addon doesn't support the Foxit pdf?
Comment from author
The last time I checked about 18 months ago it did. But a lot can change in the meantime. Maybe you can setup the path manually in the add-on config. To find out the path of your foxit installation I would search google for something like "find out path of program in windows". If you installed an app from the store it's much more complicated. At the moment I don't have a windows computer so I can't help.
on 1609618286
Thanks a lot such an add-on. Thumbs up. One thing that could perhaps be considered in the future is the possibility to open links (especially for PDFs) to specific paragraphs instead of just the page number. In other words, there could be an additional field which lets you input the zoom level (eg. TopLeftZoom,318,18,1.7687) in addition to the page number. That way, the link sends you to the specified page and the the exact paragraph or section of that page.
Comment from author

I agree that opening specific positions of pdf pages would be much more useful. But as far as I know the regular pdf viewers like acrobat, sumatra or okular don't have a command line option for exact page positions. So it wouldn't work with those. But if you do know such a program let me know.

Maybe this could be done with mozillas pdfjs as a modification of my https://ankiweb.net/shared/info/319501851 - but then you'd depend on this one add-on and pdfjs is always kind of slow for me.
on 1607785985
Very helpful, thanks!
Would be great if one could add several PDF links to the same Anki note, by seperating them with a new line, maybe.
Comment from author
check https://github.com/ijgnd/anki__Open_linked_pdf-_docs-_epub-_audio-_video-_etc_in_external_Program/issues/12

The update from 2020-12-13 has some options for this.

"several PDF links to the same Anki note, by seperating them with a new line" would be useful. I didn't implement this yet because this would have been more complicated and required a fundamental redesign about how you enter the page numbers.

If you find a bug in the new version let me know in the anki forum or on github.
on 1599189074
An awesome addon.........So useful. Thanks a lot for developing this cool addon!
on 1597779703
Useful addon.
Author was nice and helpful in his Github page.
on 1584066721
I am using the "pdf viewer" well. thank you!

I am a Mac User. I really need this add-on. It's not working on a Mac. crying
I'd like to get you a pulse. Haha
on 1574268083
I've just begun trying to master all of the features of Excel and your add-on is perfect. I'm able to open up example documents to practice specific features on.

While your creation is VERY useful and EXTREMELY impressive, I believe that the instructions on it's operation could be improved. Using gifs to showcase the setup is a great idea, but your gifs are so long and move so fast that I was forced to sit through the entire thing multiple times to finally get it working.

I would suggest breaking up your gifs into tiny bite sized chunks, this way people can focus on one step at a time without getting lost or overwhelmed, and they aren't forced to watch the entire process several times.

Let me say again though that I think your work here is an absolute game changer.
Comment from author
Thanks for the kind words.

I made three new gifs about setting up the add-on. They are still long but should be slower. I now mention twice that you can download and save the gifs. I use gifs because gifs are the only video I can embed on ankiweb.

Are these new screencasts more useful?
on 1573748694
Just awesome ! it does what it says in a simple, effective and straight forward way ! took me 15min to configure (because i had to wait for the GIF each time xD) yet it s gonna make my studying plan much much easier, thanks a lot OP !!!
Comment from author
thanks for your kind words and your hint about the gifs.

I just updated the description with this paragraph: "You can download the following two screencasts (gifs) by right-clicking them. Then select "save image as" from the context menu (tested in Chrome and Firefox). Then open these gifs with a program that supports pausing gif files. On Windows I use the popular image viewer IrfanView that can also display gifs. IrfanView has "Options->Start/Stop Animation" and you can adjust the speed with [SHIFT][CTRL][+] or [SHIFT][CTRL][-]. On Linux I use mpv."
on 1573355684
This is an excellent plugin, but your installation steps are very trouble and confusing, and it took me a long time to understand. I found that when I type the path in field “external_source”, I must use double slashes(\\), like this“file:///E:\\note\\books\\Macroeconomics_5th.pdf”,rather than “ file:///E:\note\books\Macroeconomics_5th.pdf”(because it doesn't work),can you improve it?
Another problem is that when it openthe MS word file, a new blank page is opened instead of the specified word file.
Thanks for your work again, according to this idea, can it open any external file in anki? This is a great thing. After all, not all knowledge is suitable for card(question and answer), and the editing ability on anki is too weak.
I don't know how to reply to you on github, my email is xuanquansheng@126.com
Comment from author
thanks for your kind words and your very useful feedback.

update: Both problems have been solved in the latest version.
on 1571804133
Such a good addon!
Thank you very much!