Anki add-on: Open linked pdf, docx, epub, audio/video, etc. in external Program (win, linux)

This addon does not work on Apple/MacOS unless you modify some Mac security settings, see the section "Apple/Mac" below . AnkiMobile and AnkiDroid don't support add-ons so this add-on is only useful on Windows and Linux. Do not use with untrusted files, templates or notes or decks. This addon allows you to open a file in an external app at a specific position, e.g. a pdf in your pdf viewer on page 37 or a music file in vlc at 1:23 by clicking a hyperlink in the reviewer/previewer or from the editor. I have used this add-on to open pdf files in Sumatra or okular, office documents in LibreOffice Writer, epub files in the calibre ebook-viewer, audio files in vlc at positions in the middle. There are two different ways to use this addons : links are within other fields: 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. filename and page/position in separate fields. for details see the screencasts above/below. # Apple/MacOS I don't have a Mac so I can't adjust and test this add-on for MacOS. By default the addon is broken on MacOS because MacOS restricts which apps can read or modify which files (check System Preferences -> Security & Privacy -> Privacy). If you just want a simple pdf viewer have a look at the add-on pdf viewer . In the MacOS settings you can give Anki more access to your files (which I think is not secure). Then you could use the default app for displaying pdfs in MacOS which 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-ish 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 # screencasts about using extra fields 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. There are three steps to do: 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 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 "external Program". See Screencast 2 for details 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 # 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. # Limitations There are some limitations about the infield option: This works only 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. # 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, for details see this section from the manual . 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 the official anki forum where I can respond multiple times, just click the "contact author" button on the upper right. # 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 with som editing options have a look at my 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 2025-08-31 fix for code related to the editor in anki 25.02+ 2024-04-09 some fixes for windows paths 2023-06-18 fix filename sometimes inserted at beginning of field (2.1.50+), various changes related to filenames in normal field 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) ... 2019-09-16 initial release