MiniPdf for Java supports JDK 8 through JDK 25 as a library and command-line tool for converting DOCX, XLSX, and PPTX files to PDF without Microsoft Office or LibreOffice.
The library is available from Maven Central:
<dependency>
<groupId>io.github.mini-software</groupId>
<artifactId>minipdf</artifactId>
<version>0.4.0</version>
</dependency>import io.github.minisoftware.minipdf.MiniPdf;
import java.nio.file.Paths;
MiniPdf.convertToPdf(
Paths.get("document.docx"),
Paths.get("document.pdf"));Use MiniPdf.convertBytesToPdf when the Office document is already in memory.
ConversionOptions.withPageSize overrides the output page size.
Register fonts before converting when DOCX, XLSX, or PPTX content needs glyphs that are not available in the standard PDF fonts:
import java.nio.file.Files;
import java.nio.file.Paths;
try {
MiniPdf.registerFont(
"Noto Sans",
Files.readAllBytes(Paths.get("fonts/NotoSans-Regular.ttf")));
MiniPdf.convertToPdf(
Paths.get("document.docx"),
Paths.get("document.pdf"));
} finally {
MiniPdf.clearRegisteredFonts();
}Registered fonts are process-wide. clearRegisteredFonts removes them when the
same process needs a different font set for a later conversion.
Download the executable JAR with Maven:
mvn dependency:copy `
-Dartifact=io.github.mini-software:minipdf-cli:0.4.0 `
-DoutputDirectory=.Convert a document:
java -jar minipdf-cli-0.4.0.jar input.pptx -o output.pdfThe CLI accepts .docx, .xlsx, and .pptx files. Run it with --help for
page-size and font-directory options.
The Java implementation currently provides text-first Office conversion:
- DOCX paragraphs, tabs, line breaks, explicit and section page breaks, and landscape page size
- XLSX shared strings, inline strings, numbers, and booleans
- PPTX slide text, native slide dimensions, and one PDF page per slide
- bounded OOXML ZIP loading and XML external-entity protection
Advanced Office layout, images, charts, and embedded fonts are not yet fully reproduced by the Java renderer.
From this directory:
mvn -B -ntp verifyThe Maven Central Publish GitHub Actions workflow publishes both minipdf
and minipdf-cli. Configure these repository or maven-central environment
secrets before running it:
MAVEN_CENTRAL_USERNAMEMAVEN_CENTRAL_TOKENGPG_PRIVATE_KEYGPG_PASSPHRASE
Publish a GitHub Release whose tag matches java-v<version>, such as
java-v0.4.0, or manually dispatch the workflow with version set to 0.4.0.
The requested version must match the Maven project version.