wtetsu / mouse-dictionary

📘Super fast browser dictionary

Home Page:https://mouse-dictionary.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF support

wtetsu opened this issue · comments

commented

Add PDF support

commented

How it works

pdf_demo

Thank you for the new feature.
But this has two problems.

Problem 1

The pdf viewer launced by Mouse Dictionary is incomplete.
Some pdf files are not correctly rendered like this pdf
You can see some parts of the pdf are unseen.

chrome default viewer the viewer launched by Mouse Dictionary
original after

Problem 2

On my tool, you could use Mouse dictionary until this update, by hosting pdf files by pdfjs on Docker.
Though, after this update, when you open a pdf file by my tool and then launch Mouse Dictionary, you are forced to launch the new pdf viewer and it cannnot load the pdf file somehow.

This is the screenshot at the moment that the pdf viewer failed to open the pdf viewer.
notwork
(Please see the bottom part of the screenshot)

My wish

For me, I would be very glad if you can turn ON/OFF the new external pdf viewer feature.
Some people would like this update.
But other people like me don't need this feature.

I can write a Japanese version comment, if you wish because my English is too bad to read.
Thank you for reading.

commented

@monado3

thank you for your report

Problem 1

Reproduced. Let me check in details later on.

Problem 2

Could you please try changing PDF URL pattern(PDFドキュメントとみなすURLパターン
) in Advanced settings?
To empty this field may make your tool avaiable again.

image

(FYI: The function that determins PDF document or not)
https://github.com/wtetsu/mouse-dictionary/blob/master/src/main/core/start.js#L70

Thank you for your prompt response.

Making the field empty solution worked well.
Thank you so much for the information.

Again, thank you for this wonderful tool.

commented

By the way, "PDF URL pattern" was an experimantal feature,
but it turned out it could cause problems like your case,
so I decided to improve that.

You don't have to bother to change the settings next time.


Current(1.4.2):

  • default value: \.(?:pdf|PDF)\??[\w-=&~]*$
  • How MD determin PDF document or not
    • Embded PDF document exists -> true
    • ↓false
    • "PDF URL pattern" matches the current URL -> true ※Here was your problem
    • ↓false
    • Others -> false

The default value could cause problem.

Newer version

  • default value: empty
  • How MD determins PDF document or not
    • If "PDF URL pattern" is empty -> Embded PDF document exists -> true
    • If "PDF URL pattern" is NOT empty -> "PDF URL pattern" matched the current URL -> true

The default behavior is safer than before.

commented

v1.4.3 has been released.

Problem 1: Fixed

Chrome Mouse Dictionary
original after

Thank you for your kind effort in PDF support.
I have one question about whether I can apply this feature to a PDF file uploaded on the Web as a JSP file.

I want to apply this feature to the PDF file uploaded on the below URL (I'm afraid you can't access the URL).
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9291317&tag=1

I have changed the advanced option like the below picture, but it was no effect.
Do you have any comments about this problem?

AdvancedOption

Thank you in advance!

commented

Since I cannot access the URL I cannot confirm it. Is the URL reality a single PDF document? If the page is HTML and a PDF document is embedded, Mouse Dictionary doesn't work.

I see! The page is composed of JSP (=HTML+Javascript).
That's why I can't apply this feature to the page.

Thank you for your quick response!