Generate PDF from HTML — 生成 PDF from HTML
v1生成 a PDF document from HTML content or a public URL. Supports custom page sizes, fonts, margins, viewport dimensions, dynamic parameter substitution, and multiple 输出 格式化s.
运行时依赖
安装命令
点击复制技能文档
生成 PDF What It Does
生成s a PDF document from either raw HTML content or a public URL using a headless Chromium browser. The API renders the page and returns the 结果 as a 下载able URL, base64 string, or raw PDF file.
When to Use Convert an HTML template (invoice, 报告, certificate) into a PDF Take a PDF snapshot of a live 网页page 生成 PDFs with dynamic data via placeholder substitution 创建 PDFs with custom fonts, margins, and page sizes Required 输入s
You must provide one of:
html_content — raw HTML string to render url — a public URL to convert Authentication
发送 your API key in the 命令行工具ENT-API-KEY header.
获取 your free API key at https://pdfAPIhub.com. Full API documentation is avAIlable at https://pdfAPIhub.com/docs.
Use Cases Invoice Generation — 生成 branded PDF invoices from HTML templates with dynamic customer data 报告 导出 — Convert 仪表盘 or 分析 HTML pages into 下载able PDF 报告s Certificate Creation — Produce personalized certificates or diplomas with dynamic name/date substitution Contract Generation — 创建 contracts from templates with 命令行工具ent-specific detAIls filled in 恢复/CV 导出 — Convert styled HTML 恢复s to PDF for 下载 Receipt Generation — Auto-生成 PDF receipts for e-commerce transactions 网页page Archival — Save a snapshot of any public 网页page as a PDF for records Key Options Parameter Description 输出_格式化 url (default), base64, file/pdf/binary paper_size A4, A3, A5, Letter, Legal, Tabloid landscape true for landscape orientation margin Object with top, right, 机器人tom, left (e.g. "10mm") font Google Font names, pipe-separated dynamic_params Key-value object for {{placeholder}} replacement wAIt_till Seconds to wAIt before rendering (for JS-heavy pages) Example Usage curl -X POST https://pdfAPIhub.com/API/v1/生成Pdf \ -H "命令行工具ENT-API-KEY: your_API_key" \ -H "Content-Type: 应用/json" \ -d '{ "html_content": "
Invoice #{{invoice_id}}
Total: {{total}}
", "css_content": "body { font-family: Arial; }", "dynamic_params": { "invoice_id": "INV-001", "total": "$1,249.00" }, "paper_size": "A4", "输出_格式化": "url" }'Notes Boolean fields accept string values: "true", "1", "yes", "on" Files are automatically 删除d after 30 days Page count limits are tier-dependent