Html To Pdf Api
Pricing
from $14.00 / 1,000 results
Go to Apify Store
Under maintenance
Html To Pdf Api
π Convert any HTML page or URL to high-quality PDF documents via API. Perfect for reports, invoices, documentation, web page archiving, and automated document generation.
Pricing
from $14.00 / 1,000 results
Rating
0.0
(0)
Developer

SimplifySME Toolbox
Maintained by Community
Actor stats
0
Bookmarked
1
Total users
1
Monthly active users
5 days ago
Last modified
Categories
Share
π Convert any HTML page or URL to high-quality PDF documents via API. Perfect for reports, invoices, documentation, web page archiving, and automated document generation.
π Key Features
| Feature | Description |
|---|---|
| π High Quality PDFs | Professional PDF generation with full formatting |
| π URL or HTML | Convert URLs or raw HTML content |
| π Custom Format | A4, Letter, Legal, and more page formats |
| π Landscape/Portrait | Choose orientation |
| π¨ Full Styling | Includes backgrounds, colors, and graphics |
| β±οΈ Smart Waiting | Wait for selectors before PDF generation |
| π Header/Footer | Custom headers and footers with page numbers |
| π Public URLs | Direct download URLs for your PDFs |
π₯ Input
Required
url(string):- URL to convert to PDF, OR
- Raw HTML content (if
htmlContent: true) - Example:
"https://example.com"or"<html><body>Hello</body></html>"
Optional
htmlContent(boolean, default: false): Set totrueifurlcontains raw HTMLformat(string, default: "A4"): Page format (A4, Letter, Legal, Tabloid, Ledger, A0-A6)landscape(boolean, default: false): Print in landscape orientationmarginTop(string, default: "1cm"): Top margin in CSS units (e.g., "1cm", "10mm", "1in")marginRight(string, default: "1cm"): Right margin in CSS unitsmarginBottom(string, default: "1cm"): Bottom margin in CSS unitsmarginLeft(string, default: "1cm"): Left margin in CSS unitsdisplayHeaderFooter(boolean, default: false): Show header/footerheaderTemplate(string): HTML template for header (supportsdate,title,url,pageNumber,totalPages)footerTemplate(string): HTML template for footerprintBackground(boolean, default: true): Include background graphicsscale(number, default: 1): Scale factor (0.1 to 2)waitForSelector(string): CSS selector to wait for before generating PDFwaitTimeout(number, default: 30000): Max wait time in milliseconds
π€ Output
Returns PDF metadata with download URL:
{"url": "https://example.com","pdfKey": "pdf-1234567890-abc123.pdf","pdfUrl": "https://api.apify.com/v2/key-value-stores/.../pdf-1234567890-abc123.pdf","format": "A4","landscape": false,"pageCount": 3,"fileSize": 145678,"timestamp": "2024-01-01T12:00:00.000Z","_metadata": {"runId": "abc123","actorId": "user/html-to-pdf-api","processedAt": "2024-01-01T12:00:00.000Z","processingTimeMs": 3500}}
π‘ Use Cases
- β Invoice Generation - Convert HTML invoices to PDF
- β Report Creation - Generate PDF reports from web dashboards
- β Documentation - Archive web pages as PDFs
- β Email Attachments - Generate PDFs for email campaigns
- β Legal Documents - Convert contracts and agreements
- β Receipts & Statements - Generate printable documents
- β Web Page Archiving - Save web pages as PDFs
π Examples
Basic URL to PDF
{"url": "https://example.com"}
HTML Content to PDF
{"url": "<html><body><h1>Hello World</h1><p>This is a PDF!</p></body></html>","htmlContent": true}
Custom Format with Header/Footer
{"url": "https://example.com","format": "Letter","landscape": true,"displayHeaderFooter": true,"headerTemplate": "<div style='font-size:10px; text-align:center; width:100%;'><span class='title'></span></div>","footerTemplate": "<div style='font-size:10px; text-align:center; width:100%;'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></div>"}
Wait for Content to Load
{"url": "https://example.com/dashboard","waitForSelector": ".chart-container","waitTimeout": 10000}
π Notes
- PDFs are stored securely and accessible via public URLs
- Large pages may take longer to generate
- Use
waitForSelectorfor pages with dynamic content that needs time to load - Header/footer templates support CSS styling and special variables:
date,title,url,pageNumber,totalPages