fonol / anki-search-inside-add-card

An add-on providing full-text-search and PDF reading functionality to Anki's Add card dialog
https://ankiweb.net/shared/info/1781298089
GNU Affero General Public License v3.0
178 stars 24 forks source link

Not able to open PDFs after latest update #118

Closed ComstockGordon closed 4 years ago

ComstockGordon commented 4 years ago

I am getting this error "Could not load PDF - seems to be invalid" every time I open a PDF. I tried editing the note and reselecting the PDF but it did not help.

I am on Anki Version 2.1.26 and macOS Catalina 10.15.4.

ComstockGordon commented 4 years ago

I retried after disabling all other addons. The problem still persists.

fonol commented 4 years ago

That's weird. I tested on Anki 2.1.24 on Ubuntu and on my Windows machine (2.1.28) and it works on both. It would help me immensely if you could post the javascript error that occurs. If you want to do that, you'd have to install the "Webinspector" add-on, then try to open a PDF, right click somewhere in the dialog, click Inspect, then click on the Console tab.

ComstockGordon commented 4 years ago

I am clicking the inspect button as shown in the screenshot but nothing is happening. I don't know if I am doing something wrong.

image

fonol commented 4 years ago

Sorry, I should have mentioned, the inspector pops up on the main window.

ComstockGordon commented 4 years ago

Please excuse my stupidity. Here it is:

image

fonol commented 4 years ago

Does it show you the line where the error occurs if you click on it? (Sometimes you have to click, then switch the tab or close the inspector and then do it again for it to show the correct line)

ComstockGordon commented 4 years ago

I am not sure how to check for line numbers. I just realised there are lot of toggles under the "t.UnknownErrorException" line. Should I paste all that information here.

Also, please tell me if I can perform any other check to make sure its a bug and not an issue on my end. Thanks.

fonol commented 4 years ago

I don't really know if it's an issue on your end, but I don't think so. You can click on the data:text/... message or on the VM60:38, I don't really remember. Ideally, it should highlight the location of the error in the html. But it would also be interesting to see what's in the expanded section.

ComstockGordon commented 4 years ago

This is what it shows me when I click on "data:text/". I'll paste the other details here too.

image

fonol commented 4 years ago

Yea that incorrect marking of the location happens to me too on the first time, you can try clicking on the other tab on the left side (data:text/html...) or close the html tab and repeat.

Edit: You probably did, but did you try with different pdfs? None work?

ComstockGordon commented 4 years ago

If I switch tabs and come back to it again, this is what it shows me.

image

And yes I have tried opening other old PDFs. I also tried creating a new note with a new PDF. None of them are opening.

fonol commented 4 years ago

Hm, and what does appear if you uncollapse the error? I am wondering if the error is related to the update in the pdf.js version this add-on uses.

ComstockGordon commented 4 years ago

It has a lot of toggles. I am not sure how to copy it and how deep should I go. Do you need all of it?

fonol commented 4 years ago

No, just some levels. You could do a screenshot

ComstockGordon commented 4 years ago

image

Please let me know if you need more information. Its getting very late here, ill post it tomorrow. Again, thanks for all your efforts.

fonol commented 4 years ago

That confirms it's the pdf.js update. I reverted to a slightly older version. If that doesn't fix the issue, please tell me!

ComstockGordon commented 4 years ago

Yes it seems to be fixed. I am able to open all PDFs. Thanks a lot!