HUB
Sign inSign up
aeropdf logo

nxtgencat/aeropdf

By nxtgencat

•Updated 6 months ago

Image
Developer tools
0

1.8K

nxtgencat/aeropdf repository overview

⁠AeroPDF

Lightweight HTTP service that renders HTML or URLs to PDF using Chromium headless shell via Playwright⁠. Runs in Docker with structured JSON logging (pino⁠).

⁠Quick Start

docker compose up -d --build

The service starts on http://localhost:3000⁠.

⁠API

⁠POST /pdf

Render HTML or a URL to PDF.

Request body (JSON):

FieldTypeDefaultDescription
htmlstring—HTML content to render (provide html or url)
urlstring—URL to navigate and render
formatstringA4Page format (A4, Letter, etc.)
landscapebooleanfalseLandscape orientation
marginobject10mm all sides{ top, right, bottom, left } as CSS values
waitUntilstringnetworkidleload, domcontentloaded, networkidle, commit
headersobject{}Extra HTTP headers for page navigation

Response: application/pdf

Example:

curl -X POST http://localhost:3000/pdf \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello World</h1>", "format": "A4"}' \
  -o output.pdf
⁠GET /health

Returns service health and stats.

{
  "status": "ok",
  "browserReady": true,
  "uptime": 42.5,
  "requestCount": 10,
  "launchCount": 1
}

⁠Environment Variables

VariableDefaultDescription
PORT3000Server port
PAGE_LOAD_TIMEOUT30000Page load timeout in ms
CORS_ORIGIN*Allowed CORS origin
LOG_LEVELinfoPino log level (debug, info, warn, error)
NODE_ENV—Set to production for raw JSON logs

⁠Project Structure

├── server.ts             # Express server with Playwright PDF rendering
├── Dockerfile            # Single-stage build with chromium headless shell
├── docker-compose.yml    # Docker Compose config with healthcheck
├── package.json
├── test/
│   └── test.ts           # Integration test (health + PDF generation)
└── env.example

⁠Development

# Install dependencies
pnpm install

# Run locally (requires Playwright browsers installed)
pnpm dev

# Run tests (requires service running)
pnpm test

⁠Docker Image

The image uses node:25-slim with only the Chromium headless shell (~110 MB) — no full browser, no Firefox, no WebKit. System dependencies are auto-installed via npx playwright install --with-deps chromium --only-shell.

Tag summary

Content type

Image

Digest

sha256:ec0d0522d…

Size

313.7 MB

Last updated

6 months ago

docker pull nxtgencat/aeropdf