Skip to main content

Convert URL to PDF

import { UrlConverter } from "chromiumly";

const urlConverter = new UrlConverter();
const buffer = await urlConverter.convert({
  url: "https://www.example.com/",
});
The returned buffer contains the PDF bytes (a Buffer in Node, or the runtime’s equivalent). The URL route supports SPAs and dynamic content: Chromium loads the page, runs JavaScript, and conversion runs after the page loads (and after any wait conditions you set). Optional conversion options (e.g. properties, header, footer, waitForSelector) can be passed as additional keys in the same object.

Capture URL as screenshot

import { UrlScreenshot } from "chromiumly";

const screenshot = new UrlScreenshot();
const buffer = await screenshot.capture({
  url: "https://www.example.com/",
});
The returned buffer contains the image (default format is PNG). Use the properties option to set format ("png" | "jpeg" | "webp"), quality (for JPEG), and dimensions. See Options for full screenshot options.