Installation
Authentication
pk_test_ keys by default. Pass --live to use your live key:
Quick examples
Configuration
The CLI reads frompdfbase.json in your project root for template definitions. See Templates-as-Code.
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Generate and manage PDFs from your terminal.
npm install -g @pdfbase/cli
npx @pdfbase/cli create --html "<h1>Hello</h1>" -o hello.pdf
# Set your API key
pdfbase auth login
# Or use an environment variable
export PDFBASE_API_KEY=pk_live_xxx
pk_test_ keys by default. Pass --live to use your live key:
pdfbase create --html "<h1>Hello</h1>" -o hello.pdf --live
# Generate from HTML string
pdfbase create --html "<h1>Invoice</h1><p>Total: $500</p>" -o invoice.pdf
# Generate from an HTML file
pdfbase create --from html --input report.html -o report.pdf
# Generate from a URL
pdfbase create --from url --input "https://your-app.com/report" -o report.pdf
# Render a template with data
pdfbase render invoice --data '{"number":"INV-001","customer":"Acme"}' -o invoice.pdf
# Render with data from a JSON file
pdfbase render invoice --data-file data.json -o invoice.pdf
# Push templates from your project
pdfbase templates push
# Preview a template locally
pdfbase templates preview invoice --data-file sample.json
pdfbase.json in your project root for template definitions. See Templates-as-Code.
| Flag | Description |
|---|---|
--live | Use live API key instead of test |
--api-key | Override the API key for this command |
--output, -o | Output file path |
--format | Page format (a4, letter, etc.) |
--debug | Enable debug mode |
--json | Output raw JSON response |
--quiet, -q | Suppress progress output |