Monday, May 25, 2020

chmk a simple CHM viewer

Okular can view CHM files, to do so it uses KHTML, makes sense CHM is basically HTML with images all compressed into a single file.

This is somewhat problematic since KHTML is largely unmaintained and i doubt it'll get a Qt6 port.

The problem is that the only other Qt based HTML rendering engine is QtWebEngine and while great it doesn't support stuff we would need to use it in Okular, since Okular needs to access to the rendered image of the page and also to the text since it uses the same API for all formats, be it CHM, PDF, epub, wathever.

The easiest plan to move forward is probably drop CHM from Okular, but that means no more chm viewing in KDE software, which would be a bit sad.

So I thought, ok maybe I can do a quick CHM viewer just based in QtWebEngine without trying to fit it into the Okular backend to support different formats.

And ChmK was born https://invent.kde.org/aacid/chmk.

It's still very simple, but the basics work, if you give it a file in the command line, it'll open it and you'll be able to browse it.



As you can see it doesn't have *any* UI yet, so Merge Requests more than welcome.

6 comments:

Anonymous said...

Can it not be just a new version of the existing KCHM (https://sourceforge.net/projects/kchm/)?

Anonymous said...

There's also kchmviewer (using QtWebKit):
https://sourceforge.net/projects/kchmviewer/

Albert Astals Cid said...

kchm seems to be KDE3 based and kchmviewer depends on QtWebKit that is kind of unmaintained too

Martin Sandsmark said...

I thought qtwebkit had been revived (though not by the qt company)? there's active branches here at least: https://github.com/qtwebkit/qtwebkit/branches

Albert Astals Cid said...

That's why i said "kind of unmaintained" :D

Yes, there's some people working on it but the last time i used an app that used it it had severe rendering issues, which may make sense, after all it's " QtWebKit 5.212.0 Alpha 4" what they call it

genstorm said...

turns out the okular chm lib parts are sourced from old kchmviewer anyway ;)