Deplo
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 URL

The 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.pdf

With 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 90d

Real-world examples

DocumentHow it's generatedTTL
InvoicePuppeteer / wkhtmltopdf from template90d
CertificateAI fills template with recipient nameforever
ContractAI drafts from terms, exports as PDF30d
Data exportpandas → HTML → PDF7d
Meeting notesAI summarizes transcript, formats as PDF14d
Compliance reportAutomated audit → formatted PDF365d

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 download

What's next?

On this page