> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PDFs and documents

> Scrape a PDF, Word, PowerPoint, Excel or CSV file from a public URL and get Markdown. Pick the pages, read scanned pages and keep page markers.

Scrape reads a document at a public URL as Markdown. For a file on your own disk, use [Parse documents](https://docs.stophy.dev/parse/overview). This request reads the first two pages of a paper and marks where each page starts:

```bash theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://arxiv.org/pdf/1706.03762",
    "parsers": [{ "type": "pdf", "maxPages": 2, "pageMarkers": true }]
  }'
```

```json theme={null}
{
  "success": true,
  "data": {
    "markdown": "…# Attention Is All You Need\n…\n\n---\n\n<!-- page 2 -->\n\n## 1 Introduction\n\n…",
    "metadata": {
      "contentType": "application/pdf",
      "totalPages": 15
    }
  }
}
```

Use `"pdf"` in `parsers` for the defaults, or send an object:

| Field | Default | Effect |
| - | - | - |
| `type` | none | `"pdf"`. Required in the object form. |
| `mode` | `auto` | `fast` reads the text layer only. `auto` reads the text layer and the picture of any page that has none. `ocr` reads the picture of every page. |
| `maxPages` | `500` | Read at most this many pages, 1 to 500. |
| `pages` | `false` | Also return each page as `{ pageNumber, markdown }` in `pages`. |
| `blocks` | `false` | Also return the layout in `blocks`: each title, section header or run of text, with its page, reading order, position (`bbox` as left, top, right, bottom, 0 to 1) and where its text sits in that page's Markdown (`span`). Tables, figures and formulas are not told apart. |
| `pageMarkers` | `false` | Join pages with `---` and a `<!-- page N -->` line, where `N` is the page that follows. |

`metadata` also has `totalPages` (pages in the file) and `ocrPages` (pages read from their picture). See [Page metadata](https://docs.stophy.dev/scrape/page-metadata.md).

## Other documents

Send the public URL without a PDF parser.

* A CSV file comes back as a Markdown table, and so does each sheet of an `.xlsx` file. The first row becomes the table header.
* A `.docx` or `.pptx` file comes back as Markdown text.
* The older `.doc`, `.xls` and `.ppt` formats cannot be read.

## Limits and errors

* The picture of at most 20 pages is read per call, in `auto` or `ocr` mode. Without an API key, only the text layer is read.
* A file larger than 20 MB, or too large once unpacked, returns `400 invalidRequest`. So do a password protected file, a file that cannot be opened, a URL that is an image or another download, and a PDF that takes too long to read, which suggests a smaller `maxPages`.
* Read a long document in parts with `maxChars` and `offset`. See [Content filtering](https://docs.stophy.dev/scrape/content-filtering.md).
* A PDF read with `maxChars`, `offset` or `query` is charged for the share of its pages that comes back. A file that cannot be read costs nothing. See [Pricing](https://docs.stophy.dev/account/pricing.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.