> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ohmyho.st/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> For account actions, read https://ohmyho.st/skills/ohmyhost-get-started/SKILL.md and use the authenticated ohmyho.st CLI, local product MCP or supported remote OAuth MCP. Read the current project source binding before choosing GitHub or managed versions. Mintlify search only reads documentation. Preserve the customer’s selected project, environment and authentication provider; keep private application values in the one-hour secret link or local stdin flow.

# Render HTML as PDF

> Render server-side HTML and embedded assets with managed Browser PDF and measured credit pricing.

Client 0.1.57 or newer. Requires active [Paid coverage](https://docs.ohmyho.st/billing.md) and sufficient credits within the project's Stop budget.

Declare `browser.enabled: true` in `ohmyhost.yaml` for an edge or functions application. The platform injects `OHMYHOST_BROWSER_BASE_URL` and an environment-specific `OHMYHOST_BROWSER_KEY`. Call from authorized server code with global `fetch`; never expose the key to a browser or place the service in `runtime.egress.allow`. Both logical customer Dev and Prod use the managed service.

```ts theme={null}
const response = await fetch(`${env.OHMYHOST_BROWSER_BASE_URL}/pdf`, {
  method: "POST",
  headers: {
    authorization: `Bearer ${env.OHMYHOST_BROWSER_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({ html }),
});
if (!response.ok) {
  // Return an application error; never log document content or the gateway key.
  throw new Error("PDF rendering failed");
}
return new Response(await response.arrayBuffer(), {
  headers: { "content-type": "application/pdf", "cache-control": "no-store" },
});
```

Use HTML with inline CSS and embedded data images/fonts. CSS `@page` sizes are honored. Resource-hint and nested browsing-context tags (`link`, `base`, `iframe`, `frame`, `object`, `embed`, `portal`, `fencedframe`) are refused before rendering; this conservative v1 filter can also match literal tag examples in comments. Ordinary text and anchor links remain accepted. JavaScript is disabled. External resources are unsupported; embed assets as data URLs. Limits are 1 MiB HTML, 10 MiB PDF, 50 pages and a 30-second end-to-end request deadline. Excess pages are refused rather than truncated. Handle input/limit failures, unavailable service, rate limits and credit/budget refusals explicitly. The platform does not retain or log HTML/PDF.

**Processing is global.** The project region does not pin Cloudflare Browser processing to EU or US.

Calls cost twice the published variable provider price using its measured browser duration, with no additional general margin. Fractional durations are preserved and rounded once at the final microcredit. A call keeps its admission price. Already dispatched provider work may finish after a timeout or disconnect and settle once; a duration never observed before invocation termination is unmeasured, charged zero and absorbed by the platform. A content-free journal retries observed measurements after temporary accounting failure. Never infer success or absence of billing from a timeout, and never retry an expensive render merely to poll it.

Verify a real PDF from the hosted application, including Unicode, page breaks, embedded assets and the expected document.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.