- Generate: Create PDFs from web pages with Playwright’s
page.pdf()method. - Download: Auto-download PDFs to Browserbase’s cloud storage by opening a PDF URL. To retrieve them, see our Downloads documentation.
- View: Display PDFs in the browser, instead of downloading them, by setting the
enablePdfViewerproperty 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:- Node.js
Playwright
Download PDFs
When you navigate to a PDF URL, Browserbase automatically downloads the PDF file and cancels the navigation. The downloaded PDF is stored in Browserbase’s cloud storage for later retrieval.- Node.js
- Python
View or run the example template here
View PDFs
To view a PDF in the browser tab instead of automatically downloading it, you can set theenablePdfViewer property to true as follows:
- Node.js
- Python