4 0
Contact Author Sign in to rate

Zzz (not maintained & may not work) Simple PDF Page Link Handler

<10kB. Updated 2019-03-30.
The author has shared 36 other item(s).


Source: https://anki.tenderapp.com/discussions/ankidesktop/29160-link-to-a-pdf-page It's based on the "Replay buttons on card" add-on. It covers "#page=" links in the review (Anki 2.0 and Anki 2.1) and preview (Anki 2.0) windows, i.e, for example, something like: Anki 2.0: <​a href='file:///D:/Temp/example.pdf#page=23'>PDF Link</a​> For Anki 2.1 it's a bit different: Anki 2.1: <​a href='javascript:pycmd("file:///D:/Temp/example.pdf#page=23");'>PDF Link</a​> Don't copy-paste <​a and </a​>, they're not valid as they contain zero-width space character. Maybe edit the source code by updating DEFAULT_PDF_VIEWER (by default, it's "C:\Program Files\Mozilla Firefox\firefox.exe") and restart Anki. No support - for archival purposes. Uploaded by a request. Nickolay <kelciour@gmail.com>


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 1634081330
on 1571966707
on 1553903397
very nice.

A guide for the current version 2.1:
- If you want to complain that adjusting this add-on is too complicated go away. I know this. But this add-on (which is complicated to adjust) is much better than what we had before which was nothing.
- add two additional fields to your note type. I'll refer to them as "file" and "page". for details see https://apps.ankiweb.net/docs/manual.html
- edit the source code of the file __init__.py of this add-on and adjust the path of the pdf viewer that can handle links to a page. As far as I know you need a browser like Firefox or Chrome. By default this add-on assumes that you use Firefox on Windows. If you don't you have to adjust the source code of this add-on: To see the file __init__.py in your file maanger click "View File" in the "Add-ons" window (main window Tools -> add-ons). Then use a text editor and change the path to your browser.
- Regular pdf viewers like Acrobat won't help because the operating system doesn't allow to open a pdf on a specific page, for details see e.g. [this tenderapp discussion](https://anki.tenderapp.com/discussions/ankidesktop/29160-link-to-a-pdf-page#comment_45901339).
- then edit your card template and put this into the back template:
<br><br>Source: <a href='javascript:pycmd("file:///{{file}}#page={{page}}");'>{{file}} , {{page}}</a​><br><br>
- If Firefox doesn't show the file but offers to download it you need to change a setting in Firefox. In Firefox go to Preferences, then look for "Applications". Filter this list for "pdf" and set it to "Preview in Firefox".
- When you create a note you can put "C:/a folder/filename.pdf" into the field "file" and maybe "12" into the field page.

If you use the legacy version 2.0:
- The add-on is not named __init__.py. Also you can directly edit it in Anki to change the path to the browser.
- You need to change what you put in your template as outlined in the description. It should be something like this.
<br><br>Source: <​a href='file:///{{file}}#page={{page}}'>{{file}} , {{page}}</a​><br><br>
Comment from author
Thank you. That's very thoughtful of you to write much more detailed description on how to actually use it. I very much appreciate it.
on 1553885601
very useful. If your cards are short and you forget the context this add-on allows to quickly open the corresponding pdf file at the correct page on your computer.

Thanks @kelciour for creating this add-on.