HTML to PDF

Use when: integrating with PDF API Hub REST APIs for document automation — HTML/URL to PDF, merge, split, compress, OCR, watermark, sign, lock/unlock, convert, screenshot, parse, and file management via pdfapihub.com.

Audits

Pass

Install

openclaw skills install pdf-api-hub

When to Use

User needs to call PDF API Hub endpoints (pdfapihub.com/api/v1/...) for document automation: generating PDFs from HTML/URLs, merging, splitting, compressing, OCR, watermarking, signing, encrypting/decrypting, converting between PDF and images, parsing/extracting text and tables, or managing uploaded files.

Scope

This skill ONLY:

  • Provides endpoint reference, request/response contracts, and integration patterns for the PDF API Hub REST API
  • Shows code examples in multiple languages (cURL, Python, Node.js, etc.)
  • Explains authentication, error handling, and output format options

This skill NEVER:

  • Executes API calls or generates files directly
  • Stores or transmits API keys
  • Accesses files outside the user's working directory

All code examples are reference patterns for the user to implement.

Quick Reference

TopicFile
All endpoints & parametersendpoints.md
Code examples by use caseexamples.md
Advanced workflowsadvanced.md

Authentication

Every request requires the CLIENT-API-KEY header.

CLIENT-API-KEY: <your-api-key>
Content-Type: application/json

Get your API key at pdfapihub.com/signup.

Base URL

https://pdfapihub.com/api/v1/

All endpoints use POST with JSON body.

Endpoint Map

#CategoryEndpointPathWhat it does
1DocumentGenerate PDF/generatePdfRender HTML or capture any webpage as a PDF
2DocumentParse PDF/pdf/parseExtract text, tables, or structured layout data
3DocumentMerge PDFs/pdf/mergeCombine multiple PDFs into one
4DocumentSplit PDF/pdf/splitSplit a PDF into pages, ranges, or chunks
5DocumentCompress PDF/compressPdfShrink file size (4 compression levels)
6DocumentPDF Info/pdf/infoGet metadata and page info from a PDF
7DocumentWatermark/watermarkOverlay text/logo watermarks on pages
8DocumentSign PDF/sign-pdfStamp a signature image on PDF pages
9SecurityLock PDF/lockPdfAES-256 encryption with granular permissions
10SecurityUnlock PDF/unlockPdfRemove password protection
11ConversionGenerate Image/generateImageCapture URL/HTML as PNG image
12ConversionCompress Image/compressImageReduce image file size
13ConversionPDF to Image/pdfToImageRender PDF pages as PNG/JPG/WebP
14ConversionImage to PDF/imageToPdfCombine images into a PDF
15OCRPDF OCR/pdfOcrExtract text from scanned PDF documents
16OCRImage OCR/imageOcrExtract text from photos/images
17UtilityURL to HTML/urlToHtmlFetch fully-rendered HTML via headless browser
18File MgmtUpload File/uploadFileUpload a file to cloud storage
19File MgmtList Files/listFilesList uploaded files
20File MgmtDelete File/deleteFileDelete an uploaded file
21TemplatesCreate Template/createTemplateSave a reusable HTML template
22TemplatesList Templates/listTemplatesList saved templates
23TemplatesDelete Template/deleteTemplateDelete a saved template

Output Formats

Most endpoints support the output_format parameter:

ValueDescription
urlReturns a hosted CDN URL (default)
fileReturns the file as a download
base64Returns base64-encoded content
binaryReturns raw binary stream
pdfReturns PDF file directly

Error Handling

HTTP CodeMeaningAction
400Invalid RequestCheck JSON body shape and required fields
401UnauthorizedVerify CLIENT-API-KEY header
422Validation FailedCheck URL/HTML/options for conflicts
429Rate LimitedBack off and retry with exponential delay
500Internal ErrorRetry; contact support if persistent

Common Response Shape

{
  "success": true,
  "pdf_url": "https://cdn.pdfapihub.com/pdf/a1b2c3d4.pdf",
  "file_size_bytes": 84321,
  "file_deletion_date": "2026-05-04",
  "source_type": "html"
}

Core Rules

1. Always Set output_format Explicitly

{ "output_format": "url" }

Don't rely on defaults — be explicit about whether you need a URL, file, or base64.

2. Use html_content for Dynamic Documents

{
  "html_content": "<h1>Invoice #{{number}}</h1>",
  "css_content": "h1 { color: #333; }",
  "dynamic_params": { "number": "INV-001" }
}

3. Use url for Webpage Capture

{
  "url": "https://example.com/report",
  "wait_until": "networkidle",
  "paper_size": "A4"
}

4. Handle Files via URL or Upload

For endpoints that operate on existing PDFs (merge, split, compress, etc.), provide files via:

  • Direct URL to the PDF
  • Previously uploaded file reference via the Upload File endpoint

5. Validate Responses

Always check success: true in the response before using the result.

Common Traps

TrapConsequenceFix
Missing CLIENT-API-KEY header401 errorAlways include the header
Sending both url and html_contentUndefined behaviorUse one or the other
Not setting wait_until for SPAsIncomplete captureUse networkidle for JS-heavy pages
Ignoring file_deletion_dateBroken links after expiryDownload/store files before deletion
Large HTML without paginationTimeout or huge PDFUse page_size to limit output

Security & Privacy

  • All API calls go to pdfapihub.com over HTTPS
  • API keys should be stored in environment variables, never hardcoded
  • Files hosted on CDN have an expiration date — download promptly
  • This skill provides reference patterns only; it does not execute code or store credentials

Feedback