Comprehensive PDF processing API for conversion, merge, split, compress, OCR, and more
/plugin marketplace add vm0-ai/api0/plugin install api0@api0This skill inherits all available tools. When active, it can use any tool Claude has access to.
Comprehensive PDF processing API with 60+ operations: convert, merge, split, compress, OCR, watermark, form filling, digital signatures, and more.
Official docs: https://dev.pdf4me.com/apiv2/documentation/
Use this skill when you need to:
Set environment variable:
export PDF4ME_API_KEY="your-api-key-here"
Important: When using
$VARin a command that pipes to another command, wrap the command containing$VARinbash -c '...'. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq .
Convert Word, Excel, PowerPoint, images to PDF:
# Convert a text file to PDF
echo "Hello, PDF4ME!" > /tmp/test.txt
BASE64_CONTENT=$(base64 < /tmp/test.txt)
curl -s -X POST "https://api.pdf4me.com/api/v2/ConvertToPdf" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${BASE64_CONTENT}\",
\"docName\": \"test.txt\"
}" | jq -r '.docContent' | base64 -d > /tmp/output.pdf
Convert HTML content to PDF:
HTML_CONTENT=$(echo '<html><body><h1>Hello World</h1><p>This is a test.</p></body></html>' | base64)
curl -s -X POST "https://api.pdf4me.com/api/v2/ConvertHtmlToPdf" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${HTML_CONTENT}\",
\"docName\": \"test.html\",
\"layout\": \"Portrait\",
\"format\": \"A4\"
}" --output /tmp/from-html.pdf
Convert a webpage to PDF:
bash -c 'curl -s -X POST "https://api.pdf4me.com/api/v2/ConvertUrlToPdf" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"webUrl": "https://example.com"
}'"'"'' > /tmp/webpage.pdf
Combine multiple PDFs into one:
PDF1_BASE64=$(base64 < file1.pdf)
PDF2_BASE64=$(base64 < file2.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/Merge" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": [\"${PDF1_BASE64}\", \"${PDF2_BASE64}\"],
\"docName\": \"merged.pdf\"
}" | jq -r '.docContent' | base64 -d > merged.pdf
Split PDF by page ranges:
PDF_BASE64=$(base64 < input.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/Split" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"input.pdf\",
\"splitAction\": \"splitAfterPage\",
\"splitAfterPage\": 2
}"
Reduce PDF file size:
PDF_BASE64=$(base64 < large.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/Compress" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"large.pdf\"
}" | jq -r '.docContent' | base64 -d > compressed.pdf
Convert PDF to editable Word document:
PDF_BASE64=$(base64 < input.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/PdfToWord" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"input.pdf\"
}" | jq -r '.docContent' | base64 -d > output.docx
Create thumbnails/images from PDF pages:
PDF_BASE64=$(base64 < input.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/CreateThumbnail" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"input.pdf\",
\"imageFormat\": \"png\",
\"width\": 800
}"
Add text watermark to PDF:
PDF_BASE64=$(base64 < input.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/TextStamp" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"input.pdf\",
\"stampText\": \"CONFIDENTIAL\",
\"pages\": \"all\",
\"alignX\": \"center\",
\"alignY\": \"middle\",
\"alpha\": 0.3
}" | jq -r '.docContent' | base64 -d > stamped.pdf
Make scanned PDFs searchable:
PDF_BASE64=$(base64 < scanned.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/PdfOcr" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"scanned.pdf\",
\"ocrLanguage\": \"eng\"
}" | jq -r '.docContent' | base64 -d > searchable.pdf
PDF_BASE64=$(base64 < input.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/ProtectDocument" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"input.pdf\",
\"password\": \"secret123\"
}" | jq -r '.docContent' | base64 -d > protected.pdf
Extract specific pages from PDF:
PDF_BASE64=$(base64 < input.pdf)
curl -s -X POST "https://api.pdf4me.com/api/v2/ExtractPages" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d "{
\"docContent\": \"${PDF_BASE64}\",
\"docName\": \"input.pdf\",
\"pageNrs\": [1, 3, 5]
}" | jq -r '.docContent' | base64 -d > extracted.pdf
| Category | Endpoint | Description |
|---|---|---|
| Convert | /api/v2/ConvertToPdf | Word/Excel/PPT/Image → PDF |
/api/v2/ConvertHtmlToPdf | HTML → PDF | |
/api/v2/UrlToPdf | URL → PDF | |
/api/v2/MarkdownToPdf | Markdown → PDF | |
/api/v2/PdfToWord | PDF → Word | |
/api/v2/PdfToExcel | PDF → Excel | |
/api/v2/PdfToPowerpoint | PDF → PowerPoint | |
| Merge/Split | /api/v2/Merge | Merge multiple PDFs |
/api/v2/Split | Split PDF | |
/api/v2/ExtractPages | Extract specific pages | |
| Optimize | /api/v2/Compress | Compress PDF |
/api/v2/Linearize | Optimize for web | |
| Edit | /api/v2/TextStamp | Add text watermark |
/api/v2/ImageStamp | Add image watermark | |
/api/v2/AddPageNumber | Add page numbers | |
/api/v2/Rotate | Rotate pages | |
| Extract | /api/v2/CreateThumbnail | PDF → Images |
/api/v2/ExtractResources | Extract images/fonts | |
/api/v2/ExtractTable | Extract tables | |
| OCR | /api/v2/PdfOcr | OCR scanned PDFs |
| Security | /api/v2/ProtectDocument | Password protect |
/api/v2/UnlockPdf | Remove password | |
| Forms | /api/v2/FillPdfForm | Fill form fields |
/api/v2/ExtractFormData | Extract form data | |
| Barcode | /api/v2/CreateBarcode | Generate barcode |
/api/v2/AddBarcodeToPdf | Add barcode to PDF | |
/api/v2/ReadBarcodeFromPdf | Read barcode from PDF |
All endpoints use POST with JSON body:
curl -X POST "https://api.pdf4me.com/api/v2/{endpoint}" --header "Authorization: ${PDF4ME_API_KEY}" --header "Content-Type: application/json" -d '{
"docContent": "base64-encoded-file",
"docName": "filename.ext",
...other parameters
}'
{
"docContent": "base64-encoded-result",
"docName": "output.pdf",
"pageCount": 5
}