Enabling PDF Capability
To use PDF generation tools, start the MCP server with the pdf capability:browser_pdf_save
Save the current page as a PDF document.File name to save the PDF to. Defaults to
page-{timestamp}.pdf if not specified. Prefer relative file names to stay within the output directory.Use Cases
Generate Reports
Create PDF reports from web dashboards or analytics pages:Archive Web Content
Preserve web content as PDF for archival purposes:Batch PDF Generation
Generate multiple PDFs from different pages:Create Printable Versions
Generate printer-friendly PDFs of web content:PDF Formatting Tips
Wait for Content to Load
Wait for Content to Load
Always wait for dynamic content to fully load before generating PDFs. Use
browser_wait_for with appropriate time or text conditions.Consider Page Width
Consider Page Width
The PDF will reflect the current browser viewport size. Use
browser_resize to set an appropriate width for PDF generation:Handle Print Stylesheets
Handle Print Stylesheets
Many websites have special CSS for printing. The PDF will use these print stylesheets if they exist, which may differ from the on-screen view.
Scroll to Load Lazy Images
Scroll to Load Lazy Images
Some pages use lazy loading for images. Scroll through the page before generating the PDF to ensure all images are loaded:
File Naming
When specifying filenames for PDFs:-
Relative paths: Preferred. Will be saved in the output directory.
-
Absolute paths: Also supported, but relative paths are recommended.
-
Default naming: If no filename is provided, a timestamped name is used.
Combining with Other Tools
PDF generation works well with other Playwright MCP tools:Common Issues
Missing Content in PDF
Missing Content in PDF
If content is missing from the PDF:
- Wait longer for dynamic content to load
- Scroll through the page to trigger lazy-loaded elements
- Check if the page uses JavaScript to render content
PDF Layout Issues
PDF Layout Issues
If the PDF layout looks wrong:
- Adjust the browser viewport size with
browser_resize - Check if the site has print-specific CSS that affects layout
- Some interactive elements may not render well in PDF
File Not Found
File Not Found
If the PDF file isn’t where you expect:
- Use relative paths to save in the output directory
- Check the tool response for the actual save location
- Verify you have write permissions to the target directory
Related Tools
Take Screenshot
Capture page as image instead of PDF
Browser Resize
Adjust viewport size for optimal PDF layout
Wait For
Wait for content to load before generating PDF

