Developer Platform

Developer Documentation & SDKs

Integrate PDFSpectrum rendering capabilities into your apps via HTTP API or native SDK client wrappers. Complete endpoint definitions, storage bindings, and layouts are documented below.

Quickstart API Reference

PDFSpectrum exposes a unified, highly optimized, multi-tenant endpoint for compiling dynamic HTML to pixel-perfect PDFs using high-performance Playwright/Chromium virtualization.

HTTP MethodPOST
API Endpointhttps://api.pdfspectrum.com/api/v1/pdf/generate
AuthenticationBearer <YOUR_API_KEY>

Zero-Trust BYOS Credentials Map

By configuring Bring Your Own Storage (BYOS) credentials in your Settings > Storage panel, PDFSpectrum securely routes rendered PDFs directly into your target bucket (S3, MinIO, Azure Blob, GCS).

How BYOS Processing Works
  • When a rendering request finishes, the file is temporarily loaded in memory and immediately streamed to your custom bucket.
  • The file URL stored in the usage logs points to your bucket, keeping document payloads completely isolated from PDFSpectrum servers.
  • Use AWS IAM roles with minimal permissions: s3:PutObject, s3:GetObject, and s3:DeleteObject.

Webhooks & HMAC Verification

PDFSpectrum fires webhook events for lifecycle updates like pdf.completed and pdf.failed. All webhook payloads are signed using a SHA-256 HMAC signature inside the header X-PdfSpectrum-Signature.

Verify HMAC in Node.js:

const crypto = require('crypto');

function verifySignature(payload, signatureHeader, secret) {
  const hmac = crypto.createHmac('sha256', secret);
  const digest = hmac.update(payload).digest('hex');
  return signatureHeader === digest;
}

PDF Layout Troubleshooting

Common rendering issues and printable CSS tips for Chrome/Playwright:

  • Page Breaks: Use printable CSS directives like page-break-inside: avoid; on table rows, headings, and visual block containers to avoid rows cutting across margins.
  • Asset Loading: All external images and CSS assets must resolve within 10 seconds. Use local base64 data URIs for fonts or images to maximize offline render speeds.
  • Google Fonts: Import google fonts in CSS or declare them inside style tags. Intercepted local font assets will serve automatically, avoiding roundtrips.

Custom Page Setup options

Pass specific customization options under the options dictionary block:

ParameterTypeDefaultDescription
formatstring“A4”Paper format, e.g., Letter, Legal, A4, A3.
printBackgroundbooleantruePrint background graphics, colors, and images.
marginobjectnoneSpecify page margins (top, bottom, left, right).
landscapebooleanfalsePaper orientation. Set true for landscape format.

SDK Code Sandbox

HTTP REQUESTCURL
curl -X POST https://api.pdfspectrum.com/api/v1/pdf/generate \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --output invoice_1042.pdf \
  -d '{
    "html": "<html><body><h1>Invoice #1042</h1><p>Amount: $120.00</p></body></html>",
    "documentName": "invoice_1042",
    "documentType": "Custom",
    "options": {
      "format": "A4",
      "printBackground": true,
      "margin": { "top": "20px", "bottom": "20px" }
    }
  }'

API requests are subjected to tenant limits based on your entitlement quota plans. Unused request allocations expire at the end of the monthly billing cycle.