A comprehensive skill for creating beautiful PDFs from HTML/CSS with precise control over typography, layout, colors, and design.
This skill enables AI assistants to create stunning, professional PDFs using familiar HTML and CSS instead of low-level PDF libraries. It provides design freedom, visual development, and precise control over page breaks, margins, and print layouts.
- Modern Web Technologies: Use HTML5 and CSS3 to design professional documents
- Multiple Tools: Support for Playwright (recommended), WeasyPrint, and pdfkit
- Design Freedom: Full control over typography, layouts, colors, and gradients
- Visual Development: See your design in a browser before converting to PDF
- Page Break Control: Precise control over pagination and print layouts
pip install playwright --break-system-packages
playwright install chromiumpip install weasyprint --break-system-packagesCreate an HTML document and convert it to PDF using Playwright:
from playwright.sync_api import sync_playwright
def html_to_pdf_playwright(html_file, pdf_file):
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto(f'file://{html_file}')
page.pdf(
path=pdf_file,
format='A4',
print_background=True,
margin={'top': '0', 'right': '0', 'bottom': '0', 'left': '0'}
)
browser.close()- Reports, proposals, and presentations
- Invoices, certificates, and official documents
- Multi-page documents with consistent styling
- Marketing materials and brochures
- Any document where visual design matters
See SKILL.md for comprehensive documentation including:
- Detailed usage examples
- CSS best practices for PDF
- Advanced techniques (headers, footers, custom fonts)
- Complete workflow examples
- Troubleshooting guide
This skill was created using Desktop Commander - an MCP server that enables AI assistants to interact with your local file system and execute commands.
MIT