Open linked pdf, docx, epub, audio/video, etc. in external Program [Official thread]

If you have a problem with the add-on Open linked pdf, docx, epub, audio/video, etc. in external Program post in this thread. This way I get notified. If you make a new thread I will likely miss it.

1 Like

Hello. Great add-on, really great…so great that I totally depend on it. I am having the same problem as the guy who commented on the main addon review page . If you could please look into it, I would appretiate.

on 12/11/2021

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
from . import config_window
File “/home/m830/.local/share/Anki2/addons21/879473266/config_window.py”, line 30, in
from .config_add_edit_entry import (
File “/home/m830/.local/share/Anki2/addons21/879473266/config_add_edit_entry.py”, line 21, in
from .config_defaults_menu import (
File “/home/m830/.local/share/Anki2/addons21/879473266/config_defaults_menu.py”, line 5, in
from anki.utils import (
ImportError: cannot import name ‘point_version’ from ‘anki.utils’ (/usr/local/share/anki/bin/anki/utils.pyc)

@ito0890: thanks for the report. I’ve just uploaded a new version that should fix this. Check for add-on updates. Could you test it and let me know if you find other bugs.

Thank you!!! It is working great again!

Using the add-on in the newest version shows all my cards like this. From what I can tell it just shows all the HTML. Disabling the add-on solved the issue for me. Also, I testet for correlation with other add-ons, but this add-on alone causes the issue (all other add-ons disabled).
The HTML seems to be altered, as ");’ >–> shows up several times, but is not in the original template. Also I might be totally wrong, as I have no idea of coding.

@jolarin: thanks for reporting this bug. It’s very useful info that you already tested with other add-ons disabled. Just to be sure: After disabling the other add-ons you’ve restarted add-ons? Add-ons even though they are greyed out in the add-on window run until you close Anki. If you haven’t done this, try again and check if it changes anything.

Next question: Which Anki version do you now? Which Anki version did you use when my add-on was still working? Do you usually install the add-on updates that anki suggests to you? (I ask so that I know which version of my add-on you use).

Could you move the note used in your screenshot to a separate deck and export this and share it with me. It’s much easier to fix a bug if I can reproduce it on my machine. I don’t think you can upload files here but you could e.g. post the apkg in a new issue (where you can attach files) at Issues · ijgnd/messages_bugs_etc · GitHub

You write it shows “all my cards” broken. So I guess there’s a bad interaction between my add-on and your front template. If you don’t share the apkg could you post the front template (formatted as code) of the affected card of this note.

Hello.

The external_page doesn’t work for me. I can open PDFs normally, but it’s open always in page 1.

I’m using Foxit PDF - Windows 10
Anki 2.1.49

I think I don’t know how to config command parameters to open on specific page.

I found this on internet:
To open, enter the following strings:

/A page=number

For example

“…Foxit Reader.exe” “C:test.pdf” /A page=5

Launch Foxit Reader, open test.pdf at page#5

But I still don’t know what I have to insert on the addon config.

Can you help me?

@Schmitz1 : at the moment I don’t have a windows machine to test but it should be this: you must add a new program for pdf files. Click the wide buton “Add program/extension”. Fill it out and at the bottom you need PATH /A page=PAGE

1 Like

Thank you very much. Its work!!!

Thank you so much for this addon, it works perfectly on Mac! Is it possible to link multiple PDFs in some way?

Thanks in advance :slight_smile:

@Strutz: there’s no good solution. I have a section about internal links on the ankiweb page. that’s disabled by default. probably in the next days I’ll upload a new version that should improve this inline feature.

Awesome addon, It’s really good.
Thank you very much

Is there a way to automatically open link or keyboard shortcut without clicking a link?

see my answer to your review.

i just uploaded a new version that offers a reviewer shortcut

Dear ijgnd,
Hope you’re doing well.
Your add-on is very helpful.
But today it stop working and there’s an error information come from my ANKI . It would be appreciated if you could give some advice to solve this problem
Thank you!

Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2023-07-23 07:38:14

Caught exception:
Traceback (most recent call last):
File “aqt\webview.py”, line 41, in cmd
File “aqt\webview.py”, line 142, in _onCmd
File “aqt\webview.py”, line 595, in _onBridgeCmd
File “decorator.py”, line 232, in fun
File “anki\hooks.py”, line 89, in decorator_wrapper
File “anki\hooks.py”, line 86, in repl
File “C:\Users\Administrator\AppData\Roaming\Anki2\addons21\879473266\reviewer_previewer.py”, line 16, in myLinkHandler
return _old(self, url)
File “decorator.py”, line 232, in fun
File “anki\hooks.py”, line 89, in decorator_wrapper
File “anki\hooks.py”, line 86, in repl
File “C:\Users\Administrator\AppData\Roaming\Anki2\addons21\879473266\linked__inline_view.py”, line 22, in myLinkHandler
if process_urlcmd(url):
File “C:\Users\Administrator\AppData\Roaming\Anki2\addons21\879473266\linked__inline_link_handler.py”, line 15, in process_urlcmd
decoded = base64.b64decode(encoded_file_and_page).decode(‘utf-8’)
File “base64.py”, line 87, in b64decode
binascii.Error: Incorrect padding

@woren200355 : Could you export the note that causes the problem for you into an apkg file and share it with me? This way I should be able to reproduce and hopefully fix the problem.

Can the add-on work with audio and video files such as pdf files
It means moving to a specific minute in the audio or video

yes, this should work. I posted some instructions on https://ankiweb.net/shared/info/879473266 . Note that I don’t have a Mac and this add-on might not run on recent MacOS versions unless you adjust your app permissions/sandboxing settings.

Great add-on, but I’m encountering some problems with opening PDFs from Anki. Whenever I click on the hyperlink it says “No program set for this extension or file not found.” I use a Mac. Any idea?

The addon has only limited functionality on a Mac, see the heading in the add-on descripton on ankiweb.

If you just want a simple pdf viewer have a look at the add-on pdf viewer. This allows you to use the firefox pdf viewer (with some editing features) or the pdf viewer that chrome uses - to use the latter you need to adjust the config of the pdf viewer addon and change the “use pdfjs to show …” key.