Use Marqius Kern from Kotlin and Spring Boot
kotenberg and gotenberg-spring call Gotenberg's API at the address you give them. Marqius Kern answers that API, Gotenberg 8's and 9's, from a 41 MB image: change the image your compose file or manifest runs, and your Kotlin or Java code stays as it is.
Marqius

Try it · Review compatibility results
The container image to use in your Compose file or deployment manifest:
image: marqius/kernkotenberg and Marqius Kern, in one folder.
kotenberg calls the endpoint you give Kotenberg(...); that endpoint stays as it is.
You need: Docker, curl, a JDK 17 or later and Gradle 9.
It takes: about 10 minutes.
Step 1. Start Marqius Kern
In a new, empty folder, start Marqius Kern and wait until it answers. The first command starts it in the background, as a container named kern on port 3000; the second asks its health check until it answers.
docker run --rm -d --name kern -p 3000:3000 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/healthYou should see: a long string of letters and digits (the container's ID), then a line that begins {"status":"up".
Step 2. Make the source folder
mkdir -p src/main/kotlinYou should see: nothing printed.
Step 3. Make a small price list
printf 'Item,Qty,Price\nTea,2,3.50\nCoffee,1,4.20\n' > prices.csvYou should see: nothing printed; the folder now holds prices.csv.
Step 4. Write the two Gradle files
They build the program with kotenberg 1.3.5 from Maven Central. Save the first as settings.gradle.kts:
rootProject.name = "invoices"and the second as build.gradle.kts:
plugins {
kotlin("jvm") version "2.4.21"
application
}
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.marrek13:kotenberg:1.3.5")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
}
application {
mainClass = "MainKt"
}Step 5. Write the program
The program writes a web page, then converts it and the price list. Save it as src/main/kotlin/Main.kt:
import dev.marrek13.Kotenberg
import io.ktor.client.statement.bodyAsBytes
import java.io.File
import kotlinx.coroutines.runBlocking
fun main() = runBlocking {
File("index.html").writeText("<h1>Invoice 1001</h1><p>Thank you for your order.</p>")
Kotenberg("http://localhost:3000").use { client ->
val invoice = client.convertHtml(listOf(File("index.html")))
File("invoice.pdf").writeBytes(invoice.bodyAsBytes())
val prices = client.convertWithLibreOffice(listOf(File("prices.csv")))
File("prices.pdf").writeBytes(prices.bodyAsBytes())
}
println("Saved invoice.pdf and prices.pdf")
}Step 6. Run it, then stop Marqius Kern
gradle run
docker stop kernYou should see: Gradle build the program (the first time, it downloads Kotlin and the libraries first), then:
> Task :run
Saved invoice.pdf and prices.pdfthen BUILD SUCCESSFUL with the time the build took, and kern. Three lines that begin SLF4J(W): may come as well: no logging library is set up in this small example, and they do no harm. There are now two new files in the folder: invoice.pdf, with the heading Invoice 1001, and prices.pdf, with the price list.
If it does not work:
docker runsays the namekernis already in use: a container left from an earlier try still has it. Remove it withdocker rm -f kern, then start again from step 1.docker runsays port 3000 is already allocated or in use: another server listens on it, often your old Gotenberg. Stop that first (docker pslists the running containers).- The
curlcommand in step 1 gives up with an error:docker logs kernshows Marqius Kern's messages.
What differs from Gotenberg: No differences were reported in the library tests referenced below. Those results do not establish identical output for every document.
What to check after switching:
- if you start the server with
gotenberg --api-port=8090, as kotenberg's own guide does, keep the command: Marqius Kern takes Gotenberg's flags; - tests that start
gotenberg/gotenberg:8with Testcontainers can startmarqius/kerninstead: it answers on port 3000 and/healthas before.
gotenberg-spring and Marqius Kern, in one folder.
gotenberg-spring calls gotenberg.base-url from application.properties (version 0.4.0 reads this key, not the gotenberg.client.base-url of its README); that setting stays as it is.
You need: Docker, curl, a JDK 25 (gotenberg-spring 0.4.0 is built for Java 25) and Gradle 9.
It takes: about 10 minutes.
Step 1. Start Marqius Kern
In a new, empty folder, start Marqius Kern and wait until it answers. The first command starts it in the background, as a container named kern on port 3000; the second asks its health check until it answers.
docker run --rm -d --name kern -p 3000:3000 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/healthYou should see: a long string of letters and digits (the container's ID), then a line that begins {"status":"up".
Step 2. Make the source folders
mkdir -p src/main/java/com/example/invoices src/main/resourcesYou should see: nothing printed.
Step 3. Make a small price list
printf 'Item,Qty,Price\nTea,2,3.50\nCoffee,1,4.20\n' > prices.csvYou should see: nothing printed; the folder now holds prices.csv.
Step 4. Write the two Gradle files
They build the application with Spring Boot 4.0.10 and gotenberg-spring 0.4.0 from Maven Central. Save the first as settings.gradle.kts:
rootProject.name = "invoices"and the second as build.gradle.kts:
plugins {
java
id("org.springframework.boot") version "4.0.10"
}
repositories {
mavenCentral()
}
dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:4.0.10"))
implementation("org.springframework.boot:spring-boot-starter-restclient")
implementation("io.github.ooraini:gotenberg-spring:0.4.0")
}Step 5. Set the address
Save this as src/main/resources/application.properties:
gotenberg.base-url=http://localhost:3000Step 6. Write the application
The application makes both PDFs when it starts. Save it as src/main/java/com/example/invoices/InvoicesApplication.java:
package com.example.invoices;
import dev.gotenberg.GotenbergClient;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.FileSystemResource;
@SpringBootApplication
public class InvoicesApplication {
public static void main(String[] args) {
SpringApplication.run(InvoicesApplication.class, args);
}
@Bean
CommandLineRunner makePdfs(GotenbergClient gotenberg) {
return args -> {
String page = "<h1>Invoice 1001</h1><p>Thank you for your order.</p>";
try (InputStream pdf = gotenberg.convertHtml(page, null).getBody()) {
Files.copy(pdf, Path.of("invoice.pdf"), StandardCopyOption.REPLACE_EXISTING);
}
var prices = GotenbergClient.libreOfficeOptions().file(new FileSystemResource("prices.csv"));
try (InputStream pdf = gotenberg.convertLibreOffice(prices).getBody()) {
Files.copy(pdf, Path.of("prices.pdf"), StandardCopyOption.REPLACE_EXISTING);
}
System.out.println("Saved invoice.pdf and prices.pdf");
};
}
}Step 7. Run it, then stop Marqius Kern
gradle bootRun
docker stop kernYou should see: Gradle build the application, then Spring Boot's banner and its start-up lines, then Saved invoice.pdf and prices.pdf, BUILD SUCCESSFUL with the time the build took, and kern. There are now two new files in the folder: invoice.pdf, with the heading Invoice 1001, and prices.pdf, with the price list.
If it does not work:
docker runsays the namekernis already in use: a container left from an earlier try still has it. Remove it withdocker rm -f kern, then start again from step 1.docker runsays port 3000 is already allocated or in use: another server listens on it, often your old Gotenberg. Stop that first (docker pslists the running containers).- The
curlcommand in step 1 gives up with an error:docker logs kernshows Marqius Kern's messages.
What differs from Gotenberg: No differences were reported in the library tests referenced below. Those results do not establish identical output for every document.
What to check after switching:
- with
spring-boot-docker-compose, Spring Boot finds the server by its image name,gotenberg/gotenberg. After changing the image, add the labelorg.springframework.boot.service-connection: gotenberg/gotenbergto the service incompose.yaml, and Spring Boot finds it again; - tests that start
gotenberg/gotenberg:8with Testcontainers can startmarqius/kerninstead: it answers on port 3000 and/healthas before.
Compatibility results
The public Marqius compatibility scoreboard reports these results for Marqius Kern 0.12.18, tested on 30 November 2026 and reviewed here on 2 December 2026. The counts cover the named libraries’ or applications’ assertions, not identical rendering of every customer PDF. Compare your own documents before switching.
Library and version | Pass on Gotenberg | Pass on Marqius Kern |
|---|---|---|
kotenberg 1.3.5's own tests | 56 | 56 |
gotenberg-spring 0.4.0's own tests | 9 | 9 |
See every test on the scoreboard
Licensing Marqius Kern
Personal, teaching and open-source use is free with a Community licence, including open-source projects' CI runs and documentation builds.
- Get your free key on the Marqius Kern licence page, then sign in with Google.
- Tick "I'll use Marqius Kern only for personal, teaching or open-source work".
- Get my free key, then Copy key.
- Set it as the variable
MARQIUS_LICENCEon your server.
Anything done by or for a business, including internal tools and client work, needs a paid licence. See the plans and prices.
Deploy Marqius Kern on Railway
For a hosted PDF server, start with the Marqius Kern deployment template on Railway. The examples in this guide run locally; when using Railway, configure your client with the service’s HTTPS address and the generated credentials shown in its Variables tab.
Deploy Marqius Kern on Railway
Before you switch
Compare your own documents side by side first, as the switching guide shows, then switch.
Reader questions
Does kotenberg work with Marqius Kern?
Yes. Its own tests, all 56 that pass against Gotenberg, pass against Marqius Kern on the public scoreboard.
Does gotenberg-spring work with Marqius Kern?
Yes. Its own tests, all 9 that pass against Gotenberg, pass against Marqius Kern on the public scoreboard.
How do I add my licence?
Personal, teaching and open-source use is free with a Community licence: get the key on the Marqius Kern licence page and set it as the variable MARQIUS_LICENCE on the server. Without a key, Marqius Kern makes the same documents and says in its log that it has none. Anything done by or for a business needs a paid licence.