Document Text Extractor
Pricing
Pay per event
Document Text Extractor
Extract ordered plain text from public PDF, image, and web page URLs while preserving readable headings, lists, tables, page breaks, metadata, and quality warnings.
Pricing
Pay per event
Rating
0.0
(0)
Developer
Stas Persiianenko
Maintained by CommunityActor stats
0
Bookmarked
3
Total users
2
Monthly active users
2 days ago
Last modified
Categories
Share
Turn public PDFs, text images, screenshots, and web pages into ordered plain text with one Actor. This document text extractor preserves readable structure where the source exposes it: headings stay on separate lines, lists keep bullet markers, HTML tables keep rows and columns, PDF pages stay separated, and image OCR retains detected line breaks.
Each URL produces one typed dataset record containing the extracted text, source type, method, size, counts, metadata, quality warnings, and any per-source error. Use the records directly in Apify datasets, exports, API integrations, search indexes, or RAG pipelines.
What can this document text extractor process?
The Actor automatically detects and handles:
- public PDFs with a text layer;
- public PNG, JPEG, GIF, and WebP images containing English text;
- server-rendered public HTML pages;
- mixed batches containing all three source types;
- redirects whose destinations remain publicly routable.
You do not need to label each URL. Detection uses the HTTP media type and file signatures, so a useful source can still work when its server returns an imprecise header.
Who is it for?
- Data and ETL teams normalizing mixed documents into one JSON shape.
- RAG and search developers preparing text for chunking, embedding, and indexing.
- Researchers and analysts moving readable source text into spreadsheets or notebooks.
- Accessibility and content teams checking the textual structure exposed by documents and pages.
- Automation builders scheduling repeated extraction from a known list of public resources.
This Actor extracts text; it is not a document text editor and does not modify the original file.
Why use it?
A basic HTML tag stripper or PDF parser often collapses a document into one unreadable line. This Actor uses a parser selected for each format:
- PDF text-layer reconstruction sorts positioned text by page, line, and horizontal coordinate.
- Image OCR uses a local Tesseract worker and reports recognition confidence.
- Semantic HTML extraction retains headings, paragraphs, lists, block quotes, and table rows.
The result stays plain text, but useful visual clues survive as line breaks, # heading markers, - list markers, | table separators, and PDF page separators.
Extracted data
| Field | Meaning |
|---|---|
sourceUrl | Original URL from the input |
finalUrl | URL after validated redirects |
sourceType | pdf, image, or webpage |
title | PDF title, page title, or image filename |
text | Layout-aware extracted plain text |
extractionMethod | pdf-text-layer, image-ocr, or html-semantic |
pageCount | PDF page count; null for other formats |
wordCount | Whitespace-delimited word count |
characterCount | Extracted text character count |
contentType | Source HTTP media type |
fileSizeBytes | Downloaded source size |
ocrConfidence | Image OCR confidence from 0 to 100 |
metadata | Available author, description, language, and date |
warnings | Non-fatal quality limitations |
error | Per-URL failure reason, otherwise null |
extractedAt | ISO timestamp for the extraction |
Failed URLs remain visible as uncharged error records, which makes batch troubleshooting easier. A run fails when none of its sources produces useful text.
Getting started
- Open the Actor input page.
- Add one or more public PDF, image, or web-page URLs to Public document URLs.
- Keep Maximum documents small for your first run.
- Adjust the file-size or request-timeout limits only when your sources require it.
- Click Start.
- Open the default dataset to inspect or export the text records.
The prefilled input covers a PDF, a text image, and a web page, so it is also a quick compatibility test.
Input parameters
startUrls
Required request-list array. Add 1–100 public HTTP or HTTPS URLs. Duplicate URLs are processed once. URLs with embedded credentials and URLs resolving to private, loopback, link-local, or reserved addresses are rejected.
maxItems
Maximum number of unique URLs processed, from 1 to 100. The default is 10. This limit is applied before any skipped URL is downloaded.
maxFileSizeMb
Maximum response size for one source, from 1 to 50 MB. The default is 20 MB. Both declared and downloaded sizes are checked.
requestTimeoutSecs
Timeout for one download attempt, from 5 to 120 seconds. The default is 30 seconds. Network timeouts, rate limits, and temporary server errors receive at most two bounded retries.
includeMetadata
When true, the Actor returns available PDF or HTML author, description, language, and date values. It defaults to true.
Example input: mixed documents
{"startUrls": [{ "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" },{ "url": "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/cosmic.png" },{ "url": "https://www.w3.org/WAI/standards-guidelines/wcag/" }],"maxItems": 3,"maxFileSizeMb": 20,"requestTimeoutSecs": 30,"includeMetadata": true}
This exact input exercises PDF parsing, English image OCR, and semantic HTML extraction.
Example output
{"sourceUrl": "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/cosmic.png","finalUrl": "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/cosmic.png","sourceType": "image","title": "cosmic.png","text": "HellO World\nfrom beyond\nthe Cosmic Void","extractionMethod": "image-ocr","pageCount": null,"wordCount": 7,"characterCount": 39,"contentType": "image/png","fileSizeBytes": 13037,"ocrConfidence": 88,"metadata": null,"warnings": [],"error": null,"extractedAt": "2025-01-15T12:00:00.000Z"}
OCR output reflects the source and recognition model. Use ocrConfidence and warnings to decide when a human should verify the text.
How layout is preserved
PDFs
PDF.js returns positioned text items. The Actor groups nearby items into lines, sorts lines from top to bottom, estimates spaces from coordinate gaps, identifies unusually large text as headings, and inserts a visible separator between pages.
Images
Tesseract recognizes English text and returns detected line breaks and whitespace. One worker is reused across all images in a run to avoid repeated model initialization.
Web pages
The Actor removes scripts, styles, navigation, hidden content, and common chrome. It prefers an article or main region, then extracts semantic blocks in document order. Headings, lists, quotes, and table rows receive readable plain-text markers.
How much does it cost to extract text from documents?
Pay-per-event pricing has a $0.005 run-start fee and a per-successful-document event. Failed sources are not charged as documents.
At the BRONZE tier, a successfully extracted document costs $0.00352:
| Successful documents | Estimated total |
|---|---|
| 1 | $0.00852 |
| 10 | $0.0402 |
| 25 | $0.093 |
| 100 | $0.357 |
The active tier curve is visible in Apify Console. Compute is included in PPE pricing. Large image OCR jobs can take longer than PDF or HTML extraction, but they use the same successful-document event.
Export and integration workflows
Common workflows include:
- export dataset rows to JSON, CSV, Excel, or XML;
- send
textinto an embedding or semantic-search pipeline; - split text by heading or PDF page separator for RAG citations;
- schedule a Task with a stable source list and compare datasets downstream;
- use
warnings,ocrConfidence, anderroras quality gates; - connect a run to Make, Zapier, webhooks, or another Actor.
The Actor does not maintain a change history itself. Scheduled comparison requires a downstream workflow or dataset diff.
Run with the Apify API
Replace YOUR_TOKEN with an Apify API token.
cURL
curl -X POST \"https://api.apify.com/v2/acts/automation-lab~layout-aware-text-extractor/runs?token=YOUR_TOKEN" \-H "Content-Type: application/json" \-d '{"startUrls": [{"url": "https://www.w3.org/WAI/standards-guidelines/wcag/"}],"maxItems": 1}'
JavaScript
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });const run = await client.actor('automation-lab/layout-aware-text-extractor').call({startUrls: [{ url: 'https://www.w3.org/WAI/standards-guidelines/wcag/' }],maxItems: 1,});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items[0].text);
Python
from apify_client import ApifyClientclient = ApifyClient("YOUR_TOKEN")run = client.actor("automation-lab/layout-aware-text-extractor").call(run_input={"startUrls": [{"url": "https://www.w3.org/WAI/standards-guidelines/wcag/"}],"maxItems": 1,})items = client.dataset(run["defaultDatasetId"]).list_items().itemsprint(items[0]["text"])
Use with MCP and AI agents
Add the Actor as an Apify MCP tool in Claude Code:
claude mcp add --transport http apify \"https://mcp.apify.com?tools=automation-lab/layout-aware-text-extractor"
Claude Desktop, Cursor, and VS Code can use the same actor-scoped server configuration:
{"mcpServers": {"apify": {"url": "https://mcp.apify.com?tools=automation-lab/layout-aware-text-extractor"}}}
Example prompts:
- “Extract the headings and readable text from these three public PDF URLs.”
- “Read this screenshot, then tell me the OCR confidence and warnings.”
- “Normalize this web page and PDF into text records for my search index.”
Reliability and failure behavior
- Temporary network errors, HTTP 429 responses, and selected 5xx responses receive bounded backoff retries.
- Redirect destinations are revalidated before download.
- An unsupported media type creates an uncharged error record.
- Individual failures do not discard successful records from the same batch.
- The run ends as failed when every selected source fails or returns no useful text.
- The Actor never silently enables a paid proxy or browser fallback.
Review dataset error and warnings fields before treating output as complete.
Limitations
- Image OCR currently uses the English model.
- PDFs need an embedded text layer; scanned PDF pages are not rendered for OCR.
- Password-protected or corrupted PDFs are unsupported.
- JavaScript-only pages may expose little server-rendered text; these return a warning or error rather than browser-rendered content.
- CSS visual placement is not reproduced for HTML. Semantic document structure is preserved instead.
- Complex multi-column PDFs and nested tables can still need human review.
- The Actor accepts public URLs only and does not send custom authorization headers.
- It does not edit documents, create
.txtfiles in key-value storage, crawl linked pages, monitor changes, or translate text.
Tips for better results
- Prefer direct file URLs instead of viewer or download landing pages.
- Use high-resolution, upright images with good contrast.
- Check
ocrConfidencebelow 65 and any warning messages. - Use a PDF with a selectable text layer when possible.
- Keep mixed test batches small until source behavior is understood.
- Increase timeout or file size only for a known source requirement.
- Split very large workflows across Tasks to simplify retries and review.
Responsible use and legality
Process only public content that you are authorized to access. Follow source terms, robots guidance where applicable, copyright requirements, privacy rules, and data-protection law. Extracted text can contain personal or copyrighted material; you remain responsible for storage, retention, sharing, and downstream use.
The Actor blocks private-network destinations to reduce server-side request forgery risk. It is not a tool for accessing intranet, authenticated, or paywalled documents.
Troubleshooting
Why did a URL return an unsupported content-type error?
Check that the URL points directly to a PDF, supported image, or HTML page. Some download pages return JSON, archives, office files, or authentication screens instead of the expected document.
Why is my scanned PDF empty?
The PDF has no embedded text layer. Convert its pages to images and submit the public image URLs, or use an OCR-specific PDF Actor.
Why is a web-page result short?
The page may render its main content in JavaScript. This Actor intentionally uses server-rendered HTML and does not launch a browser. Submit a public static/print surface when the site offers one.
Why did the whole run fail after producing dataset rows?
Error rows are diagnostic and uncharged. The run fails when no selected URL produced useful text. Inspect each row’s error value.
Can I use it as a free online document text editor?
No. It performs extraction and returns structured dataset records; it does not modify or save edited source documents.
Related Automation Lab Actors
- PDF Text Extractor for simple PDF metadata and page text at lower memory.
- Webpage Text Extractor for web-only batches with links and article metadata.
- PDF Structured Table Extractor when table records, rather than a plain-text layout, are the main output.
Choose this Actor when one workflow needs consistent records across PDFs, images, and web pages.
FAQ
Does one input URL always create one record?
Yes. A successful source creates one charged result; a failed source creates one uncharged diagnostic record.
Are proxy fees added?
No automatic proxy is used. The PPE price includes platform compute for the supported direct public-URL route.
Can the Actor preserve every visual detail?
No. It preserves useful text structure, not fonts, colors, absolute CSS positioning, images, or exact page geometry.
Can I process the same URL more than once?
Duplicate normalized URLs within one run are processed once. Separate scheduled runs process the URL again.
What should I store for auditability?
Keep sourceUrl, finalUrl, extractedAt, contentType, fileSizeBytes, warnings, and the run ID alongside downstream text chunks.