Read a PDF page

POST/v1/ocr/document
RapidAPI ● LiveApyHub ● Live

Read one page of a PDF — scanned or digital — into the same Markdown, text, tables and blocks. The response says how many pages there are (page.count, X-Page-Count); request page: 2, 3, … to walk the document. Each page is a separate request. Use a URL or upload the PDF with each page request.

More examples and contract notes

More examples

Another page as Markdown

{
  "document": {
    "url": "https://arxiv.org/pdf/1706.03762v7"
  },
  "page": 3,
  "format": "markdown"
}

A scan at higher resolution

{
  "document": {
    "url": "https://arxiv.org/pdf/1706.03762v7"
  },
  "page": 1,
  "dpi": 300,
  "format": "text"
}

Body parameters

application/json
formatjson · markdown · text

`json`: Markdown, text, blocks and tables; `markdown`: the page as `text/markdown`; `text`: plain text.

default "json"
modeauto · layout · plain

auto (default) for varied documents; layout for structured blocks; plain for a single text block.

default "auto"
chartsboolean

Turn bar, line and pie charts into data tables.

default true
include_blocksboolean

Include `blocks` (type, order, bounding box, content) in the JSON.

default true
pageinteger

1-based page to read; the response carries `page.count` so you can loop.

default 1min 1max 1000
dpiinteger

Rendering resolution for the page (capped at 25 megapixels).

default 200min 72max 300
documentobjectREQUIRED
2 child fields
urlstring

Public http(s) PDF URL, up to 20 MiB. Private and internal addresses are refused.

default nullmax length 2048
base64string

The PDF as base64 (a `data:` URI is fine), ≤ 20 MB decoded.

default nullmax length 27962090
multipart/form-data
filebinaryREQUIRED

The PDF (≤ 20 MB, ≤ 1,000 pages)

formatjson · markdown · text

`json`: Markdown, text, blocks and tables; `markdown`: the page as `text/markdown`; `text`: plain text.

default "json"
modeauto · layout · plain

auto (default) for varied documents; layout for structured blocks; plain for a single text block.

default "auto"
chartsboolean

Turn bar, line and pie charts into data tables.

default true
include_blocksboolean

Include `blocks` (type, order, bounding box, content) in the JSON.

default true
pageinteger

1-based page to read; the response carries `page.count` so you can loop.

default 1min 1max 1000
dpiinteger

Rendering resolution for the page (capped at 25 megapixels).

default 200min 72max 300

Responses

The page: JSON (Markdown, text, blocks, tables), or `text/markdown` / `text/plain` per `format`

application/json
markdownstringREQUIRED
textstringREQUIRED
blocksobject[]REQUIRED
Item fields
typestringREQUIRED

title, heading, text, table, formula, chart, image, caption, footnote, header, footer, page_number, code, seal, other

orderintegerREQUIRED

Reading order, from 0

bboxinteger[]REQUIRED

[x1, y1, x2, y2] in page pixels

contentstringREQUIRED

Text (Markdown for tables, LaTeX for formulas)

htmlstring

Tables and charts: the table as HTML

default null
markdownstring

Tables and charts: the table as Markdown

default null
latexstring

Formulas: LaTeX

default null
tablesobject[]REQUIRED
Item fields
orderintegerREQUIRED
typestringREQUIRED

table, or chart when a chart was turned into data

bboxinteger[]REQUIRED
htmlstringREQUIRED
markdownstringREQUIRED
rowsstring[][]REQUIRED

Cell text by row; merged cells repeated across their span

pageobjectREQUIRED
5 child fields
widthintegerREQUIRED
heightintegerREQUIRED
indexinteger

Documents: the 1-based page that was read

default null
countinteger

Documents: total pages

default null
dpiinteger

Documents: rendering resolution used

default null
text/markdown

string

text/plain

string