# markitdown4j
A Java reimplementation of Microsoft MarkItDown for document-to-Markdown conversion, built as an open-source rewrite project and delivered as a CLI and Java library.
| Item | Value |
|---|---|
| Current version | 0.0.4 |
| Language | Java 11 |
| Packaging | Executable shaded JAR + reusable library |
| OCR engines | tesseract-cli, http, paddleocr |
| Main artifact | target/markitdown4j-0.0.4.jar |
| License | MIT |
This repository is positioned as:
The current repository documents and implements the current Java version only.
markitdown4j converts heterogeneous input files into Markdown and exposes the same core engine through two product surfaces:
| Engine | Typical use |
|---|---|
tesseract-cli |
Local cross-platform OCR with a system Tesseract installation |
http |
OCR through a custom HTTP endpoint |
paddleocr |
OCR through PaddleOCR job API |
The repository currently ships the CLI as a JAR:
target/markitdown4j-0.0.4.jar
In this document, markitdown4j is shorthand for:
java -jar target/markitdown4j-0.0.4.jar
Use the full java -jar ... form directly unless you created your own alias or wrapper script.
mvn clean package
markitdown4j [options] <input...>
Convert one PDF:
markitdown4j report.pdf -o output.md
Batch-convert supported files in a directory:
markitdown4j ./docs --batch -o out/
Convert a remote file:
markitdown4j https://example.com/report.pdf -o out/
Convert with OCR:
markitdown4j scan.pdf --ocr --ocr-engine tesseract-cli -o output.md
Generate and inspect config:
markitdown4j --generate-config
markitdown4j --validate-config
markitdown4j --show-config
The current configuration system is YAML-first.
Recognized files:
markitdown.ymlmarkitdown.local.ymlmarkitdown.example.ymlResolution order:
markitdown.ymlmarkitdown.local.ymlUse configuration.en.md for the full setting reference, scenario-based examples, validation rules, and CLI override behavior.
The library surface is intended for direct Java integration, not just as a secondary note under the CLI.
Typical use cases:
Install locally:
mvn clean install
Maven coordinates:
<dependency>
<groupId>com.markitdown</groupId>
<artifactId>markitdown4j</artifactId>
<version>0.0.4</version>
</dependency>
| Type | Purpose |
|---|---|
com.markitdown.core.MarkItDownEngine |
Main conversion runtime entry point |
com.markitdown.config.ConversionOptions |
Runtime conversion options |
com.markitdown.api.ConversionResult |
Result object with Markdown, metadata, warnings, and status |
com.markitdown.api.DocumentConverter |
Converter extension contract |
com.markitdown.exceptions.ConversionException |
Checked exception for conversion failures |
com.markitdown.MarkItDownApplication |
Convenience helper exposing createEngine() |
MarkItDownEngine engine = MarkItDownApplication.createEngine();
try {
ConversionOptions options = ConversionOptions.builder().build();
ConversionResult result = engine.convert(Path.of("report.pdf"), options);
if (result.isSuccessful()) {
System.out.println(result.getMarkdown());
} else {
System.err.println(result.getWarnings());
}
} finally {
engine.shutdown();
}
try (InputStream input = /* your stream */) {
ConversionResult result = engine.convert(input, "text/plain", options);
}
Important notes:
ConversionExceptionConversionOptions options = ConversionOptions.builder()
.includeMetadata(true)
.includeImages(true)
.includeTables(true)
.tableFormat("github")
.imageFormat("markdown")
.useOcr(true)
.ocrEngine("tesseract-cli")
.language("eng")
.tesseractPath("O:/tesserOCR/tesseract.exe")
.tessdataPath("O:/tesserOCR/tessdata")
.maxFileSize(0)
.build();
Use:
getMarkdown()getMetadata()getWarnings()isSuccessful()getOriginalFileName()getFileSize()getConversionTime()Current library code can fail in two ways:
ConversionExceptionConversionResulttry {
ConversionResult result = engine.convert(Path.of("input.bin"), options);
if (!result.isSuccessful()) {
System.err.println(result.getWarnings());
}
} catch (ConversionException ex) {
System.err.println(ex.getMessage());
}
Current async and batch methods:
convertAsync(Path, ConversionOptions)convertAsync(InputStream, String, ConversionOptions)convertParallel(List<Path>, ConversionOptions)convertAll(List<Path>, ConversionOptions)boolean supportedPath = engine.isSupported(Path.of("input.pdf"));
boolean supportedMime = engine.isSupported("application/pdf");
Call shutdown() when the engine is no longer needed, especially for long-lived engines and async workloads.
English documents:
涓枃鏂囨。锛? - 馃摌 usage.md锛氳鏄?CLI 涓?Java Library 鐨勪娇鐢ㄦ柟寮忋€佸懡浠ゆā寮忋€佽緭鍑鸿鍒欍€丱CR 鐢ㄦ硶鍜岄泦鎴愮ず渚嬨€?- 鈿欙笍 configuration.md锛氳鏄庨厤缃ā鍨嬨€乊AML 閰嶇疆椤广€佸満鏅寲閰嶇疆绀轰緥銆佹牎楠岃鍒欏拰 CLI 瑕嗙洊鍏崇郴銆?- 馃И testing.md锛氬垪鍑哄綋鍓嶆祴璇曢」銆佹祴璇曡寖鍥村拰瀵瑰簲娴嬭瘯鍛戒护銆?- 馃洜锔?development.md锛氶潰鍚戣础鐚€呯殑瀹炵幇绾ц璁′笌寮€鍙戞枃妗c€?
tesseract-cli OCR| Surface | Status | Purpose |
|---|---|---|
| CLI | primary | End-user conversion workflow |
| Java library | supported | Embedded Java integration |
$ claude mcp add markitdown \
-- python -m otcore.mcp_server <graph>