Package Exports
- renderpdfs
Readme
renderpdfs
Official Node.js SDK for RenderPDFs — generate pixel-perfect PDFs from HTML, Markdown, images or templates with a single API call.
Install
npm install renderpdfsQuick start
import RenderPDFs from "renderpdfs";
const client = new RenderPDFs("rpdf_your_api_key");
// HTML → PDF
const pdf = await client.generate({ html: "<h1>Hello World</h1>" });
fs.writeFileSync("output.pdf", pdf);
// Markdown → PDF
const pdf = await client.generate({ markdown: "# Report\n\nHello **world**." });
// URL → PDF
const pdf = await client.generate({ url: "https://example.com" });
// Image → PDF
const pdf = await client.generate({ image_url: "https://example.com/photo.jpg" });
// Invoice template
const pdf = await client.template("invoice", {
company_name: "Acme Corp",
client_name: "John Doe",
invoice_number: "INV-001",
issue_date: "2026-04-01",
due_date: "2026-05-01",
items: [{ description: "Web Development", quantity: 1, unit_price: "$1,500", amount: "$1,500" }],
total: "$1,500.00",
status: "due",
});
// Merge PDFs
const merged = await client.merge([
"https://example.com/doc1.pdf",
"https://example.com/doc2.pdf",
]);
// Store in cloud (returns URL instead of Buffer)
const { url } = await client.generate({ html: "<h1>Hello</h1>", store: true });
console.log(url); // https://cdn.renderpdfs.com/...Available templates
| Template | Description |
|---|---|
invoice |
Professional invoice with line items, tax, and status badge |
receipt |
Compact receipt for POS and e-commerce |
report |
Formatted report with sections and tables |
contract |
Service agreement with signature fields |
certificate |
Elegant certificate with decorative border |
offer-letter |
Job offer letter with compensation details |
API reference
new RenderPDFs(apiKey, options?)
| Option | Type | Default |
|---|---|---|
apiKey |
string |
required |
options.baseUrl |
string |
https://api.renderpdfs.com |
client.generate(input)
| Field | Type | Description |
|---|---|---|
html |
string |
Raw HTML string (max 5MB) |
url |
string |
Public URL to capture |
markdown |
string |
Markdown string (max 1MB) |
image_url |
string |
Public image URL |
store |
boolean |
Return URL instead of Buffer |
options.format |
"A4" | "A3" | "Letter" |
Page size (default: A4) |
options.margin |
string |
CSS margin (default: 20mm) |
options.landscape |
boolean |
Landscape orientation |
client.template(name, data, options?)
client.merge(urls, options?)
Get an API key
Sign up free — 100 PDFs/month, no credit card required.