Repository

docling-java

A Java API for Docling

README

Welcome to the Docling Java Project!

Docling Java

This is the repository for Docling Java, a Java API for using Docling.

Docs
docling-core version
docling-serve-api version
docling-serve-client version
docling-testcontainers version
License MIT
codecov
Discord
OpenSSF Best Practices

Docling simplifies document processing, parsing diverse formats, including advanced PDF understanding, and providing seamless integrations with the Generative AI ecosystem.

Features

  • 🗂️ Parsing of multiple document formats incl. PDF, DOCX, PPTX, XLSX, HTML, WAV, MP3, VTT, images (PNG, TIFF, JPEG, ...), and more
  • 📑 Advanced PDF understanding incl. page layout, reading order, table structure, code, formulas, image classification, and more
  • 🧬 Unified, expressive DoclingDocument representation format
  • ↪️ Various export formats and options, including Markdown, HTML, DocTags and lossless JSON
  • 🔒 Local execution capabilities for sensitive data and air-gapped environments
  • 🤖 Plug-and-play integrations including LangChain4j
  • 🔍 Extensive OCR support for scanned PDFs and images
  • 👓 Support of several Visual Language Models (GraniteDocling)
  • 🎙️ Audio support with Automatic Speech Recognition (ASR) models

Documentation

See the documentation for complete information on the various artifacts that are provided by this project.

Artifacts

This project provides the following artifacts:

Getting started

Use DoclingServeApi.convertSource() to convert individual documents (make sure both docling-serve-api and docling-serve-client are on your classpath).

For example:

import ai.docling.serve.api.DoclingServeApi;
import ai.docling.serve.api.convert.request.ConvertDocumentRequest;
import ai.docling.serve.api.convert.request.source.HttpSource;
import ai.docling.serve.api.convert.response.InBodyConvertDocumentResponse;

DoclingServeApi doclingServeApi = DoclingServeApi.builder()
    .baseUrl("<location of docling serve instance>")
    .build();

ConvertDocumentRequest request = ConvertDocumentRequest.builder()
    .source(
        HttpSource.builder()
            .url(URI.create("https://arxiv.org/pdf/2408.09869"))
            .build()
    )
    .build();

InBodyConvertDocumentResponse response = (InBodyConvertDocumentResponse) doclingServeApi.convertSource(request);
System.out.println(response.getDocument().getMarkdownContent());

If you're unsure of the concrete type returned by the convert API, you can handle it dynamically using the getResponseType() method:

import ai.docling.serve.api.convert.response.ResponseType;

// ... your code to create and configure the request ...

var result = doclingServeApi.convertSource(request);

switch(result.getResponseType()) {
    case ResponseType.IN_BODY -> // Response is InBodyConvertDocumentResponse
    case ResponseType.ZIP_ARCHIVE -> // Response is ZipArchiveConvertDocumentResponse
    case ResponseType.PRE_SIGNED_URL -> // Response is PreSignedUrlConvertDocumentResponse
    case ResponseType.PRE_SIGNED_URL_RESPONSE -> // Response is PreSignedUrlConvertResponse (with per-document artifact download URLs)
}

More usage information is available in the docs.

Get help and support

Please feel free to connect with us using the discussion section.

Contributing

Please read Contributing to Docling Java for details.

License

The Docling codebase is under MIT license.
For individual model usage, please refer to the model licenses found in the original packages.

IBM ❤️ Open Source AI

The project was started by the AI for knowledge team at IBM Research Zurich.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://developers.redhat.com/author/eric-deandrea">

Eric Deandrea

<br /><sub><b>Eric Deandrea</b></sub></a><br /><a href="#code-edeandrea" title="Code">💻</a> <a href="#content-edeandrea" title="Content">🖋</a> <a href="#doc-edeandrea" title="Documentation">📖</a> <a href="#ideas-edeandrea" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-edeandrea" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-edeandrea" title="Maintenance">🚧</a> <a href="#projectManagement-edeandrea" title="Project Management">📆</a> <a href="#test-edeandrea" title="Tests">⚠️</a> <a href="#review-edeandrea" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://thomasvitale.com">

Thomas Vitale

<br /><sub><b>Thomas Vitale</b></sub></a><br /><a href="#code-ThomasVitale" title="Code">💻</a> <a href="#content-ThomasVitale" title="Content">🖋</a> <a href="#doc-ThomasVitale" title="Documentation">📖</a> <a href="#ideas-ThomasVitale" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-ThomasVitale" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-ThomasVitale" title="Maintenance">🚧</a> <a href="#projectManagement-ThomasVitale" title="Project Management">📆</a> <a href="#test-ThomasVitale" title="Tests">⚠️</a> <a href="#review-ThomasVitale" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.lordofthejars.com">

Alex Soto

<br /><sub><b>Alex Soto</b></sub></a><br /><a href="#ideas-lordofthejars" title="Ideas, Planning, & Feedback">🤔</a> <a href="#projectManagement-lordofthejars" title="Project Management">📆</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ibm.biz/cesar-berrospi">

Cesar Berrospi Ramis

<br /><sub><b>Cesar Berrospi Ramis</b></sub></a><br /><a href="#ideas-ceberam" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ibm.biz/michele-dolfi">

Michele Dolfi

<br /><sub><b>Michele Dolfi</b></sub></a><br /><a href="#design-dolfim-ibm" title="Design">🎨</a> <a href="#ideas-dolfim-ibm" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-dolfim-ibm" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#question-dolfim-ibm" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://oscerd.github.io">

Andrea Cosentino

<br /><sub><b>Andrea Cosentino</b></sub></a><br /><a href="#design-oscerd" title="Design">🎨</a> <a href="#promotion-oscerd" title="Promotion">📣</a> <a href="#ideas-oscerd" title="Ideas, Planning, & Feedback">🤔</a> <a href="#code-oscerd" title="Code">💻</a> <a href="#doc-oscerd" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jmb-streamsets">

jmb-streamsets

<br /><sub><b>jmb-streamsets</b></sub></a><br /><a href="#ideas-jmb-streamsets" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-jmb-streamsets" title="Design">🎨</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/insectengine">

insectengine

<br /><sub><b>insectengine</b></sub></a><br /><a href="#content-insectengine" title="Content">🖋</a> <a href="#design-insectengine" title="Design">🎨</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/maxmnemonic">

Maxim Lysak

<br /><sub><b>Maxim Lysak</b></sub></a><br /><a href="#content-maxmnemonic" title="Content">🖋</a> <a href="#design-maxmnemonic" title="Design">🎨</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/warnulf">

warnulf

<br /><sub><b>warnulf</b></sub></a><br /><a href="#bug-warnulf" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://pipestream.ai">

Kristian Rickert

<br /><sub><b>Kristian Rickert</b></sub></a><br /><a href="#code-krickert" title="Code">💻</a> <a href="#ideas-krickert" title="Ideas, Planning, & Feedback">🤔</a> <a href="#doc-krickert" title="Documentation">📖</a> <a href="#test-krickert" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/KaleabArgaw">

Kaleab A.

<br /><sub><b>Kaleab A.</b></sub></a><br /><a href="#code-KaleabArgaw" title="Code">💻</a> <a href="#doc-KaleabArgaw" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mohammedfaisal">

Mohammed Faisal

<br /><sub><b>Mohammed Faisal</b></sub></a><br /><a href="#code-mohammedfaisal" title="Code">💻</a> <a href="#test-mohammedfaisal" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ArpanKrChakraborty">

Arpan Chakraborty

<br /><sub><b>Arpan Chakraborty</b></sub></a><br /><a href="#code-ArpanKrChakraborty" title="Code">💻</a> <a href="#test-ArpanKrChakraborty" title="Tests">⚠️</a> <a href="#content-ArpanKrChakraborty" title="Content">🖋</a> <a href="#doc-ArpanKrChakraborty" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rkmangal23">

Rohan Kurian

<br /><sub><b>Rohan Kurian</b></sub></a><br /><a href="#code-rkmangal23" title="Code">💻</a> <a href="#doc-rkmangal23" title="Documentation">📖</a> <a href="#ideas-rkmangal23" title="Ideas, Planning, & Feedback">🤔</a> <a href="#tool-rkmangal23" title="Tools">🔧</a> <a href="#test-rkmangal23" title="Tests">⚠️</a> <a href="#infra-rkmangal23" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/NelsonMeleth">

Nelson Baby

<br /><sub><b>Nelson Baby</b></sub></a><br /><a href="#code-NelsonMeleth" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dan-m62">

dan-m62

<br /><sub><b>dan-m62</b></sub></a><br /><a href="#code-dan-m62" title="Code">💻</a> <a href="#ideas-dan-m62" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://romankudryashov.com">

Roman Kudryashov

<br /><sub><b>Roman Kudryashov</b></sub></a><br /><a href="#bug-rkudryashov" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://linkedin.com/in/margi212">

Margi

<br /><sub><b>Margi</b></sub></a><br /><a href="#test-margi212" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/seanJosephFitzpatrick">

Sean Fitzpatrick

<br /><sub><b>Sean Fitzpatrick</b></sub></a><br /><a href="#test-seanJosephFitzpatrick" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/swetasamasti2310">

Sweta Kumari

<br /><sub><b>Sweta Kumari</b></sub></a><br /><a href="#maintenance-swetasamasti2310" title="Maintenance">🚧</a></td>
</tr>
</tbody>
</table>

This project follows the all-contributors specification. Contributions of any kind are welcome!

Features

7

Documentation

2

Artifacts

13

Getting started

1

  • Use DoclingServeApi.convertSource() to convert individual documents (make sure both docling-serve-api and docling-serve-client are on your classpath).

Get help and support

1

Contributing

1

License

1

  • The Docling codebase is under MIT license. For individual model usage, please refer to the model licenses found in the original packages.

IBM ❤️ Open Source AI

1

  • The project was started by the AI for knowledge team at IBM Research Zurich.

Contributors ✨

1