Recipes
Generate a PDF and Deploy It
Use an AI agent or script to generate a PDF document and deploy it to a shareable URL with deplo.sh.
Generate invoices, contracts, certificates, or any PDF and make it instantly accessible via a URL. No file servers, no email attachments.
The workflow
Data / Template → Generate PDF → deplo deploy → Share the URLThe recipient opens a link in their browser — no download required.
With the TypeScript SDK
import { DeploClient } from '@deplo/typescript-sdk';
import puppeteer from 'puppeteer';
const client = new DeploClient({ apiKey: process.env.DEPLO_KEY! });
// 1. Generate PDF from HTML
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(`
<html>
<body style="font-family: system-ui; padding: 40px;">
<h1>Invoice #2024-0042</h1>
<table>
<tr><td>Consulting — 40 hours</td><td>$6,000</td></tr>
<tr><td>Infrastructure setup</td><td>$2,500</td></tr>
<tr><td><strong>Total</strong></td><td><strong>$8,500</strong></td></tr>
</table>
<p>Due: April 15, 2026</p>
</body>
</html>
`);
const pdfBuffer = await page.pdf({ format: 'A4' });
await browser.close();
// 2. Deploy the PDF
const { url } = await client.deploy({
project: 'invoice-2024-0042',
files: [{
path: 'invoice.pdf',
content: Buffer.from(pdfBuffer).toString('base64'),
encoding: 'base64',
}],
ttl: '90d',
});
console.log(`Invoice: ${url}`);
// → Invoice: https://invoice-2024-0042.deplo.sh/invoice.pdfWith Claude Desktop (MCP)
Ask Claude directly:
Generate a professional invoice PDF for client "Acme Corp":
- 40 hours consulting at $150/hr
- Infrastructure setup: $2,500
- Payment terms: Net 30
Deploy it so I can send the link.
Claude will generate the HTML, render it, and deploy the PDF.
With the CLI
# Deploy an existing PDF
deplo deploy contract.pdf --project client-contract --ttl 90d
# Generate with wkhtmltopdf and deploy
wkhtmltopdf report.html report.pdf && \
deplo deploy report.pdf --project monthly-report --ttl 30d
# Generate with Python and pipe
python generate_invoice.py --output pdf | deplo deploy - \
--project invoice-latest --ttl 90dReal-world examples
| Document | How it's generated | TTL |
|---|---|---|
| Invoice | Puppeteer / wkhtmltopdf from template | 90d |
| Certificate | AI fills template with recipient name | forever |
| Contract | AI drafts from terms, exports as PDF | 30d |
| Data export | pandas → HTML → PDF | 7d |
| Meeting notes | AI summarizes transcript, formats as PDF | 14d |
| Compliance report | Automated audit → formatted PDF | 365d |
Batch PDF generation
Generate and deploy multiple documents:
const invoices = [
{ id: '0042', client: 'Acme Corp', amount: 8500 },
{ id: '0043', client: 'Globex Inc', amount: 12000 },
{ id: '0044', client: 'Initech', amount: 3200 },
];
for (const inv of invoices) {
const pdf = await generateInvoicePDF(inv);
const { url } = await client.deploy({
project: `invoice-${inv.id}`,
files: [{ path: 'invoice.pdf', content: pdf, encoding: 'base64' }],
ttl: '90d',
});
console.log(`${inv.client}: ${url}`);
}PDF with companion page
Deploy a PDF alongside an HTML preview page:
const { url } = await client.deploy({
project: 'q1-report',
files: [
{ path: 'index.html', content: previewHtml, encoding: 'utf8' },
{ path: 'report.pdf', content: pdfBase64, encoding: 'base64' },
],
ttl: '30d',
});
// index.html can link to report.pdf for downloadWhat's next?
- AI-generated reports — deploy HTML reports with charts
- Slack notification workflow — post deploy URLs to Slack
- Deploy any file type — CSV, images, logs, and more
- REST API reference — deploy from any language