---
title: "PDFs"
description: "Print a page to PDF."
---

> Documentation Index
> Fetch the complete documentation index at: https://help.tooluse.net/llms.txt
> Use this file to discover all available pages before exploring further.

# PDFs

<p>Use the running session’s returned CDP connection and Chromium’s <code>Page.printToPDF</code> for the page you control. There is no separate native PDF HTTP endpoint.</p>
<pre><code class="language-javascript">// client is an already connected, page-scoped CDP session.
const {data} = await client.send("Page.printToPDF", {
  printBackground: true, preferCSSPageSize: true
});
await writeFile("page.pdf", Buffer.from(data, "base64"));
</code></pre>
<p>Import <code>writeFile</code> from <code>node:fs/promises</code> in a Node.js program. The base64 result belongs to your automation process; it is not a signed download URL. Review the page and its permissions before capturing sensitive content.</p>
<p>See <a href="/browsers/getting-started/create-browser-session">Create a browser session</a> and the <a href="/browsers/api">Browsers API</a> for authentication, request fields, and limits.</p>

Source: https://help.tooluse.net/browsers/files/pdfs/index.mdx
