pdf4me

$npx mdskill add vm0-ai/vm0-skills/pdf4me

Convert documents and web content to PDF format instantly.

  • Transforms Word, Excel, images, HTML, and URLs into PDF files.
  • Depends on the PDF4me API for document conversion operations.
  • Executes conversion based on user intent keywords like 'PDF' or 'convert'.
  • Returns the generated PDF file as output to the user.

SKILL.md

.github/skills/pdf4meView on GitHub ↗
---
name: pdf4me
description: PDF4me API for PDF operations. Use when user mentions "PDF4me", "convert
  PDF", "PDF tools", or document conversion.
---

## Troubleshooting

If requests fail, run `zero doctor check-connector --env-name PDF4ME_TOKEN` or `zero doctor check-connector --url https://api.pdf4me.com/api/v2/ConvertToPdf --method POST`

## How to Use

### 1. Convert to PDF

Convert Word, Excel, PowerPoint, images to PDF:

```bash
# Convert a text file to PDF
echo "Hello, PDF4ME!" > /tmp/test.txt
BASE64_CONTENT=$(base64 < /tmp/test.txt)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${BASE64_CONTENT}",
  "docName": "test.txt"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/ConvertToPdf" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > /tmp/output.pdf
```

### 2. HTML to PDF

Convert HTML content to PDF:

```bash
HTML_CONTENT=$(echo '<html><body><h1>Hello World</h1><p>This is a test.</p></body></html>' | base64)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${HTML_CONTENT}",
  "docName": "test.html",
  "layout": "Portrait",
  "format": "A4"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/ConvertHtmlToPdf" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json --output /tmp/from-html.pdf
```

### 3. URL to PDF

Convert a webpage to PDF:

Write to `/tmp/pdf4me_request.json`:

```json
{
  "webUrl": "https://example.com"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/ConvertUrlToPdf" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json > /tmp/webpage.pdf
```

### 4. Merge PDFs

Combine multiple PDFs into one:

```bash
PDF1_BASE64=$(base64 < file1.pdf)
PDF2_BASE64=$(base64 < file2.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": ["${PDF1_BASE64}", "${PDF2_BASE64}"],
  "docName": "merged.pdf"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/Merge" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > merged.pdf
```

### 5. Split PDF

Split PDF by page ranges:

```bash
PDF_BASE64=$(base64 < input.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "input.pdf",
  "splitAction": "splitAfterPage",
  "splitAfterPage": 2
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/Split" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json
```

### 6. Compress PDF

Reduce PDF file size:

```bash
PDF_BASE64=$(base64 < large.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "large.pdf"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/Compress" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > compressed.pdf
```

### 7. PDF to Word

Convert PDF to editable Word document:

```bash
PDF_BASE64=$(base64 < input.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "input.pdf"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/PdfToWord" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > output.docx
```

### 8. PDF to Images

Create thumbnails/images from PDF pages:

```bash
PDF_BASE64=$(base64 < input.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "input.pdf",
  "imageFormat": "png",
  "width": 800
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/CreateThumbnail" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json
```

### 9. Add Text Stamp/Watermark

Add text watermark to PDF:

```bash
PDF_BASE64=$(base64 < input.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "input.pdf",
  "stampText": "CONFIDENTIAL",
  "pages": "all",
  "alignX": "center",
  "alignY": "middle",
  "alpha": 0.3
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/TextStamp" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > stamped.pdf
```

### 10. OCR - Extract Text from Scanned PDF

Make scanned PDFs searchable:

```bash
PDF_BASE64=$(base64 < scanned.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "scanned.pdf",
  "ocrLanguage": "eng"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/PdfOcr" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > searchable.pdf
```

### 11. Protect PDF with Password

```bash
PDF_BASE64=$(base64 < input.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "input.pdf",
  "password": "secret123"
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/ProtectDocument" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > protected.pdf
```

### 12. Extract Pages

Extract specific pages from PDF:

```bash
PDF_BASE64=$(base64 < input.pdf)
```

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "${PDF_BASE64}",
  "docName": "input.pdf",
  "pageNrs": [1, 3, 5]
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/ExtractPages" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json | jq -r '.docContent' | base64 -d > extracted.pdf
```

## API Endpoints

| 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 |

## Request Format

All endpoints use POST with JSON body:

Write to `/tmp/pdf4me_request.json`:

```json
{
  "docContent": "base64-encoded-file",
  "docName": "filename.ext",
  "...other parameters": "..."
}
```

Then run:

```bash
curl -s -X POST "https://api.pdf4me.com/api/v2/{endpoint}" --header "Authorization: $PDF4ME_TOKEN" --header "Content-Type: application/json" -d @/tmp/pdf4me_request.json
```

## Response Format

```json
{
  "docContent": "base64-encoded-result",
  "docName": "output.pdf",
  "pageCount": 5
}
```

## Guidelines

1. **File Size**: Max 20MB per file (varies by plan)
2. **Base64**: All file content must be base64 encoded
3. **Formats**: Supports PDF, Word, Excel, PowerPoint, HTML, images
4. **OCR Languages**: eng, deu, fra, spa, ita, por, etc.
5. **Rate Limits**: Check your plan at https://dev.pdf4me.com/pricing/
6. **Free Tier**: 50 API calls/month
7. **Postman**: Import from https://dev.pdf4me.com/apiv2/documentation/postman/

## Resources

- **API Docs**: https://dev.pdf4me.com/apiv2/documentation/
- **Code Samples**: https://github.com/pdf4me/pdf4me-api-samples
- **Postman Collection**: https://dev.pdf4me.com/apiv2/documentation/postman/
- **Dashboard**: https://dev.pdf4me.com/dashboard/

More from vm0-ai/vm0-skills

SkillDescription
account-reconciliationPerform account reconciliations comparing general ledger balances against subledgers, bank statements, or external records. Use for bank reconciliation, GL-to-subledger reconciliation, intercompany reconciliation, balance sheet reconciliation, reconciling item analysis, outstanding item aging, or clearing open items.
agentphoneBuild AI phone agents with AgentPhone API. Use when the user wants to make phone calls, send/receive SMS, manage phone numbers, create voice agents, set up webhooks, or check usage — anything related to telephony, phone numbers, or voice AI.
ahrefsAhrefs SEO API for backlink and keyword analysis. Use when user mentions
amplitudeAmplitude product analytics API. Use when user mentions "Amplitude",
analysis-qaQuality-check a data analysis before sharing — verify joins, aggregations, denominators, time ranges, and metric definitions. Detect pitfalls like survivorship bias, average-of-averages, join explosion, timezone mismatches, incomplete periods, and selection bias. Includes documentation templates for reproducible analyses.
anthropic-managed-agentsAnthropic Managed Agents API for programmatically creating, running, and streaming AI agents on Anthropic's cloud infrastructure. Use when the user mentions "Managed Agents", "Anthropic agent sessions", or needs to create/run/stream an Anthropic agent with tool use (bash, git, web), attach GitHub repositories, or inject secrets via Vault. Do NOT use for standard Claude Messages API — use the Claude API skill instead.
apifyApify web scraping platform. Use when user mentions "scrape website",
asanaAsana API for tasks and projects. Use when user mentions "Asana", "asana.com",
atlassianAtlassian API for Confluence and Jira. Use when user mentions "Confluence
attioAttio REST API for AI-native CRM operations — manage companies, people, deals, and custom objects, plus notes, tasks, lists, and comments. Use when the user mentions "Attio", "CRM record", "create company", "add person", "list entry", "CRM note", or "CRM task".