feat: add DjVu conversion support - #612
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class DjVu conversion support by installing DjVuLibre tooling in the production image, registering a new DjVu converter, and adding unit tests + documentation so DjVu inputs can be converted to PDF/TIFF via ddjvu.
Changes:
- Install
djvulibre-bin(forddjvu) in the Docker release image. - Add a new
djvuconverter and register it in the converter dispatch table. - Add unit tests for converter metadata/arguments and document the converter in the README.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
Dockerfile |
Installs djvulibre-bin to provide ddjvu in the production image. |
src/converters/djvu.ts |
Introduces ddjvu-based DjVu→PDF/TIFF conversion implementation. |
src/converters/main.ts |
Registers the new converter in the global dispatch table. |
tests/converters/djvu.test.ts |
Adds unit tests for DjVu converter properties and invocation args (plus common converter behaviors). |
README.md |
Documents DjVuLibre as a supported converter and updates counts. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| properties: propertiesxelatex, | ||
| converter: convertxelatex, | ||
| }, | ||
| djvu: { |
There was a problem hiding this comment.
P1: Moving djvu before calibre does not prioritize ddjvu, because mainConverter continues scanning and lets the later Calibre match overwrite the selected converter. Stop discovery after the first match or otherwise make the selection logic honor this priority, so DjVu-to-PDF uses ddjvu.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/converters/main.ts, line 85:
<comment>Moving `djvu` before `calibre` does not prioritize `ddjvu`, because `mainConverter` continues scanning and lets the later Calibre match overwrite the selected converter. Stop discovery after the first match or otherwise make the selection logic honor this priority, so DjVu-to-PDF uses `ddjvu`.</comment>
<file context>
@@ -82,6 +82,10 @@ const properties: Record<
properties: propertiesxelatex,
converter: convertxelatex,
},
+ djvu: {
+ properties: propertiesDjvu,
+ converter: convertDjvu,
</file context>
✅ Addressed in b9f49f0
There was a problem hiding this comment.
Okay, I checked this carefully, the previous version should've been the correct one - sorry, I might have misunderstood your comment @C4illin (I thought you meant that the AI review was correct but I guess you meant that the code was correct)
There was a problem hiding this comment.
no I meant the AI was correct but now it is wrong :)
There was a problem hiding this comment.
Or it is correct now again but that's a feature not a bug. You should be able to use calibre if you want
Summary
ddjvuutility in the production imageddjvuNotes
ddjvurenders each page into the resulting PDF or TIFF. This supports scanned/image-only DjVu documents that Calibre cannot convert, but it does not preserve an embedded searchable text layer.Testing
bun test— 107 passed, 8 skipped, 0 failedtsc --noEmitknipCloses #583
Summary by cubic
Adds DjVu-to-PDF and DjVu-to-TIFF conversion via
ddjvu, so DjVu inputs that previously failed now convert. Output is rasterized; embedded searchable text is not preserved.djvulibre-bin.djvuconverter for.djvu/.djvand restores its priority ahead of generic document converters.ddjvu -format=<pdf|tiff>and logs stdout/stderr.Rollout
djvulibre-binor use the updated image.Written for commit b9f49f0. Summary will update on new commits.