Skip to main content
With Browserbase, you can work with PDFs in a few ways:
  1. Generate: Create PDFs from web pages with Playwright’s page.pdf() method.
  2. Download: Auto-download PDFs to Browserbase’s cloud storage by opening a PDF URL. To retrieve them, see the Downloads documentation.
  3. View: Display PDFs in the browser, instead of downloading them, by setting the enablePdfViewer property in your browser settings.

Generate PDFs

After creating and connecting to a session, here’s how to generate a PDF from a web page using Playwright:
Playwright

Download PDFs

When you navigate to a PDF URL, Browserbase automatically downloads the PDF and cancels the navigation. Browserbase stores the file in cloud storage for later retrieval.
Retrieve the downloaded PDF from Browserbase’s cloud storage. See Downloads for details on accessing your files.
View or run the example template here

View PDFs

To view a PDF in the browser tab instead of downloading it, set enablePdfViewer to true: