Skip to content

feat: add DjVu conversion support - #612

Open
al-n wants to merge 5 commits into
C4illin:mainfrom
al-n:feat/djvu-support
Open

feat: add DjVu conversion support#612
al-n wants to merge 5 commits into
C4illin:mainfrom
al-n:feat/djvu-support

Conversation

@al-n

@al-n al-n commented Aug 16, 2026

Copy link
Copy Markdown

Summary

  • install DjVuLibre's ddjvu utility in the production image
  • add DjVu-to-PDF and DjVu-to-TIFF conversion through ddjvu
  • register and document the new converter
  • add unit coverage for converter metadata, command arguments, logging, and failures

Notes

ddjvu renders 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 failed
  • tsc --noEmit
  • knip
  • Prettier and ESLint checks for the changed TypeScript files

Closes #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.

  • Installs djvulibre-bin.
  • Registers a dedicated djvu converter for .djvu/.djv and restores its priority ahead of generic document converters.
  • Runs ddjvu -format=<pdf|tiff> and logs stdout/stderr.
  • Updates README and adds unit tests.

Rollout

  • No API changes.
  • Local development must install djvulibre-bin or use the updated image.

Written for commit b9f49f0. Summary will update on new commits.

Review in cubic

@al-n
al-n marked this pull request as ready for review August 16, 2026 13:00
Copilot AI lite review requested due to automatic review settings August 16, 2026 13:00

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Re-trigger cubic

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (for ddjvu) in the Docker release image.
  • Add a new djvu converter 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.

Comment thread src/converters/main.ts
Comment thread src/converters/djvu.ts Outdated
Comment thread tests/converters/djvu.test.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/converters/main.ts Outdated
properties: propertiesxelatex,
converter: convertxelatex,
},
djvu: {

@cubic-dev-ai cubic-dev-ai Bot Aug 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no I meant the AI was correct but now it is wrong :)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or it is correct now again but that's a feature not a bug. You should be able to use calibre if you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Converter Request] DJVU -> PDF, TIFF

3 participants