jodconverter/jodconverter
Über uns
JODConverter automatisiert Dokumentkonvertierungen mit LibreOffice oder Apache OpenOffice.
Weitere ProjekteGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- -1
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Original
JODConverter, the Java OpenDocument Converter, converts documents between office formats: Word, Excel, PowerPoint, OpenDocument, PDF, HTML, images and many more. It drives a LibreOffice or Apache OpenOffice installation, so it converts whatever that office converts.
It can be used:
- as a Java library, in your own application;
- with Spring Boot, through a starter that configures everything;
- as a command line tool, in your scripts.
📖 Documentation · Release notes · FAQ · Samples
Requirements
- Java 17 or later.
- LibreOffice (recommended) or Apache OpenOffice, installed on the machine that converts.
| JODConverter | Java | Spring Boot |
|---|---|---|
| 5.x | 17+ | 4.x |
| 4.4.x | 8+ | 2.x and 3.x |
Coming from 4.4? See the migration guide.
Quick start
Add the library, here for LibreOffice (see the modules for the other ones):
<dependency>
<groupId>org.jodconverter</groupId>
<artifactId>jodconverter-local-lo</artifactId>
<version>5.1.1</version>
</dependency>
implementation("org.jodconverter:jodconverter-local-lo:5.1.1")
Then start an office manager once, and convert:
import java.io.File;
import org.jodconverter.core.office.OfficeUtils;
import org.jodconverter.local.JodConverter;
import org.jodconverter.local.office.LocalOfficeManager;
public class Example {
public static void main(String[] args) throws Exception {
// Starts an office process, found in its default location, and keeps it for all the conversions.
LocalOfficeManager officeManager = LocalOfficeManager.install();
try {
officeManager.start();
// The formats are those of the file extensions.
JodConverter.convert(new File("document.docx")).to(new File("document.pdf")).execute();
} finally {
OfficeUtils.stopQuietly(officeManager);
}
}
}
An office manager is meant to live as long as the application, and to be shared by all its conversions: starting an office process costs much more than a conversion.
With Spring Boot
Add the starter next to the library:
implementation("org.jodconverter:jodconverter-spring-boot-starter:5.1.1")
implementation("org.jodconverter:jodconverter-local-lo:5.1.1")
enable it:
jodconverter.local.enabled=true
and inject the converter where you need it:
@Service
public class ReportService {
private final DocumentConverter converter;
public ReportService(DocumentConverter converter) {
this.converter = converter;
}
public void toPdf(File source, File target) throws OfficeException {
converter.convert(source).to(target).execute();
}
}
From the command line
Download jodconverter-cli from the latest release, unpack it, then:
bin/jodconverter-cli document.docx document.pdf
(bin\jodconverter-cli.bat on Windows.)
Going further
- PDF options: PDF/A, PDF/UA, passwords, watermark, signature.
- Supported formats and configuration of the office managers.
- Running in containers, and converting through a LibreOffice Online or Collabora Online server instead of a local office.
Getting help and contributing
- Questions and discussions: the Gitter room. Bugs and feature requests: the issues, after a look at the FAQ.
- Contributions are welcome: see the contributing guide.
- To report a vulnerability, see the security policy.
License
JODConverter is licensed under the Apache License, Version 2.0.
Ähnliche Projekte entdecken
Wird geladen…