Skip to main content
Run a URL-to-PDF conversion using the hosted API or a local Gotenberg instance.

Prerequisites

  • A supported runtime: Node.js 18+, Deno 1.x, or Bun
  • For hosted API: an API key from chromiumly.dev
  • For self-hosted: Docker and a running Gotenberg container (e.g. docker run --rm -p 3000:3000 gotenberg/gotenberg:8)

Step 1: Install

npm install chromiumly

Step 2: Configure (pick one)

Hosted API — set your API key so requests go to https://api.chromiumly.dev:
export CHROMIUMLY_API_KEY=your-api-key
Or in code:
import { Chromiumly } from "chromiumly";

Chromiumly.configure({ apiKey: "your-api-key" });
Self-hosted — point to your Gotenberg URL:
export GOTENBERG_ENDPOINT=http://localhost:3000
Or in code:
import { Chromiumly } from "chromiumly";

Chromiumly.configure({ endpoint: "http://localhost:3000" });

Step 3: Convert a URL to PDF

import { UrlConverter } from "chromiumly";

async function run() {
  const urlConverter = new UrlConverter();
  const buffer = await urlConverter.convert({
    url: "https://www.example.com/",
  });
  // Use buffer: write to disk, send in HTTP response, etc.
}

run();
The buffer contains the PDF bytes (a Buffer in Node, or the runtime’s equivalent). Write it to a file, pipe it to a response, or pass it to PDFEngines.generate for a convenience helper.

Next steps

  • Installation — package managers and prerequisites
  • Configuration — dotenv, config lib, and Chromiumly.configure()
  • Chromium — HTML and Markdown conversion, screenshots, and options