Convert Figma logo to code with AI

jodconverter logojodconverter

JODConverter automates document conversions using LibreOffice or Apache OpenOffice.

1,378
283
1,378
24

Top Related Projects

2,673

Read-only LibreOffice core repo - no pull request (use gerrit instead https://gerrit.libreoffice.org/) - don't download zip, use https://dev-www.libreoffice.org/bundles/ instead

2,573

Universal Office Converter - Convert between any document format supported by LibreOffice/OpenOffice.

Convert PDF to HTML without losing text or format.

:gem: A fast, open source text processor and publishing toolchain, written in Ruby, for converting AsciiDoc content to HTML 5, DocBook 5, and other formats.

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

Quick Overview

JODConverter is an open-source Java library that converts documents between various office file formats using LibreOffice or Apache OpenOffice as a conversion engine. It supports a wide range of document formats, including DOC, DOCX, ODT, PDF, RTF, HTML, and many more.

Pros

  • Supports a wide variety of document formats for conversion
  • Easy integration with Java applications
  • Provides both local and remote conversion options
  • Active development and community support

Cons

  • Requires LibreOffice or Apache OpenOffice to be installed
  • Performance can be slow for large documents or batch conversions
  • Limited customization options for conversion settings
  • Dependency on external software may cause compatibility issues

Code Examples

  1. Converting a Word document to PDF:
JodConverter.convert("document.docx")
    .to("output.pdf")
    .execute();
  1. Converting an Excel spreadsheet to HTML:
JodConverter.convert("spreadsheet.xlsx")
    .to("output.html")
    .execute();
  1. Using a custom LibreOffice installation:
OfficeManager officeManager = LocalOfficeManager.builder()
    .officeHome("/path/to/libreoffice")
    .build();

JodConverter.convert("document.odt")
    .to("output.pdf")
    .using(officeManager)
    .execute();
  1. Batch conversion of multiple files:
JodConverter converter = JodConverter.make();
converter.convert("file1.docx").to("file1.pdf").execute();
converter.convert("file2.pptx").to("file2.pdf").execute();
converter.convert("file3.xlsx").to("file3.pdf").execute();

Getting Started

To use JODConverter in your Java project, add the following dependency to your Maven pom.xml file:

<dependency>
    <groupId>org.jodconverter</groupId>
    <artifactId>jodconverter-local</artifactId>
    <version>4.4.2</version>
</dependency>

Then, you can use the library in your Java code:

import org.jodconverter.core.office.OfficeManager;
import org.jodconverter.core.office.OfficeUtils;
import org.jodconverter.local.JodConverter;
import org.jodconverter.local.office.LocalOfficeManager;

public class ConversionExample {
    public static void main(String[] args) {
        OfficeManager officeManager = LocalOfficeManager.install();
        try {
            JodConverter.convert("input.docx").to("output.pdf").execute();
        } finally {
            OfficeUtils.stopQuietly(officeManager);
        }
    }
}

Make sure you have LibreOffice or Apache OpenOffice installed on your system before running the code.

Competitor Comparisons

2,673

Read-only LibreOffice core repo - no pull request (use gerrit instead https://gerrit.libreoffice.org/) - don't download zip, use https://dev-www.libreoffice.org/bundles/ instead

Pros of LibreOffice core

  • Comprehensive office suite functionality
  • Large, active community and extensive documentation
  • Native implementation for better performance and control

Cons of LibreOffice core

  • Larger codebase, potentially more complex to work with
  • Steeper learning curve for developers
  • May require more resources to run and maintain

Code comparison

LibreOffice core (C++):

void ScDocument::SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double fVal )
{
    if (ValidColRow(nCol, nRow) && nTab >= 0 && nTab < static_cast<SCTAB>(maTabs.size()))
        maTabs[nTab]->SetValue(nCol, nRow, fVal);
}

JODConverter (Java):

public void convert(File inputFile, File outputFile) throws OfficeException {
    Map<String, ?> loadProperties = new HashMap<String, Object>();
    Map<String, ?> storeProperties = new HashMap<String, Object>();
    convert(inputFile, outputFile, loadProperties, storeProperties);
}

Summary

LibreOffice core offers a comprehensive office suite with native implementation, while JODConverter focuses on document conversion using LibreOffice as a backend. LibreOffice core provides more control and functionality but requires more resources and has a steeper learning curve. JODConverter offers a simpler API for document conversion tasks but may have limitations in terms of advanced features and performance compared to the native LibreOffice implementation.

2,573

Universal Office Converter - Convert between any document format supported by LibreOffice/OpenOffice.

Pros of unoconv

  • Command-line interface for easy integration with scripts and automation
  • Supports a wide range of document formats, including legacy formats
  • Lightweight and doesn't require Java runtime

Cons of unoconv

  • Requires LibreOffice or OpenOffice to be installed on the system
  • May have slower performance for large-scale document conversions
  • Less actively maintained compared to JODConverter

Code comparison

unoconv:

import subprocess

def convert_document(input_file, output_format):
    subprocess.run(["unoconv", "-f", output_format, input_file])

JODConverter:

import org.jodconverter.core.DocumentConverter;
import org.jodconverter.core.office.OfficeManager;

public void convertDocument(File inputFile, File outputFile) {
    documentConverter.convert(inputFile).to(outputFile).execute();
}

Both projects aim to convert documents using LibreOffice/OpenOffice, but they differ in their approach and implementation. unoconv provides a simple command-line interface, making it easy to use in scripts, while JODConverter offers a more robust Java-based solution with additional features and better performance for large-scale conversions. The choice between the two depends on the specific requirements of your project, such as the programming language, scalability needs, and integration preferences.

Convert PDF to HTML without losing text or format.

Pros of pdf2htmlEX

  • Specialized in converting PDF to HTML, maintaining visual fidelity
  • Supports complex PDF layouts and embedded fonts
  • Generates self-contained HTML files with CSS and JavaScript

Cons of pdf2htmlEX

  • Limited to PDF-to-HTML conversion, less versatile than JODConverter
  • May struggle with highly interactive or dynamic PDF content
  • Less active development and community support

Code Comparison

pdf2htmlEX:

pdf2htmlEX input.pdf output.html

JODConverter:

DocumentConverter converter = new DefaultDocumentConverter();
converter.convert(new File("input.doc")).to(new File("output.pdf")).execute();

Summary

pdf2htmlEX excels at converting PDF documents to HTML while preserving layout and formatting. It's ideal for scenarios requiring accurate web representation of PDF content. However, it's limited to PDF-to-HTML conversions.

JODConverter offers broader document format support, including conversions between various office document formats. It's more versatile but may not match pdf2htmlEX's specialized PDF-to-HTML conversion quality.

Choose pdf2htmlEX for high-fidelity PDF-to-HTML conversions, and JODConverter for general document format conversions and broader compatibility.

:gem: A fast, open source text processor and publishing toolchain, written in Ruby, for converting AsciiDoc content to HTML 5, DocBook 5, and other formats.

Pros of Asciidoctor

  • More versatile document processing: Asciidoctor can convert AsciiDoc to various output formats like HTML, PDF, EPUB, and DocBook
  • Active community and regular updates: Asciidoctor has a larger user base and more frequent releases
  • Extensive documentation and examples available

Cons of Asciidoctor

  • Limited to AsciiDoc format: Unlike JODConverter, Asciidoctor doesn't support conversion between different office document formats
  • Steeper learning curve: Requires knowledge of AsciiDoc syntax, which may be unfamiliar to some users

Code Comparison

Asciidoctor (Ruby):

require 'asciidoctor'

Asciidoctor.convert_file 'document.adoc', to_file: 'output.html', safe: :safe

JODConverter (Java):

DocumentConverter converter = new DefaultDocumentConverter();
converter.convert(new File("document.doc")).to(new File("output.pdf"));

Both libraries offer straightforward conversion methods, but they serve different purposes. Asciidoctor focuses on AsciiDoc processing, while JODConverter handles various office document formats.

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

Pros of OpenHTMLtoPDF

  • Specializes in HTML and CSS to PDF conversion, offering more precise control over layout and styling
  • Supports a wider range of CSS features, including flexbox and grid layouts
  • Actively maintained with regular updates and improvements

Cons of OpenHTMLtoPDF

  • Limited to HTML/CSS input, while JODConverter supports various document formats
  • May require more setup and configuration for complex layouts
  • Potentially steeper learning curve for users unfamiliar with HTML/CSS

Code Comparison

OpenHTMLtoPDF:

PdfRendererBuilder builder = new PdfRendererBuilder();
builder.withUri("input.html");
builder.toStream(outputStream);
builder.run();

JODConverter:

DocumentConverter converter = new DefaultDocumentConverter();
converter.convert(new File("input.doc"))
         .to(new File("output.pdf"))
         .execute();

Both libraries offer straightforward APIs for document conversion, but OpenHTMLtoPDF focuses on HTML input, while JODConverter supports various document formats. OpenHTMLtoPDF provides more fine-grained control over the conversion process, especially for web-based content, whereas JODConverter offers broader format support and simpler usage for general document conversions.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

  LibreOffice / Apache OpenOffice

Build Status Coverage Status Codacy Badge License Maven Central Javadocs Join the chat at https://gitter.im/jodconverter/Lobby Donate

What you want to know...

  • Documentation: The JODConverter documentation (work in progress) can be found here.
  • Examples: A dedicated repository with sample projects can be found here.
  • Dependencies:
  • Tests: JODConverter is supposed to work just fine on recent versions of Windows, MacOS and Unix/Linux. Any confirmation would be welcome, so we could build a list of official supported OS distributions.

Usage for local conversions

Build default, JODConverter is built using the OpenOffice libraries. See here to know why. But you can now decide whether you want to use JODConverter with the LibreOffice libraries or the OpenOffice libraries.

With LibreOffice libraries:

Gradle:

implementation 'org.jodconverter:jodconverter-local-lo:4.4.8'

Maven:

<dependency>
  <groupId>org.jodconverter</groupId>
  <artifactId>jodconverter-local-lo</artifactId>
  <version>4.4.8</version>
</dependency>

With OpenOffice libraries:

Gradle:

implementation 'org.jodconverter:jodconverter-local:4.4.8'

or

implementation 'org.jodconverter:jodconverter-local-oo:4.4.8'

Maven:

<dependency>
  <groupId>org.jodconverter</groupId>
  <artifactId>jodconverter-local</artifactId>
  <version>4.4.8</version>
</dependency>

or

<dependency>
  <groupId>org.jodconverter</groupId>
  <artifactId>jodconverter-local-oo</artifactId>
  <version>4.4.8</version>
</dependency>

Building the Project

gradlew clean build -x test

Building Cli Executable

gradlew clean build -x test distZip

Support :speech_balloon:

JODConverter Gitter Community Join the chat at https://gitter.im/jodconverter/Lobby, growing FAQ.

How to contribute

  1. Check for open issues, or open a new issue to start a discussion around a feature idea or a bug.
  2. If you feel uncomfortable or uncertain about an issue or your changes, feel free to contact me on Gitter using the link above.
  3. Fork this repository on GitHub to start making your changes.
  4. Write a test showing that the bug was fixed or that the feature works as expected.
  5. Note that the repository follows the Google Java style. You can format your code to this format by typing gradlew spotlessApply on the subproject you work on (e.g, gradlew :jodconverter-local:spotlessApply), by using the Eclipse plugin, or by using the Intellij plugin.
  6. Create a pull request, and wait until it gets merged and published.

Credits...

Here are my favorite/inspiration forks/projects:

  • documents4j project: Nice choice if you want 100% perfect conversion using MS Office. But work only on Windows out of the box (Local implementation) and not totally free (since MS Office is not free). The new "job" package is strongly inspired by this project.

Original JODConverter

JODConverter (Java OpenDocument Converter) automates document conversions using LibreOffice or OpenOffice.org.

The previous home for this project is at Google Code, including some wiki pages.

Donations

If this project helps you, please consider a cup of :coffee:. Thanks!! :heart:

paypal