OGP images and file export

Add build-time OGP image generation with Satori and PDF or PNG export with Cloudflare Browser Run.

Save OGP images at build time with Satori

Generate an SVG with Satori and a 1200×630 PNG with resvg from the manifest returned by compileDecks(), without Browser Rendering. Keep image generation in a Node build script so neither the Worker runtime nor hono-decks core gains these dependencies.

src/decks.ts
// src/decks.ts
export const decks = createDecks({
  viewer: { openGraph: true },
})

Enabling viewer.openGraph emits absolute Open Graph and Twitter Card tags from decks.paths(slug).ogImage, which defaults to /decks/:slug/og.png. Save the PNG under Wrangler Static Assets.

To let X posts play the deck inline, set viewer.openGraph.twitterPlayer and enable embed. The Player Card frames /:slug/embed, and hono-decks adds X's origins to its frame-ancestors. X no longer documents Player Cards. In a public test from October 2026, web posts played inline without approval, the mobile apps opened the embed in a web view, and the player did not work in X Articles, so keep generating it.

export const decks = createDecks({
  embed: {},
  viewer: { openGraph: { twitterPlayer: true } },
})

Open the complete Satori + resvg recipe →

build.ogpCacheFile caches LinkCard metadata inside slides; it is unrelated to this viewer share image.

Export PDF and PNG with Browser Run

Use Cloudflare Browser Run Quick Actions through a browser binding to return the deck's print page as PDF or PNG. hono-decks calls quickAction("pdf") or quickAction("screenshot"), so this flow needs neither Puppeteer, Playwright, nor a Browser Run API token.

wrangler.jsonc
{
  "compatibility_date": "2026-07-15",
  "browser": {
    "binding": "BROWSER",
    "remote": true
  }
}

The next example assumes an earlier session or Cloudflare Access validation middleware has set deckExportAllowed.

src/decks.ts
// src/decks.ts
import type { DeckBrowserRunBinding } from "hono-decks"
import { createDecks } from "#decks"

type AppEnv = {
  Bindings: {
    BROWSER: DeckBrowserRunBinding
  }
  Variables: {
    deckExportAllowed: boolean
  }
}

export const decks = createDecks<AppEnv>({
  export: {
    browser: ({ c }) => c.env.BROWSER,
    authorize: ({ c }) => c.get("deckExportAllowed") === true,
    pdf: true,
    png: true,
  },
})
Route / APIPurpose
/:slug/printAll-slide document used as Browser Run input
/:slug/export.pdfDownload the print document as PDF
/:slug/export.pngDownload a full-page PNG of the print document

After authorize succeeds, the export request sends the public print URL to the binding and returns its file as an attachment. Viewer export controls are shown only on requests that pass the same authorization.

Store bearer tokens as Wrangler secrets rather than plain vars values.

Read the Cloudflare Browser Run Quick Actions docs →

Open the example with Browser Run configured →

Cross-device presentation control

See Presenter view and remote control for the presenter view, timer, Durable Object setup, and phone connection steps.

Built with HonoX and honoxpress.