DjVu libraries for C/C++
- DjVuLibre is the only complete open-source DjVu implementation in C/C++. Its C API (
ddjvuapi.h) decodes documents, renders pages into pixel buffers of any format, and returns the text layer, annotations and outline as s-expressions. The C++ classes underneath (DjVuDocument,JB2Image,IW44Image) also encode pages, but have no stable API. The library is GPL-2.0-or-later. - djvudec is a decoder in plain C with no dependencies: render pages, extract text with word positions, read the outline and links. It’s about a seventh of the size of DjVuLibre, has a smaller API, ships as one
.c+.hfile, and is MIT-licensed. It doesn’t encode. SumatraPDF uses it.
Pick djvudec to view DjVu files or extract their text, especially when the GPL is a problem; DjVuLibre when you also need to create or edit DjVu files.
To create DjVu files from C/C++ code, most programs run the DjVuLibre tools (c44, cjb2, djvm, djvused) as separate processes. For a permissively licensed encoder, use djvu-rs (Rust, MIT).