# Web Scraper to Markdown: Page & PDF Content for LLMs (`tudorlane/page-to-markdown`) Actor

Turn any web page or PDF URL into clean markdown or plain text for AI agents and RAG: strips menus, ads and boilerplate, keeps headings, lists and tables. PDFs split by page. Respects robots.txt.

- **URL**: https://apify.com/tudorlane/page-to-markdown.md
- **Developed by:** [Tudor Lane](https://apify.com/tudorlane) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 page 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?

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

## Web Scraper to Markdown: Page & PDF Content for LLMs

**What it does:** Turn web pages and PDFs into clean, LLM-ready markdown or text with title, author and date; respects robots.txt.

**Who it's for:** RAG pipelines, research and browsing agents, summarisers and knowledge-base builders.

**Price:** Pay per event: **$0.005 per page** (a PDF is billed per page extracted, capped by `maxPdfPages`). Failed URLs are not charged. You only pay Apify for what you run; there is no monthly fee for this Actor.

Give it URLs, get back clean, LLM-ready **markdown** or **plain text**:

- **Web pages**: main content only (menus, cookie banners, ads and footers removed), headings, lists and tables kept, plus title, author, date, site name, language.
- **PDFs**: text extracted page by page (with page markers), PDF metadata, page count, and a warning when a PDF looks scanned (image only, no text layer).
- Follows redirects, detects PDFs by content, **respects robots.txt**, 40 MB file limit.

### Input

```json
{"urls": ["https://en.wikipedia.org/wiki/Markdown", "https://arxiv.org/pdf/1706.03762"], "format": "markdown", "maxPdfPages": 50}
```

### Output (one row per URL)

`url`, `final_url`, `type` (html/pdf), `title`, `content`, `words`, `chars`, `metadata`, `pages_total`, `pages_extracted`, `truncated`, `billed_pages`.

### Pricing

Pay per event **$0.005 per page**: one web page = 1 page; a PDF is billed per page extracted (capped by `maxPdfPages`). Failed URLs are not charged.

### Notes

Only fetches public pages; it does not log in, bypass paywalls or captchas. You are responsible for having the right to use the content you convert. Built with trafilatura (Apache 2.0) and pypdf (BSD).

### Quick example

**Input**

```json
{
 "urls": [
  "https://en.wikipedia.org/wiki/Markdown"
 ],
 "format": "markdown",
 "maxPdfPages": 50,
 "includeLinks": false,
 "maxChars": 200000
}
```

**Output** (one dataset item, shortened)

```json
{
 "url": "https://en.wikipedia.org/wiki/Markdown",
 "final_url": "https://en.wikipedia.org/wiki/Markdown",
 "format": "markdown",
 "type": "html",
 "title": "Markdown - Wikipedia",
 "content": "# Markdown\n\n\n| Markdown |  | \n|---|---|\n| Filename extensions | `.md`, `.markdown`<sup>\\[1\\]</sup><sup>\\[2\\]</sup> | \n| Internet media type | `text/markdown`<su...",
 "metadata": {
  "title": "Markdown - Wikipedia",
  "author": "Authority control databases International FAST National United States Israel",
  "date": "2005-08-09",
  "sitename": "Wikimedia Foundation, Inc."
 },
 "chars": 21325,
 "words": 3001,
 "truncated": false,
 "billed_pages": 1,
 "error": null
}
```

### Use it from AI agents (MCP) and code

- **Apify MCP server:** add `https://mcp.apify.com/?tools=tudorlane/page-to-markdown` to Claude, Cursor, ChatGPT connectors, VS Code or any MCP client (sign in with Apify OAuth or an API token). The Actor appears as a tool the model can call.
- **REST (sync):** `POST https://api.apify.com/v2/acts/tudorlane~page-to-markdown/run-sync-get-dataset-items?token=YOUR_TOKEN` with the input JSON as the body; results come back in the response.
- **SDKs / no-code:** `apify-client` (Python/JS), LangChain, LlamaIndex, CrewAI, n8n, Make and Zapier integrations.

### FAQ

**JavaScript-heavy sites?** It fetches server HTML; pages that render only in the browser may return little text.

**Paywalls/logins?** Not bypassed, by design.

**Scanned PDFs?** Flagged with a warning (no OCR).

**What if the source is down?** You get an `error` row and are not charged for it.

**Support?** Open an issue on the Actor's Issues tab.

***

Keywords: web page to markdown API, HTML to markdown, PDF to text API, LLM-ready text, RAG ingestion, web content extraction, MCP tool, Apify Actor, AI agent tool.

**Search terms:** web scraper, markdown converter, HTML to markdown, website content for LLM, RAG ingestion, PDF to markdown (single URLs; not a full-site crawler)

# Actor input Schema

## `urls` (type: `array`):

Max 500 web page or PDF links.

## `format` (type: `string`):

markdown keeps headings, lists, tables; text is plain.

## `maxPdfPages` (type: `integer`):

Pages extracted (and billed) per PDF.

## `includeLinks` (type: `boolean`):

Keep hyperlinks in markdown output.

## `maxChars` (type: `integer`):

Longer content is truncated.

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Markdown"
  ],
  "format": "markdown",
  "maxPdfPages": 50,
  "includeLinks": false,
  "maxChars": 200000
}
```

# Actor output Schema

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

One item per request.

## `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 = {
    "urls": [
        "https://en.wikipedia.org/wiki/Markdown"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tudorlane/page-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 = { "urls": ["https://en.wikipedia.org/wiki/Markdown"] }

# Run the Actor and wait for it to finish
run = client.actor("tudorlane/page-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 '{
  "urls": [
    "https://en.wikipedia.org/wiki/Markdown"
  ]
}' |
apify call tudorlane/page-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tudorlane/page-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/PixYcdYMr9Dap7roe/builds/ulKFikITBGfUVuCE9/openapi.json
