Use code for 1,000 extra pages on your first month of Starter.+1,000 pages on Starter
See Starter →See →pytesseract, EasyOCR and docTR on the same 40 public PDF pages: working code, character error rate, CPU time, and what each returns beyond text.
If you need headings, tables and sections from a PDF, HyperAPI by Hyperbots returns them from one parse call at $1 per 1,000 pages. For plain text on your own CPU, pytesseract had the lowest median character error rate of the three libraries on single-, two- and three-column pages in our test of 40 public PDF pages, at 2.6 CPU-seconds a page.
Last updated: 18 November 2026.
Published by HyperAPI. We rank ourselves first on the criteria below; check them against your own documents. The criteria are four rows of the short-answer table: inputs accepted, and fields returned (typed blocks and sections, heading levels, table HTML with positions).
On boxes we do not lead: Tesseract and docTR also return word and line boxes, plus block boxes. On where it runs and cost, the three libraries win. HyperAPI is compared on fields returned, inputs and price; we give no accuracy or speed figure for it. Every accuracy and speed figure is for Tesseract, EasyOCR and docTR, measured by us.
| HyperAPI fast parse (hosted) | Tesseract (pytesseract) | EasyOCR | docTR | |
|---|---|---|---|---|
| What you send | The file: PDF, PNG, JPEG, WebP, TIFF, HEIC, Word, Excel, PowerPoint, CSV, TXT, RTF (50 MB) | A page image | A page image | A PDF or page images |
| Boxes | Word and line boxes | Word, line, paragraph and block boxes, in pixels | One per text segment (3.3 words on average) | Word, line and block boxes, as fractions of the page |
| Grouping | Typed blocks (title, heading, text, list, table, caption, footnote and more) collected into sections | Block, paragraph and line number on each word | None by default; paragraph=True merges segments into paragraphs (no confidence) | Blocks contain lines, lines contain words; optional typed regions (title, section header, text, caption, table, footnote, page header and footer, picture), off by default and not grouped into sections |
| Headings with a level | Yes | No | No | Optional section headers, no level |
| Tables | Table blocks with positions, plus HTML by default (best-effort; a table it can't parse is marked). Tables that continue across pages are linked | No | No | Optional rows and columns, off by default |
| Where it runs | Hosted API | Your machine | Your machine | Your machine |
| Cost | $1 per 1,000 pages; 30 free pages a month | Free; 2.6 CPU-seconds a page | Free; 34.0 CPU-seconds a page | Free; 37.9 CPU-seconds a page |
Each option has a niche:
pytesseract is a thin Python wrapper around the Tesseract command-line program, so you install both. On macOS run brew install tesseract; on Ubuntu run sudo apt install tesseract-ocr. Then:
pip install pytesseract pypdfium2 pillowTesseract reads images, not PDFs, so render each PDF page first. Tesseract's own documentation advises at least 300 DPI. We used page 9 of NIST SP 800-63-3, a public US government document:
import pypdfium2 as pdfium
import pytesseract
pdf = pdfium.PdfDocument("NIST.SP.800-63-3.pdf")
image = pdf[8].render(scale=300 / 72).to_pil() # page 9 at 300 DPI
text = pytesseract.image_to_string(image, lang="eng")
print(text)The first lines it printed:
NIST SP 800-63-3 DIGITAL IDENTITY GUIDELINES
These guidelines are organized as follows:
SP 800-63 Digital Identity Guidelines (This document)
SP 800-63 provides an overview of general identity frameworks, using authenticators,That took 2.0 CPU-seconds. Plain text is often not enough: to highlight a word, crop a field or keep columns apart you need positions. image_to_data returns a box for every block, paragraph, line and word; each word row also has a confidence from 0 to 100 and the block, paragraph and line it belongs to:
data = pytesseract.image_to_data(image, output_type=pytesseract.Output.DICT)
for i, word in enumerate(data["text"]):
if data["level"][i] == 5 and word.strip(): # level 5 = one word
box = (data["left"][i], data["top"][i], data["width"][i], data["height"][i])
print(word, data["conf"][i], box,
data["block_num"][i], data["par_num"][i], data["line_num"][i])NIST 96 (303, 208, 92, 31) 1 1 1
SP 89 (407, 208, 52, 31) 1 1 1
800-63-3 89 (472, 209, 163, 31) 1 1 1
DIGITAL 96 (1736, 209, 131, 31) 1 1 1
IDENTITY 96 (1881, 209, 149, 30) 1 1 1
GUIDELINES 95 (2042, 208, 205, 32) 1 1 1
These 96 (301, 358, 117, 35) 2 1 1
guidelines 95 (433, 358, 203, 46) 2 1 1The page holds 437 words in 37 lines. Scored against the PDF's own text, Tesseract's character error rate (CER) on it was 0.24%. Three settings matter most:
--psm). Pass config="--psm 6" to treat the page as one block of text. It helped on one dense table and hurt on another (see below), so test it on your own pages.image_to_pdf_or_hocr(image, extension="hocr") and image_to_alto_xml write the same word, line and block hierarchy as hOCR or ALTO XML.| Library | Tesseract | EasyOCR | docTR |
|---|---|---|---|
| Median CER, single column | 0.19% | 2.86% | 0.31% |
| Median CER, two columns | 8.32% | 72.65% | 13.49% |
| Median CER, three columns | 2.41% | 74.06% | 65.71% |
| Median CER, report pages | 12.01% | 5.70% | 4.84% |
| Word recall | 96.5% | 91.7% | 95.7% |
| Table values found | 679 of 1,446 | 870 of 1,446 | 1,444 of 1,446 |
| CPU-s per page | 2.6 | 34.0 | 37.9 |
| Wall-s per page | 2.6 | 26.3 | 11.3 |
On single-column text all three read almost every character. The big CER gaps on multi-column pages are mostly reading order, not misread words: on the three-column pages docTR's median CER was 65.71% while 94% of the words were present. Tesseract kept the columns apart; EasyOCR read straight across them, line by line; docTR jumped between them.
Tesseract trailed on the 10 mixed Economic Report pages (text, charts and contents pages): its median CER there was 12.01%, against 5.70% for EasyOCR and 4.84% for docTR.
In CPU terms, 1,000 pages cost about 0.7 CPU-hours with Tesseract, 9.4 with EasyOCR and 10.5 with docTR on this laptop. EasyOCR and docTR can use a GPU, which we did not test.
Two Economic Report pages are statistical tables with a dozen or more columns of figures. Their text layer draws each decimal point with a glyph that has no Unicode mapping, so copying “0.4” gives “0�4”. We repaired that in the reference and counted how many of the 1,446 decimal values each library returned:
IROWBWOD— MNONNATANAIQNAMM) and 679 of 768. With --psm 6 the first page rose to 360 of 678 but the second fell to 645 of 768.These counts check values, not which cell each one landed in. None of the three returned rows and columns by default.
import easyocr
reader = easyocr.Reader(["en"], gpu=False)
for quad, text, confidence in reader.readtext("page.png"):
print(text, round(confidence, 3), quad) # quad: four [x, y] corner pointsEasyOCR returns a flat list of segments, each a run of words with four corner points and one confidence from 0 to 1. Our pages averaged 189 segments of 3.3 words, with no word boxes and no lines or blocks. readtext(..., paragraph=True) merges segments into paragraphs but drops the confidence.
It also confused punctuation more often than the other two: commas became semicolons, “§” became “$”, and URL slashes became “I” or “l”. It gave the lowest scores on multi-column pages; its case rests on language coverage.
from doctr.io import DocumentFile
from doctr.models import ocr_predictor
model = ocr_predictor(pretrained=True) # detect_layout=True, detect_tables=True are opt-in
result = model(DocumentFile.from_images(["page.png"]))
page = result.export()["pages"][0]
for block in page["blocks"]:
for line in block["lines"]:
for word in line["words"]:
print(word["value"], round(word["confidence"], 3), word["geometry"])docTR can also read a PDF directly with DocumentFile.from_pdf("doc.pdf"). Its export() is a nested dictionary: pages hold blocks, blocks hold lines, lines hold words, and every block, line and word has a box as fractions of the page. Each word also has its text and a confidence from 0 to 1. Our pages averaged 630 words in 108 lines and 37 blocks.
docTR 1.1 adds two opt-in switches. detect_layout marks regions such as titles, section headers, captions and tables, and detect_tables turns tables into rows and columns of cells. On 8 test pages they found 4 tables and 11 section headers and gave the first dense table a 32-row, 13-column grid. But 46 of 366 cells on the second table held two values merged, section headers carry no level, and the switches added about 10% CPU time (46.1 against 41.8 CPU-seconds a page).
HyperAPI is a document API with five operations on one key: parse, extract, classify, split and redact. Its fast parse costs $0.001 a page and returns, for every page:
type is title, heading, text, list, table, caption, footnote, header, footer, page_number and others), with a heading level on each heading;Fast parse does not return markdown. Advanced parse adds markdown and structured HTML at $0.05 a page on the Plus plan or higher. Install the Python SDK from GitHub (it is not on PyPI) and parse a page; see the quickstart for keys:
# pip install "hyperapi-sdk @ git+https://github.com/hyprbots/hyperapi-sdk.git"
import re
from hyperapi import HyperAPIClient
client = HyperAPIClient() # reads HYPERAPI_KEY from the environment
result = client.parse("report-page.pdf", mode="fast")
for block in result["result"]["blocks"][:6]:
text = re.sub(r"\s+", " ", re.sub(r"<[^>]+>", " ", block["html"])).strip()
print(f'{block["type"]:8} {str(block.get("heading")):5} {block["group"]:3} {text[:44]}')
client.close()On page 35 of NARA's 2024 records management report (public domain), the first six blocks came back as:
title 1 g0 CONCLUSION AND RECOMMENDATIONS
heading 2 g1 CONCLUSION
text None g1 NARA requires agencies to complete the annua
text None g1 Records management is a continuous process.
heading 2 g2 RECOMMENDATIONS
text None g2 NARA continues to conduct oversight of federThe same page returned 257 word boxes, 29 line boxes, 10 blocks and 6 groups. Each heading carries its level and each paragraph its section, which is the layer pytesseract leaves to you. From any other language, the REST flow is upload, then call with the returned document_key:
# Save as parse.sh and run: bash parse.sh (needs curl 7.76+ and jq)
API=https://apis.hyperbots.com
FILE='report-page.pdf'
CT='application/pdf'
# 1. Get an upload URL (content_length = file size in bytes)
SIZE=$(wc -c < "$FILE" | tr -d ' ')
UPLOAD=$(curl -sS --fail-with-body \
-X POST "$API/v1/documents/upload" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg f "$FILE" --arg ct "$CT" \
--argjson n "$SIZE" \
'{filename: $f, content_type: $ct, content_length: $n}')")
DOC_KEY=$(echo "$UPLOAD" | jq -er .document_key)
UPLOAD_URL=$(echo "$UPLOAD" | jq -er .upload_url)
# 2. PUT the file there (no API key on this request)
curl -sS --fail-with-body -X PUT "$UPLOAD_URL" \
-H "Content-Type: $CT" \
-H "x-amz-server-side-encryption: AES256" \
--data-binary @"$FILE"
# 3. Parse it (fast mode) and list each block's type and heading level
curl -sS -X POST "$API/v1/parse?mode=fast" \
-H "X-API-Key: YOUR_API_KEY" \
-F "document_key=$DOC_KEY" \
| jq -r '.result.blocks[] | [.type, .heading, .group] | @tsv'The free tier is 30 pages a month at one request per minute, with no card. Each request's input and result are kept for 30 days, retrievable by request_id, then deleted, and are not used for training.
A repeat of the same document within 24 hours returns the stored result at no charge. HyperAPI is SOC 2 Type II.
detect_tables if you want a grid, and a check of merged cells.If your files are scans rather than born-digital PDFs, read how to extract text from a scanned PDF. For hosted and desktop options side by side, see the best PDF OCR software for developers.
On our 40 English pages, pytesseract had the lowest median character error rate on single-, two- and three-column text (0.19%, 8.32% and 2.41%) and the lowest CPU time (2.6 seconds a page). docTR was best on the mixed report pages (4.84% against Tesseract's 12.01%) and on dense numeric tables, finding 1,444 of 1,446 values. If you need headings, tables and sections, HyperAPI returns them from one parse call at $1 per 1,000 pages.
Call pytesseract.image_to_data(image, output_type=pytesseract.Output.DICT). Each entry with level 5 is a word, with left, top, width, height, a confidence from 0 to 100, and its block, paragraph and line number.
Not on most of our English pages: EasyOCR's median CER was 2.86% on single-column text against Tesseract's 0.19%, and above 70% on multi-column pages because it reads across columns. On the mixed report pages it was lower (5.70% against 12.01%). It used about 13 times the CPU, and its strength is support for 80-plus languages, which we did not test.
No. Both ran on a laptop CPU, at 34 and 38 CPU-seconds a page (26 and 11 seconds of wall time on four threads). Both can use a GPU, which we did not test.
Tesseract and EasyOCR return text and boxes only, so you rebuild rows and columns yourself. docTR 1.1 has an opt-in detect_tables switch; on our pages some cells merged two values. HyperAPI fast parse returns each table as a table block with positions and as HTML by default, at $1 per 1,000 pages.
Yes. HyperAPI gives 30 free pages a month with no card, and its Python SDK installs from GitHub. Fast parse is priced at $0.001 a page; paid plans start at $1 a month.
Need headings, sections and tables, not just words? Sign up for 30 free pages a month, no card needed.