--- name: pdforge description: PDForge (PDF Noodle) API for generating PDFs from templates or HTML via curl. vm0_secrets: - PDFORGE_API_KEY --- # PDForge API (PDF Noodle) Use the PDForge API via direct `curl` calls to **generate PDFs** from templates or raw HTML. > Official docs: `https://docs.pdforge.com/` Note: PDForge has been rebranded to PDF Noodle. Both `api.pdforge.com` and `api.pdfnoodle.com` work. --- ## When to Use Use this skill when you need to: - **Generate PDFs from reusable templates** with dynamic data - **Convert HTML to PDF** directly - **Create invoices, reports, or documents** programmatically - **Export PNG images** instead of PDFs - **Batch generate documents** using async endpoints with webhooks --- ## Prerequisites 1. Sign up at [PDF Noodle](https://pdfnoodle.com/) (formerly PDForge) 2. Go to the API Keys menu in the dashboard 3. Copy your API key (format: `pdfnoodle_api_xxxxx`) 4. Store it in the environment variable `PDFORGE_API_KEY` ```bash export PDFORGE_API_KEY="pdfnoodle_api_your-key-here" ``` --- > **Important:** When using `$VAR` in a command that pipes to another command, wrap the command containing `$VAR` in `bash -c '...'`. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly. > ```bash > bash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq '.field' > ``` ## How to Use All examples below assume you have `PDFORGE_API_KEY` set. Base URL: `https://api.pdfnoodle.com/v1` --- ### 1. Generate PDF from Template (Sync) Generate a PDF using a pre-built template with dynamic data. Write to `/tmp/pdforge_request.json`: ```json { "templateId": "your-template-id", "data": { "name": "John Doe", "date": "2025-01-15", "items": [ {"description": "Item 1", "price": 100}, {"description": "Item 2", "price": 200} ] } } ``` Then run: ```bash bash -c 'curl -s -X POST "https://api.pdfnoodle.com/v1/pdf/sync" --header "Authorization: Bearer ${PDFORGE_API_KEY}" --header "Content-Type: application/json" -d @/tmp/pdforge_request.json' ``` **Response:** ```json { "signedUrl": "https://storage.googleapis.com/...", "executionTime": 1234 } ``` The `signedUrl` is a temporary URL (expires in 1 hour) to download the generated PDF. --- ### 2. Generate PDF from Template (Async) For batch processing, use the async endpoint with a webhook. Write to `/tmp/pdforge_request.json`: ```json { "templateId": "your-template-id", "webhook": "https://your-server.com/webhook", "data": { "name": "Jane Doe", "amount": 500 } } ``` Then run: ```bash bash -c 'curl -s -X POST "https://api.pdfnoodle.com/v1/pdf/async" --header "Authorization: Bearer ${PDFORGE_API_KEY}" --header "Content-Type: application/json" -d @/tmp/pdforge_request.json' ``` **Response:** ```json { "requestId": "abc123" } ``` The webhook will receive the `signedUrl` when generation is complete. --- ### 3. Convert HTML to PDF (Sync) Convert raw HTML directly to PDF without a template. Write to `/tmp/pdforge_request.json`: ```json { "html": "
This is a PDF generated from HTML.
" } ``` Then run: ```bash bash -c 'curl -s -X POST "https://api.pdfnoodle.com/v1/html-to-pdf/sync" --header "Authorization: Bearer ${PDFORGE_API_KEY}" --header "Content-Type: application/json" -d @/tmp/pdforge_request.json' ``` --- ### 4. Convert HTML to PDF with Styling Include CSS for styled PDFs. Write to `/tmp/pdforge_request.json`: ```json { "html": "Amount: $500