Key Facts
- Category
- Document Tools
- Input Types
- textarea, select, checkbox, number
- Output Type
- file
- Sample Coverage
- 4
- API Ready
- Yes
Overview
This tool converts HTML and CSS into PDF documents with precise control over layout, including custom headers, footers, and print settings. It uses a headless browser to ensure high-fidelity rendering, making it ideal for professional documents that require exact formatting.
When to Use
- •When you need to generate PDFs from web-based content with exact layout preservation.
- •When custom headers and footers, such as dynamic page numbers or logos, are required.
- •When specific print configurations like page size, margins, and background printing must be applied.
How It Works
- •Input your HTML content and optional custom CSS for styling.
- •Configure page settings such as size, orientation, margins, and scale.
- •Define header and footer templates using HTML with placeholders for page numbers.
- •The tool renders the content in a headless browser and outputs a PDF file.
Use Cases
Examples
1. Generate an Invoice PDF
Freelancer- Background
- You have an HTML invoice template that needs to be converted to PDF for client billing.
- Problem
- Manual PDF conversion doesn't maintain styling or add page numbers automatically.
- How to Use
- Paste the HTML invoice code into the HTML Content field, add CSS for formatting, and set a footer with page numbers using the footer template.
- Example Config
-
Footer template: <div style='text-align:center;'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></div> - Outcome
- A professional PDF invoice with correct layout, page numbers, and no manual formatting needed.
2. Create a Printable Dashboard Report
- Background
- A web dashboard with charts and tables needs to be printed for a presentation.
- Problem
- Browser print preview doesn't preserve the dashboard layout or add custom headers.
- How to Use
- Input the dashboard HTML, configure A4 landscape orientation with margins, and add a header with the report title.
- Outcome
- A high-quality PDF report that matches the web view, ready for printing and sharing.
Try with Samples
html, pdfRelated Hubs
FAQ
What page sizes are supported?
A4, Letter, Legal, and A5.
How do I add page numbers to the PDF?
Use <span class='pageNumber'></span> and <span class='totalPages'></span> in your header or footer HTML template.
Can I use CSS for print-specific styling?
Yes, you can add custom CSS and enable 'Prefer CSS Page Size' to use @page rules.
What is the 'Wait Until' option for?
It controls when the page is considered loaded, such as waiting for network activity to finish.
How can I adjust the PDF scaling?
Use the Scale option to set a value between 0.5 and 2, with 1 as the default.