---
type: Article
title: Use Marqius Kern with Ruby and Rails | Marqius
description: Create PDFs with gotenberg-ruby, understand Rails asset handling
  and check the rendering differences that matter.
resource: https://marqius.com/blog/ruby-rails-gotenberg-marqius-kern/
tags:
  - marqius
  - journal
status: stable
sources:
  - id: official-page
    resource: https://marqius.com/blog/ruby-rails-gotenberg-marqius-kern/
    last_modified: 2026-12-02T08:19:13.762Z
generated:
  by: process:marqius-site-build
  at: 2026-12-02T08:32:12.045Z
x_marqius:
  language: en
  source_sha256: 921708db6d8bc1f62bd73f8f4cd94bce2598d6213fcce8bf04b39521adc60ff3
  extraction: public-main-content
---

Marqius Kern developers

# Use Marqius Kern with Ruby and Rails

gotenberg-ruby calls Gotenberg's API at the address you give it. 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 Ruby and Rails code stays as it is.

Marqius December 2, 2026

[Try it](https://marqius.com/blog/ruby-rails-gotenberg-marqius-kern/#gotenberg-ruby-and-marqius-kern-in-one-folder) · [Review compatibility results](https://marqius.com/blog/ruby-rails-gotenberg-marqius-kern/#compatibility-results)

The container image to use in your Compose file or deployment manifest:

text

```
image: marqius/kern
```

* * *

## gotenberg-ruby and Marqius Kern, in one folder.

The gem calls the address you pass to `Gotenberg::Chromium.call`, `Gotenberg::Libreoffice.call` and `Gotenberg::PdfEngines.call` (its README reads it from `GOTENBERG_URL`); that address stays as it is.

**You need:** Docker, curl and Ruby 3.0 or later.

**It takes:** about 5 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.

bash

```
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/health
```

**You should see:** a long string of letters and digits (the container's ID), then a line that begins `{"status":"up"`.

### Step 2. Install the gem

This installs the gem, version 1.1.0.

bash

```
gem install gotenberg-ruby -v 1.1.0
```

**You should see:** RubyGems install the gem and the gems it needs, ending with how many it installed (`11 gems installed` on a machine that had none of them). Lines that begin `Couldn't find file to include` are about the gems' documentation, and do no harm.

### Step 3. Make a small price list

bash

```
printf 'Item,Qty,Price\nTea,2,3.50\nCoffee,1,4.20\n' > prices.csv
```

**You should see:** nothing printed; the folder now holds `prices.csv`.

### Step 4. Write the program

Save this as `invoice.rb`. Its first line loads Ruby's `tmpdir` library, which gotenberg-ruby 1.1.0 uses without loading it; without that line the gem stops with `undefined method 'mktmpdir'`, whatever the server.

ruby invoice.rb

```
require 'tmpdir'
require 'gotenberg-ruby'

address = ENV.fetch('GOTENBERG_URL')

invoice = Gotenberg::Chromium.call(address) do |doc|
  doc.html '<h1>Invoice 1001</h1><p>Thank you for your order.</p>'
end
File.binwrite('invoice.pdf', invoice.to_binary)

prices = Gotenberg::Libreoffice.call(address) do |doc|
  doc.convert 'prices.csv'
end
File.binwrite('prices.pdf', prices.to_binary)

puts 'Saved invoice.pdf and prices.pdf'
```

### Step 5. Run it, then stop Marqius Kern

`GOTENBERG_URL=http://localhost:3000` before the command sets the address for this one run; the program reads it with `ENV.fetch`.

bash

```
GOTENBERG_URL=http://localhost:3000 ruby invoice.rb
docker stop kern
```

**You should see:**

text

```
Saved invoice.pdf and prices.pdf
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 run` says the name `kern` is already in use:** a container left from an earlier try still has it. Remove it with `docker rm -f kern`, then start again from step 1.
-   **`docker run` says port 3000 is already allocated or in use:** another server listens on it, often your old Gotenberg. Stop that first (`docker ps` lists the running containers).
-   **The `curl` command in step 1 gives up with an error:** `docker logs kern` shows Marqius Kern's messages.

**What differs from Gotenberg:** The gem has no tests of its own that call a server. Use the example above to check the integration in your environment, including the PDF output.

**What to check after switching:**

-   the Rails helpers (`gotenberg_image_tag`, `gotenberg_stylesheet_tag`, `gotenberg_javascript_tag` and their Vite forms) send pictures, style sheets and scripts with the page: convert one document that uses them and compare it with `upgrade-check` ([the switching guide's first section](https://marqius.com/gotenberg/guide#1-before-you-switch));
-   Marqius Kern does not run JavaScript modules (`<script type="module">`, as Vite builds them), so check first any page whose content such a script builds. If your compose file passes `--chromium-allow-file-access-from-files=true`, as the gem's README asks for Vite assets, keep it: Marqius Kern accepts it, and its start-up log lists it among the flags with no effect.

* * *

## Compatibility results

gotenberg-ruby has no tests of its own that call a server, so the scoreboard does not provide a server test result for this gem. Run the example above against your deployment and compare your own documents before switching.

[See the libraries the scoreboard does run](https://github.com/marqiushq/gotenberg-compatibility#the-results)

* * *

## Licensing Marqius Kern

**Personal, teaching and open-source use is free** with a Community licence, including open-source projects' CI runs and documentation builds.

1.  **Get your free key** on [the Marqius Kern licence page](https://marqius.com/licence/marqius-kern), then sign in with Google.
2.  Tick "I'll use Marqius Kern only for personal, teaching or open-source work".
3.  **Get my free key**, then **Copy key**.
4.  Set it as the variable `MARQIUS_LICENCE` on your server.

**Anything done by or for a business,** including internal tools and client work, needs a paid licence. [See the plans and prices](https://marqius.com/licence/marqius-kern).

* * *

## Deploy Marqius Kern on Railway

For a hosted PDF server, start with the [Marqius Kern deployment template on Railway](https://railway.com/deploy/marqius-kern). 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](https://railway.com/deploy/marqius-kern)

## Before you switch

Compare your own documents side by side first, as the switching guide shows, then switch.

[Read the switching guide](https://marqius.com/gotenberg/guide) · [Get your free key](https://marqius.com/licence/marqius-kern)

[Explore all nine Marqius Kern developer guides](https://marqius.com/gotenberg/developers/)

## Reader questions

### Does gotenberg-ruby work with Marqius Kern?

It calls Gotenberg's API, which Marqius Kern supports. The example shows HTML and CSV conversion; run it against your deployment and check both PDFs before switching.

### Do I need to change the gem's settings?

No. It keeps the server's address it has; the switch is the image your compose file or manifest runs.

### 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](https://marqius.com/licence/marqius-kern) 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.

## Keep reading

[Marqius Kern guides for every client](https://marqius.com/gotenberg/developers/) [Generate PDFs in Swift with gotenberg-kit and Marqius Kern](https://marqius.com/blog/swift-gotenberg-kit-marqius-kern/) [Generate PDFs in Rust with gotenberg\_pdf and Marqius Kern](https://marqius.com/blog/rust-gotenberg-pdf-marqius-kern/) [Use Marqius Kern from Kotlin and Spring Boot](https://marqius.com/blog/java-kotlin-spring-marqius-kern/) [All journal guides](https://marqius.com/blog/)

Source for this page [^official-page].

[^official-page]: https://marqius.com/blog/ruby-rails-gotenberg-marqius-kern/

[Browse this section](index.md) · [Knowledge index](../index.md)
