# Office-to-PDF & Universal Document Converter (`gp005/office-to-pdf`) Actor

Convert DOCX, XLSX, PPTX, DOC, XLS, PPT, ODT, ODS, ODP, RTF, CSV, TXT, and HTML to PDF via LibreOffice headless. Pure compute on files you supply — no scraping.

- **URL**: https://apify.com/gp005/office-to-pdf.md
- **Developed by:** [Geo](https://apify.com/gp005) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 document converteds

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

## Office-to-PDF & Universal Document Converter

Convert **DOCX, XLSX, PPTX, DOC, XLS, PPT, ODT, ODS, ODP, RTF, CSV, TXT, and HTML** to **PDF** in bulk — rendered exactly as Microsoft Office would render them. Point it at a list of document URLs (or supply base64 blobs); get back downloadable PDFs with a per-file conversion report. Pure compute on files you supply — **no scraping, no personal data collected**.

This **Office-to-PDF converter** is built for developers and teams who need a programmable **document conversion API** that handles Word, Excel, and PowerPoint files at scale without desktop software, manual uploads, or per-file clicks.

### Use cases

- **Document archival** — batch-convert a folder of Office files to PDF for long-term storage and universal readability.
- **Report pipelines** — generate PDFs from DOCX/XLSX templates in an automated workflow before emailing or archiving.
- **Contract & invoice processing** — normalize mixed-format business documents (DOC/DOCX/XLS/PPT) into a single, portable PDF stream.
- **Content publishing** — convert drafted Word/PPT content to PDF for distribution, print, or compliance.

### How to use it (quick start)

1. Feed the Actor a JSON array of document URLs via `documentUrls`.
2. Optionally set `outputFilenameStyle` (`source` to keep the original name, `index` for `output_0.pdf`).
3. Optionally set `conversionTimeoutSecs` (default 120s per file).
4. Run the Actor. Each successfully converted document produces a dataset row with an `outputUrl` — a direct download link to the generated PDF.
5. Pass the output URLs to a CDN, email pipeline, or document-management system.

### Input

`documentUrls` (required) — array of direct URLs to documents. `outputFilenameStyle` (source / index, default source). `conversionTimeoutSecs` (default 120).

```json
{
  "documentUrls": [
    "https://example.com/report.docx",
    "https://example.com/budget.xlsx"
  ]
}
```

#### Supported input formats

| Category | Extensions |
|---|---|
| Word | DOCX, DOC, RTF, ODT, WPD, WPS |
| Excel | XLSX, XLS, XLSM, ODS, CSV |
| PowerPoint | PPTX, PPT, PPS, PPSX, ODP |
| Other | TXT, HTML, HTM, XML, VSD, PUB |

### Output

One dataset item per document: `status`, `source`, `filename`, **`outputUrl`** (download the PDF from the run's key-value store), `pages`, `inputBytes`, `outputBytes`. Failed fetches or unsupported formats return a structured `error` item (never charged).

### Pricing (pay-per-event) & cost example

| Event | Price | When |
|---|---:|---|
| `actor-start` | $0.005 | once per run |
| `document-converted` (primary) | $0.02 | per document successfully converted to PDF |

**100 documents → ~$2.05.** Failed conversions are never charged. Measured platform compute for a typical batch is well under 30% of event revenue, keeping the unit margin positive.

### Integrate

Chain it after any Actor that outputs document URLs, or call it via the **REST API / MCP / Make / n8n**. Converted PDFs live in the run's key-value store (download via `outputUrl`). No browser required — LibreOffice converts headlessly in the container.

More FORGE actors for document and data work:

- **[SEC EDGAR Filings & XBRL Fundamentals](https://apify.com/gp005/edgar-xbrl-fundamentals)** — company filings and normalized financial fundamentals as JSON.
- **[Bulk Image Converter & Optimizer](https://apify.com/gp005/bulk-image-converter)** — convert, resize, and compress images to WebP/AVIF/JPEG.
- **[Security Headers Auditor](https://apify.com/gp005/security-headers-auditor)** — grade HTTP security headers for any URL.

### FAQ

**What file formats can I convert to PDF?** DOCX, DOC, XLSX, XLS, XLSM, PPTX, PPT, PPS, PPSX, ODT, ODS, ODP, RTF, CSV, TXT, HTML, and more — anything LibreOffice can open. If a format is not supported, the Actor returns a structured error item (never charged).

**Does the conversion preserve formatting?** Yes. LibreOffice renders documents faithfully — fonts, tables, charts, headers/footers, and embedded objects are preserved in the PDF output. For best results, use standard fonts or embed them in the source document.

**Can I convert password-protected files?** No. Password-protected Office files cannot be converted headlessly. The Actor will return an error item for those files.

**Is there a file size limit?** Yes — 100 MB per input file. Larger files are rejected with a structured error item (never charged).

**How do I download the converted PDFs?** Each dataset row includes an `outputUrl` field — a direct download link to the PDF in the run's key-value store. You can chain to another Actor for upload to S3, a CDN, or a document-management system.

**Do I need to upload files?** No — the Actor fetches documents by URL. Point it at any publicly accessible document URL.

**Can I convert Office files to other formats (not PDF)?** This Actor outputs PDF only. For Markdown or text extraction from PDFs, see the OCR & Document Extractor actors on the Store.

### Limitations

- Fetches documents by **URL** (one polite request each); it does not crawl pages to discover documents.
- Output PDFs are stored in the run's key-value store (retention per your Apify plan).
- Conversion fidelity depends on LibreOffice's rendering — rare edge cases (macros, very complex SmartArt) may render slightly differently than in Microsoft Office.
- Password-protected files are not supported.
- Built on **LibreOffice** (MPL-2.0) — permissive, SaaS-safe, no network-use clause.

### Disclaimer

This Actor uses LibreOffice, an open-source office suite licensed under MPL-2.0. It does not use or bundle Microsoft Office. Document rendering follows LibreOffice's engine, which may differ from Microsoft Office in edge cases.

# Actor input Schema

## `documentUrls` (type: `array`):

Direct URLs of the documents to convert to PDF. Each is fetched once and converted via LibreOffice. Supported: DOCX, DOC, XLSX, XLS, PPTX, PPT, ODT, ODS, ODP, RTF, CSV, TXT, HTML.

## `outputFilenameStyle` (type: `string`):

How to name output PDFs in the key-value store. 'source' keeps the original filename with .pdf extension; 'index' uses output\_0.pdf, output\_1.pdf, etc.

## `conversionTimeoutSecs` (type: `integer`):

Maximum seconds to spend converting a single document before timing out. Default 120s.

## Actor input object example

```json
{
  "documentUrls": [
    "https://example.com/report.docx",
    "https://example.com/budget.xlsx"
  ],
  "outputFilenameStyle": "source",
  "conversionTimeoutSecs": 120
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# 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 = {
    "documentUrls": [
        "https://calibre-ebook.com/downloads/demos/demo.docx"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gp005/office-to-pdf").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 = { "documentUrls": ["https://calibre-ebook.com/downloads/demos/demo.docx"] }

# Run the Actor and wait for it to finish
run = client.actor("gp005/office-to-pdf").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 '{
  "documentUrls": [
    "https://calibre-ebook.com/downloads/demos/demo.docx"
  ]
}' |
apify call gp005/office-to-pdf --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gp005/office-to-pdf"
        }
    }
}

```

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/SJDCmDSs7bheFn42A/builds/alsQY1jextcmX7RNB/openapi.json
