# Universal Document Format Transformer (`actorify/universal-document-format-transformer`) Actor

Universal Document Format Transformer: a cloud-based Apify Actor that converts documents (PDF, DOCX, PPTX, HTML, TXT) into Markdown, JSON, CSV, HTML or TXT using Pandoc. Easy REST API for automations (n8n, Zapier, Make), production-ready error handling, and security controls.

- **URL**: https://apify.com/actorify/universal-document-format-transformer.md
- **Developed by:** [fanio zilla](https://apify.com/actorify) (community)
- **Categories:** Automation, Developer tools, Agents
- **Stats:** 4 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Universal Document Format Transformer

> **Convert documents between formats instantly without installing any software.** Just provide a URL and get your converted file in seconds.

### 🚀 Get Started in 30 Seconds

1. **Go to the Actor**: [Universal Document Format Transformer](https://apify.com/actors/WgRQY2Ta2VKQE5NgO)
2. **Click "Run Actor"**
3. **Enter your file details**:
   ```json
   {
     "fileUrl": "https://example.com/your-document.docx",
     "fromFormat": "docx",
     "toFormat": "markdown"
   }
   ```
4. **Get your converted file** - Download link appears in results

That's it! No software to install, no API keys needed for basic use.

### ✨ What You Can Do

- 🔄 **Convert DOCX to Markdown** - Perfect for GitHub documentation
- 📊 **Extract tables from HTML to CSV** - Great for data analysis
- 📄 **Transform PPTX to PDF** - Ideal for sharing presentations
- 📝 **Convert TXT to HTML** - Useful for web publishing
- 📋 **Process multiple formats** - DOCX, PPTX, HTML, TXT → Markdown, JSON, CSV, HTML, TXT, PDF

### 📋 Supported Formats

#### What You Can Convert From (Input)

| Format | Best For | Example Files |
|--------|----------|---------------|
| **DOCX** | Reports, articles, documentation | `*.docx` |
| **PPTX** | Presentations, slides, training | `*.pptx` |
| **HTML** | Web pages, online articles | `*.html`, `*.htm` |
| **TXT** | Plain text, simple data | `*.txt` |

#### What You Can Convert To (Output)

| Format | Perfect For | When to Use |
|--------|--------------|-------------|
| **Markdown** | GitHub docs, technical writing | Converting Word docs for code repositories |
| **JSON** | Data processing, APIs | Extracting structured content |
| **CSV** | Spreadsheets, data analysis | Pulling tables from web pages |
| **HTML** | Web publishing, email | Converting docs for websites |
| **TXT** | Simple text, logging | Extracting plain text from any format |
| **PDF** | Sharing, printing | Final document distribution |

#### ⚠️ Important: PDF Limitations

- ❌ **Cannot convert FROM PDF** - This is a technical limitation
- ✅ **Can convert TO PDF** - Perfect for final output
- 💡 **Workaround**: Convert PDF to HTML online first, then use this actor

### 💡 Popular Use Cases

#### 📝 Content Teams & Bloggers

**Convert Word documents to Markdown for GitHub**

```json
{
  "fileUrl": "https://example.com/blog-post.docx",
  "fromFormat": "docx",
  "toFormat": "markdown"
}
```

*Perfect for:*

- Technical documentation
- GitHub README files
- Markdown-based blogs
- Documentation sites

#### 📊 Data Analysts & Researchers

**Extract tables from web pages to CSV**

```json
{
  "fileUrl": "https://example.com/financial-report.html",
  "fromFormat": "html",
  "toFormat": "csv"
}
```

*Perfect for:*

- Financial data extraction
- Research data processing
- Spreadsheet analysis
- Data import to Excel

#### 🎯 Product Managers & Business Users

**Convert presentations to PDF for sharing**

```json
{
  "fileUrl": "https://example.com/presentation.pptx",
  "fromFormat": "pptx",
  "toFormat": "pdf"
}
```

*Perfect for:*

- Client presentations
- Training materials
- Meeting handouts
- Document distribution

#### 🤖 Automation Builders

**Process text files to structured data**

```json
{
  "fileUrl": "https://example.com/data.txt",
  "fromFormat": "txt",
  "toFormat": "json"
}
```

*Perfect for:*

- n8n workflows
- Zapier automations
- Make.com integrations
- API data processing

### 📝 How to Use

#### Step 1: Prepare Your File URL

Your file must be:

- ✅ **Publicly accessible** (no login required)
- ✅ **Direct link to file** (not a web page)
- ✅ **Under 50MB** in size
- ✅ **HTTP or HTTPS** protocol

**Good URLs:**

```
https://example.com/report.docx
https://cdn.example.com/files/presentation.pptx
https://storage.googleapis.com/bucket/document.html
```

**Bad URLs:**

```
https://drive.google.com/file/d/123/view (requires login)
https://example.com/page.html (web page, not file)
ftp://example.com/file.docx (wrong protocol)
```

#### Step 2: Choose Your Formats

**Check format compatibility:**

| From \ To | Markdown | JSON | CSV | HTML | TXT | PDF |
|------------|:--------:|:-----:|:----:|:----:|:---:|:---:|
| **DOCX** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| **PPTX** | ✅ | ✅ | ⚠️ | ✅ | ✅ | ✅ |
| **HTML** | ✅ | ⚠️ | ⚠️ | ✅ | ✅ | ✅ |
| **TXT** | ✅ | ⚠️ | ⚠️ | ✅ | ✅ | ✅ |

**Legend:**

- ✅ **Excellent** - High quality conversion
- ⚠️ **Limited** - Works but may lose some formatting

#### Step 3: Run the Conversion

**Option A: Use Apify Web Interface (Easiest)**

1. Go to [Actor Page](https://apify.com/actors/WgRQY2Ta2VKQE5NgO)
2. Click "Run Actor"
3. Enter your JSON input
4. Click "Run"
5. Download your converted file

**Option B: Use API (For Automation)**

```bash
curl -X POST "https://api.apify.com/v2/acts/WgRQY2Ta2VKQE5NgO/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fileUrl": "https://example.com/document.docx",
    "fromFormat": "docx",
    "toFormat": "markdown"
  }'
```

### 📤 What You Get Back

After conversion, you'll receive:

```json
{
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/...",
  "inputFormat": "docx",
  "outputFormat": "markdown",
  "fileSize": 12345,
  "processingTime": 2.5,
  "status": "success"
}
```

**What each field means:**

- **downloadUrl**: Link to download your converted file (works for 7 days)
- **inputFormat**: The format we detected from your file
- **outputFormat**: The format you requested
- **fileSize**: Size of your converted file in bytes
- **processingTime**: How long the conversion took
- **status**: "success" or "error"

### 🚨 Common Problems & Solutions

#### ❌ "Invalid URL format"

**Problem**: Your URL doesn't work
**Solution**:

- Check URL starts with `http://` or `https://`
- Test the URL in your browser first
- Make sure it's a direct file link, not a web page

#### ❌ "File not found"

**Problem**: The file doesn't exist or moved
**Solution**:

- Verify the URL is correct
- Check if the file was deleted or moved
- Try uploading the file again

#### ❌ "Access denied"

**Problem**: File requires login or permission
**Solution**:

- Use a publicly accessible file
- Upload to public cloud storage (Google Drive, Dropbox, etc.)
- Make sure sharing permissions allow public access

#### ❌ "Unsupported input format"

**Problem**: You tried to convert from PDF
**Solution**:

- PDF cannot be used as input (technical limitation)
- Convert PDF to HTML first using online tools
- Then use this actor to convert HTML to your desired format

#### ⏰ "Conversion timed out"

**Problem**: File is too large or complex
**Solution**:

- Keep files under 50MB
- Try a simpler output format
- Split large documents into smaller parts

### 💡 Pro Tips

#### 🎯 For Best Results

1. **Test with small files first** - Make sure everything works
2. **Choose the right format combination** - Check the compatibility matrix
3. **Use direct file URLs** - Avoid web pages that require login
4. **Check file size** - Keep under 50MB for reliable processing

#### 🔗 Getting File URLs

**Google Drive**:

1. Right-click file → "Share"
2. Set to "Anyone with the link can view"
3. Copy link and change `.../view?usp=sharing` to `.../uc?export=download`

**Dropbox**:

1. Right-click file → "Share"
2. Create link with "Can edit" permissions
3. Copy the direct download link

**OneDrive**:

1. Right-click file → "Share"
2. Set to "Anyone with the link can view"
3. Copy the link and ensure it's a direct download URL

**S3/Cloud Storage**:

1. Set bucket/object to public read
2. Generate pre-signed URL if needed
3. Ensure URL points directly to the file

#### ⚡ Speed Tips

- **TXT files convert fastest** - Use when possible
- **DOCX to Markdown is very reliable** - Great for documentation
- **HTML to TXT preserves text well** - Good for content extraction
- **Simple conversions work best** - Avoid complex format chains

### 🔧 Advanced Configuration

#### For Power Users

If you're using this in automation, you can adjust these settings:

| Setting | Default | What it Does |
|---------|----------|---------------|
| **File Size Limit** | 50MB | Maximum input file size |
| **Timeout** | 60 seconds | Maximum conversion time |
| **Retry Attempts** | 3 | How many times to retry failed downloads |

#### API Usage

For high-volume usage, consider:

- **Batch processing** - Process multiple files sequentially
- **Error handling** - Check status before processing next file
- **Download timing** - Files are available for 7 days only

### 🆘 Need Help?

#### Quick Troubleshooting

1. **File not working?** - Try the URL in your browser first
2. **Conversion failed?** - Check if format combination is supported
3. **Taking too long?** - File might be too large or complex
4. **Wrong output?** - Verify your `fromFormat` matches the actual file type

#### Get Support

- **📖 Actor Page**: [View on Apify](https://apify.com/actors/WgRQY2Ta2VKQE5NgO)
- **🐛 Report Issues**: [GitHub Issues](https://github.com/your-repo/issues)
- **💬 Community**: [Apify Forum](https://forum.apify.com/)
- **📧 Direct Help**: Contact through Apify platform

### 🎉 Ready to Start?

**[▶️ Run the Actor Now](https://apify.com/actors/WgRQY2Ta2VKQE5NgO)**

*No registration required for basic use. Free tier includes processing credits.*

***

<div align="center">

**⭐ Rate this actor if it helped you!**

Made with ❤️ for easy document conversion

</div>

# Actor input Schema

## `fileUrl` (type: `string`):

Public URL to the document (S3, Google Drive, OneDrive, etc.)

## `fromFormat` (type: `string`):

Source document format (PDF cannot be used as input)

## `toFormat` (type: `string`):

Target document format

## Actor input object example

```json
{
  "fileUrl": "https://",
  "fromFormat": "docx",
  "toFormat": "markdown"
}
```

# Actor output Schema

## `downloadUrl` (type: `string`):

Direct URL to download the converted document from Key-Value Store

## `inputFormat` (type: `string`):

Source document format

## `outputFormat` (type: `string`):

Target document format

## `fileSize` (type: `string`):

Size of converted file in bytes

## `processingTime` (type: `string`):

Time taken for conversion in seconds

## `status` (type: `string`):

Conversion status - either 'success' or 'error'

## `error` (type: `string`):

Error details if status is 'error' (optional)

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "fileUrl": "https://"
};

// Run the Actor and wait for it to finish
const run = await client.actor("actorify/universal-document-format-transformer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "fileUrl": "https://" }

# Run the Actor and wait for it to finish
run = client.actor("actorify/universal-document-format-transformer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "fileUrl": "https://"
}' |
apify call actorify/universal-document-format-transformer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,actorify/universal-document-format-transformer"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WgRQY2Ta2VKQE5NgO/builds/BaWoQbXCXTCq2PURV/openapi.json
