DjVu Viewing Helper

Rating: 
5
Your rating: None Average: 5 (1 vote)

This installs a MIME type handler for DjVu files.

As there is no native support for that file type, I have chosen to do a workaround. The helper script will convert the djvu temporarily into PDF, and launch Sailfish Office (a.k.a. "Documents") to open it. NOTE: this conversion is not fast. You will have to excert some patience for the files to open.

Not ideal, but it allows you to view djvu files you have or encounter.

NOTE: after installation you HAVE to run these commands as regular user in the terminal.

lca-tool --setmimedefault image/vnd.djvu openrepos-djvulibre-open
lca-tool --setmimedefault image/vnd.djvu+multipage openrepos-djvulibre-open
lca-tool --setmimedefault image/x.djvu openrepos-djvulibre-open
lca-tool --setmimedefault image/x-djvu openrepos-djvulibre-open

To avoid typing, you can get the little script from the git repo: https://gitlab.com/nephros/openrepos-djvulibre/-/raw/master/files/install-mimes-user.sh

I am looking for a way to automate this, but it's not possible from the RPM alone as it must be run as user. Possibly a one-shot systemd service can do it. Suggestions welcome.

BTW, this depends on my build of the djvulibre tools and libs. If you are a coder maybe you can use those to create a native application or plugin.

Application versions: 
AttachmentSizeDate
File openrepos-djvulibre-open-0.1.1-1.noarch.rpm52.13 KB26/08/2020 - 16:43
File openrepos-djvulibre-open-0.1.1-2.noarch.rpm52.24 KB26/08/2020 - 17:37
File openrepos-djvulibre-open-0.2.0-2.noarch.rpm53.62 KB11/09/2020 - 16:33
Changelog: 

- cache files for 30 days and reopen them if necessary
- notify about caching

Comments

sdiconov's picture

While the ability to open DJVU documents is great news, this app is indeed in a very early stage and leaves much to be desired. Nevertheless I am grateful to the author and hope that he can improve the app.

I installed the app and its dependencies and executed the suggested commands. Now an attempt to open a djvu from a file manager yields a message "Successful opening" ... and nothing else happens for a long time. However, when I manually launched the Documents app, it opened with the target djvu doc in it. Wow! I can see what is inside djvu files! ... But any attempt to zoom in small text shows that the converted pdf image is very low-res. Individual letters are barely recognisable if at all. This is a tool to preview, but it is not sufficient to read yet.

Problems:

1. very slow opening (coversion takes too long)

2. very low resolution (reading small text is hard or impossible)

nephros's picture

Newer versions now cache the conversion results (default 30 days), so long waiting times should be better now for files you look at often.

nephros's picture

Thanks for testing and your observations!

The long time to open is something I can do little about. The tool converts djvu first to PDF and this is not very fast depending on document size.

I will see what I can do about the resolution issue.

Right now what the script does is figuring out the device resolution ("DPI"), and convert the input to 1/4th of that DPI. Lowering that factor will improve quality, however I fear increasing quality will also increase conversion time.

Can you try if this improves quality for you?

https://gitlab.com/nephros/openrepos-djvulibre/-/blob/master/RPMS/openrepos-djvulibre-open-0.1.2-3.noarch.rpm