# PDF, DOCX & HTML to Markdown Converter API (`utilityfoundry/native-text-to-markdown`) Actor

Upload 1–25 native-text PDF, DOCX, or HTML files and get deterministic Markdown with explicit success or failure states. No OCR, no LLM, no external document-processing service. Built for RAG, LLM ingestion, documentation, and automation workflows.

- **URL**: https://apify.com/utilityfoundry/native-text-to-markdown.md
- **Developed by:** [Utility Foundry](https://apify.com/utilityfoundry) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.00 / 1,000 successful documents

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Native Text to Markdown — PDF, DOCX, HTML

Convert uploaded native-text PDF, DOCX, HTML, and HTM files into deterministic Markdown. Each input produces a machine-readable `SUCCEEDED`, `UNSUPPORTED`, or `REJECTED` dataset item.

### What it does

- Accepts 1–25 files through Apify's file-upload control.
- Converts native PDF text, DOCX document structure, and bounded HTML structure.
- Returns Markdown only for `SUCCEEDED` items.
- Returns source/output hashes, byte counts, PDF page counts where available, warnings, and explicit reason codes.
- Applies a 1 MiB limit per file, a 25-page PDF limit, and bounded DOCX ZIP-container checks.

### What it does not do

- OCR, scanned/image-only PDF conversion, or handwriting recognition
- AI or LLM interpretation
- Visual-layout or image reconstruction
- Password recovery
- Remote URL crawling or generic downloading
- Semantic PDF table reconstruction
- Guaranteed multi-column reading order
- PPTX, XLSX, EPUB, RST, or LaTeX conversion

Arbitrary external HTTP(S) URLs are rejected without being fetched. The Actor accepts only Apify-managed uploaded-file references created by the file-upload control.

### PDF limitations

Every successful PDF result conservatively includes:

- `PDF_LAYOUT_NOT_GUARANTEED`
- `READING_ORDER_NOT_GUARANTEED`
- `TABLE_STRUCTURE_NOT_GUARANTEED`

These warnings do not depend on the filename. PDF extraction does not promise visual fidelity, semantic tables, or correct multi-column reading order.

DOCX conversion preserves bounded paragraph, heading, list, and table structure. Images and floating objects are ignored; tracked changes and comments are not interpreted. HTML conversion uses uploaded bytes only, removes active elements, and does not preserve CSS or visual layout.

### Input

Use the `files` upload control in Apify Console. Upload 1–25 `.pdf`, `.docx`, `.html`, or `.htm` files. For API callers, the accepted value is the exact Apify key-value-store record URL produced by that control; external URLs are not accepted.

```json
{
  "files": [
    "https://api.apify.com/v2/key-value-stores/qIra1e1CfYZeQkgmA/records/store-health-sample.html"
  ]
}
```

This public Apify-managed sample contains only harmless synthetic text. It is also the Store health-test prefill. Uploading your own file replaces it in the form.

### Output

The default dataset contains one item per processed input. `markdown` exists only when `status` is `SUCCEEDED`.

```json
{
  "document_id": "document-001",
  "filename": "store-health-sample.html",
  "format": "html",
  "status": "SUCCEEDED",
  "reason": "BOUNDED_HTML_STRUCTURE_EXTRACTED",
  "warnings": [
    "ACTIVE_CONTENT_REMOVED",
    "VISUAL_LAYOUT_NOT_PRESERVED"
  ],
  "source_sha256": "7d685b906c61e0d0b125f9484c06b39c87dd2217279832275e2a5250068a1630",
  "input_bytes": 315,
  "pages": null,
  "output_bytes": 153,
  "output_sha256": "4bf4fc60e4c6ed76f846d50d8f3db62a0bc5481b5d9a980312095d7e13d5199f",
  "markdown": "# Native Text Store Health Sample\n\nThis synthetic harmless file verifies deterministic Markdown conversion.\n\n- No customer data\n\n- No external resources\n"
}
```

For references rejected before any bytes are read, `source_sha256` and `input_bytes` are `null`. Unsupported and rejected items never contain `markdown`.

### Privacy and retention

Files are processed within Apify-managed storage/runtime. The Actor does not send document contents to developer-controlled external services. Apify platform storage and retention policies apply.

Document text is never written to logs. Logs contain operational IDs, classifications, reason codes, byte counts, and hashes. Temporary parser files are deleted when each document finishes processing.

### Pricing

- `$0.001` for `apify-actor-start`
- `$0.03` for each `SUCCEEDED` document
- no successful-document fee for `UNSUPPORTED` or `REJECTED` documents
- platform usage included

The start event is charged automatically by Apify. A successful-document event is coupled to the corresponding default-dataset write. The default dataset-item event is disabled, so the same successful result is not charged twice. The minimum allowed maximum charge per run is `$0.031`, covering one start and the first successful document. The Actor stops without writing another successful result when the remaining event budget is insufficient.

### Resource limits

The default run uses 256 MB memory and a 120-second timeout. One run accepts at most 25 files. These are experiment limits, not promises of general document compatibility.

# Actor input Schema

## `files` (type: `array`):

Upload PDF, DOCX, HTML, or HTM files directly. Each file is limited to 1 MiB; PDFs are limited to 25 pages. Only Apify-managed uploaded-file references are accepted.

## Actor input object example

```json
{
  "files": [
    "https://api.apify.com/v2/key-value-stores/qIra1e1CfYZeQkgmA/records/store-health-sample.html"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

One dataset item for each processed input file.

## `summary` (type: `string`):

Aggregate counts and charge-limit stop state.

# 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 = {
    "files": [
        "https://api.apify.com/v2/key-value-stores/qIra1e1CfYZeQkgmA/records/store-health-sample.html"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("utilityfoundry/native-text-to-markdown").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 = { "files": ["https://api.apify.com/v2/key-value-stores/qIra1e1CfYZeQkgmA/records/store-health-sample.html"] }

# Run the Actor and wait for it to finish
run = client.actor("utilityfoundry/native-text-to-markdown").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 '{
  "files": [
    "https://api.apify.com/v2/key-value-stores/qIra1e1CfYZeQkgmA/records/store-health-sample.html"
  ]
}' |
apify call utilityfoundry/native-text-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,utilityfoundry/native-text-to-markdown"
        }
    }
}
```

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/hqPXZ7O3qxzgehO5v/builds/OjaRj22Ddg9VSdK0B/openapi.json
