PDF to Text: PDF Text Extractor with OCR Fallback avatar

PDF to Text: PDF Text Extractor with OCR Fallback

Pricing

from $1.00 / 1,000 text-layer pages

Go to Apify Store
PDF to Text: PDF Text Extractor with OCR Fallback

PDF to Text: PDF Text Extractor with OCR Fallback

PDF to text: reads each page's text layer and OCRs scanned pages locally. Uploads or file URLs, no API key, no proxy. Pay per page.

Pricing

from $1.00 / 1,000 text-layer pages

Rating

0.0

(0)

Developer

Luxe Tasks

Luxe Tasks

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

16 days ago

Last modified

Categories

Features

Limited permissions

Share

Developer: Luxe_tasks.

Turn PDF files into plain text. For every page, the Actor first reads the PDF's embedded text layer (PDF.js, inside the Actor). Only pages without a usable text layer, such as scanned pages or pictures of text, are rendered and read with local Tesseract OCR. No API key, no proxy and no third-party service: your files are processed inside the Actor.

  • Born-digital PDFs (reports, invoices, papers exported from an editor): text comes straight from the text layer, fast and with the original characters.
  • Scanned PDFs: each page is read with English OCR; output may differ from the printed text (spacing, special characters, small fonts).
  • Mixed PDFs: each page is handled on its own; the per-page source field says text_layer or ocr.
  • The Actor reads the text a PDF already contains, or recognises printed text on scanned pages, and returns it as plain text for your own use; it does not give you any right to reuse the document.
  • The Actor does not open, decrypt or work around passwords, encryption or copy restrictions in any PDF, and it has no password field.
  • Three ways in: upload a PDF with the Upload a PDF button, list records of the run's key-value store (API), or (for documents you own or are licensed to process) give direct file URLs.

Try it

The input is prefilled with Include sample document switched on, matching Apify Store's daily test, which runs the Actor with the input schema prefill. An empty API input {} runs the same bundled sample: a two-page PDF written for this Actor, whose page 1 is read from its text layer and page 2 with OCR; sample rows add no page charge, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

If you also give files, an upload or URLs, the sample adds one extra row. The sample file is checked against its pinned SHA-256 before it is read; if the check fails, the run fails.

Do not submit sensitive data

Do not submit protected health information (PHI) as defined under HIPAA, or consumer health data. This Actor is not HIPAA-compliant and the developer will not sign a Business Associate Agreement. Do not submit government ID documents, payment-card or bank-account numbers, or other sensitive personal data unless you have a lawful basis to process it and have assessed that this Actor is appropriate. You are the controller; the developer acts only as your processor.

Your responsibility

Only process documents you own or are licensed to process. Under Apify's Standard Actor Contract you are responsible for the files and URLs you provide, for having the right to provide them, and for how you use the extracted text, including compliance with copyright and data-protection law.

If your documents contain personal data, you are the controller and the developer is the processor under the Standard Actor Contract; process only data you have a lawful basis for, and don't submit health records or other special-category data.

Input

  • uploadedFile (optional, Upload a PDF button): one PDF from your computer. Apify stores it in your key-value store, and the Actor reads it through the Apify platform (never by downloading a link). Apify storage links typed into files are not accepted as file URLs.
  • includeSampleDocument (default off, prefilled on): add the bundled 2-page sample as one extra row.
  • files (optional; empty or missing runs the bundled sample unless Include sample document is switched off): a list of PDF files, each one of
    • {"key": "report"}: a record in this run's default key-value store (for API callers that write the record before the Actor reads it);
    • {"fileUrl": "https://example.com/doc.pdf"}: file URL mode, only for documents you own or are licensed to process; one file per URL, no crawling or link following. Requires documentRightsAttestation = true ("I own or am licensed to process every document at these URLs, and fetching them does not get around any access control."); without it the run stops before making any request.
    • URL limits: at most 50 file URLs per registered domain and 200 per run; URLs over the cap are skipped (skipped_url_cap) and not fetched, with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies. URLs with a user name or password (user:pass@host) are refused. Presigned URLs are accepted (Apify storage links are not; use the upload button); their query strings are never logged and appear in results only as ?[redacted].

If the input is invalid, for example a file URL without the rights confirmation, the run stops before reading any file and adds no page charge; the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

With Include sample document switched off and no files, upload or URLs, the run fails with: "Invalid input: add at least one PDF file or URL, or switch on Include sample document; nothing was processed, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies."

  • Accepted: PDF only (decided by the file's bytes, not its name), up to 20 MB and 1,000 pages per file; at most 50 pages per file are read with OCR (later scanned pages get OCR_PAGE_LIMIT). A file has up to 480 s. Measured OCR on our test files was about 10.7 to 14.7 seconds per scanned page (may vary), so about 32 to 44 scanned pages fit in that 480 s when the file is processed alone at 2 GB; the per-file cap remains 50 OCR pages. When several scanned files are processed at once they share one OCR reader, so each may get fewer scanned pages within its 480 s; pages not reached get file_timeout or ocr_timeout with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies. Encrypted or password-protected PDFs, files that aren't PDFs, and files over the size or page limits get a status row and no text; those rows are not billed events, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies. No passwords are taken: an input with a password or pdfPassword key fails with "Invalid input: this Actor takes no PDF passwords and refuses encrypted PDFs.", and every encrypted PDF (owner-password-only included) gets the status ENCRYPTED_REFUSED.
  • Per run: by default at most 2,000 text-layer pages (maxTextPagesPerRun, up to 20,000) and 100 OCR pages (maxOcrPagesPerRun, up to 500), and 1 GB of files in total (RUN_BYTE_LIMIT). The default run timeout is 900 s; the maximum caps need a 3,600 s timeout.
  • ocrFallback (default on): OCR pages that have no usable text layer. Off: only text layers are read; other pages are reported as no_text_layer / text_layer_unusable with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.
  • OCR settings (used only for pages without a text layer): language eng; layout auto / single-column / sparse; renderDpi 100-300 (default 200); pageTimeoutSecs (default 60).
  • maxPagesPerFile (default 1,000), includeTextInDataset (default true), maxConcurrency (default 3; reduced to what fits in memory: 1 file at 1 GB, 2 at 2 GB, 4 at 4 GB; OCR reads one page at a time).

Output

  • One dataset record per file: status, pageCount, pagesWithText, pagesFromTextLayer, pagesFromOcr, pagesNotCharged, pages (per page: source, status, and for OCR pages word count and mean confidence), fileSha256, text (first 100,000 characters), textChars, link. When a status is shown in capitals, the original lower-case code is kept in kitStatus.
  • The full text of each file is saved as a .txt record in the run's default key-value store (pages separated by a form feed \f).
  • RUN_SUMMARY in the key-value store has counts and the page events charged; the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB is not counted there.

Status codes

Only success rows carry page events. Every other status below adds no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

StatusMeaning
successtext was read; billed per page, plus the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB per run (see Pricing)
samplethe bundled sample was read; no page events, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies
no_text_foundno page had readable text
FILE_TOO_LARGEthe file is over 20 MB
too_many_pagesthe file has more pages than maxPagesPerFile
FILE_BOMBthe file's structure or compressed streams expand beyond the safety limits
NOT_A_PDFthe bytes are not a PDF (or the URL returned a web page, or the list entry is neither a record key nor a file URL)
ENCRYPTED_REFUSEDthe PDF is encrypted (any kind); it is not opened
extraction_not_permittedthe PDF could not be read for text under its own settings
corrupt_filethe PDF could not be parsed
file_not_foundthe record or uploaded file (or the storage it was uploaded to) is missing or empty
upload_access_deniedthe Actor was not allowed to read the uploaded file
invalid_inputthis list entry is not valid input
budget_reachedyour maximum total charge cannot cover the file; no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies
render_timeout / render_memory_limitthe PDF renderer ran out of time or memory
file_timeout / ocr_timeoutthe file (or its OCR reading) reached its time limit; later pages were not read and add no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies
run_time_limitthe run was close to its timeout (or 60 minutes), so the file was not started
uncharged_work_limittoo much work without readable text in this run; the file was not started
run_text_page_limit / run_ocr_page_limitthe per-run page cap was reached
RUN_BYTE_LIMITthe run already read 1 GB of files
sample_check_failedthe bundled sample did not match its pinned SHA-256
ocr_failedthe OCR engine failed on the file
internal_erroran unexpected error; please report it
charge_failed / save_failed / state_save_failed / delivered_record_faileda platform write or charge step failed; the file adds no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies
resumed_skipafter a platform restart, the file was already done
url_mode_disabledfile URLs are switched off in this build
skipped_url_capover 50 URLs for one site or 200 per run
INVALID_URLnot an http(s) URL, a URL with a user name or password, or a non-standard port
PRIVATE_ADDRESS_REFUSED (kitStatus: ssrf_blocked)the URL, one of its redirects or its DNS result points at a private, loopback, link-local or cloud-metadata address, or at an Apify platform host, so it was refused without fetching the file
OPTED_OUTthe site's owner asked not to be fetched
ROBOTS_DISALLOWED / ROBOTS_UNREACHABLErobots.txt disallows the file, or could not be read (server or network error)
ACCESS_DENIEDthe site answered 401, 403, 407, 430 or 451
RATE_LIMITEDthe site answered 429 or asked to retry later
CHALLENGE_DETECTEDthe site showed a CAPTCHA or bot check
LOGIN_REQUIREDthe site asked for a login
SITE_UNREACHABLEDNS, TLS, a timeout or a 5xx error
TOO_MANY_REDIRECTSmore than 5 redirects
skipped_blocked / domain_stoppedthe site was stopped earlier in the run; not requested
redirect_out_of_scopea redirect left the allowed scheme or port
download_failedanother download error (for example 404)

Page statuses other than ok (blank, low_confidence, no_text_layer, text_layer_unusable, ocr_timeout, render_failed, page_too_large, page_too_complex, render_timeout, file_timeout, not_rendered, uncharged_work_limit, OCR_PAGE_LIMIT, run_text_page_limit, run_ocr_page_limit) add no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

Pricing

You pay $1.00 per 1,000 pages read from a PDF's own text layer and $6.00 per 1,000 scanned pages read with OCR, plus a start fee for each run of $0.005 per GB of memory, $0.01 at the default 2 GB (minimum one event, $0.005). Blank, failed and refused pages add no page charge, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

  • Events: text-page ($0.001) for each page read from the text layer; ocr-page ($0.006) for each scanned page read with OCR; Apify's apify-actor-start ($0.005 per GB of memory, $0.01 at the default 2 GB; $0.005 at 1 GB, $0.02 at 4 GB), which is the start fee.
  • Each file is billed with one event type: a file with at least one page read with OCR pays $0.006 for each OCR page and no page charge for its text-layer pages, a file with no OCR pages pays $0.001 for each text-layer page, and every run also pays the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB.
  • Page charges happen only after a file's text and record are saved, once per file, on top of the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB. Before any page is read, the Actor checks that your remaining maximum charge covers all its pages; if not, the file is refused as budget_reached with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

Limits

  • A PDF page must render within 15 s and decode to at most 1,000,000 drawing operations; a file must finish within 480 s. PDFs whose compressed streams expand beyond the Actor's limits are refused before reading (FILE_BOMB). The PDF reader runs in a separate process that is stopped above its memory limit (render_memory_limit).
  • A run stops starting new files about 4 minutes before its run timeout (default 900 s; the maximum caps need 3,600 s) or after 60 minutes, whichever comes first, and files it did not start get a run_time_limit row with no page charge, while the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.
  • A file that starts late in the run gets less time (it must end 60 s before the run timeout), so a long scanned file near the end can end with file_timeout pages.
  • A run also stops taking new files once work without text reaches 25 files, 500 pages or 10 minutes.
  • OCR reads one page at a time for the whole run (one OCR slot per run). About 32 to 44 scanned pages per file fit in the 480 s file limit when that file is processed alone (measured about 10.7 to 14.7 seconds per scanned page on our test files; may vary); files read at the same time share the slot and get less of it.
  • At about 10.7 to 14.7 seconds per scanned page (measured on our test files; may vary), the default run cap of 100 OCR pages (about 1,070 to 1,470 s) cannot fully finish inside the default 900 s run window, after the time reserved before the run timeout. Pages that don't fit get unbilled timeout rows (file_timeout, or run_time_limit for files not started) with no page charge, while the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

Retention and logging

Results are written only to your run's default Apify storage; the developer does not copy, view, retain or share them, and logs record only the URL with its query string redacted, the status, page counts and timings, never document text. Your run's storage follows your Apify plan's data retention settings, and unnamed storages are deleted automatically when that period ends, so export anything you need to keep.

  • A file you upload stays in your own Apify key-value store where Apify put it; the Actor reads it and does not copy, change or delete it. No data is used for training.

URL mode safety

If a site's robots.txt disallows the file or can't be read because of a server or network error, the site denies access, asks for a login or shows a challenge, the Actor makes no further requests to that site and writes one status row per URL with the URL, a status and a reason, and no document content; status rows are not billed events, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

A file URL on an opted-out site, on a non-standard port or on an Apify platform host stops the whole run before any request is made, with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies; remove that URL and run again.

For URLs, the Actor fetches only the single file at each URL, follows at most 5 redirects, sends no cookies or credentials, identifies itself with an honest user agent and honours robots.txt.

  • robots.txt is honoured in file URL mode; uploads and the bundled sample make no requests to websites (an upload is read from your Apify storage through the Apify API).
  • A robots.txt that returns 4xx (except 429) means no restrictions; a 429 is treated as a rate limit and stops the domain; 5xx or an unreachable robots.txt means nothing is fetched.
  • Each download has a 15 s idle limit (connection and first byte) and a 60 s total limit across all redirects (SITE_UNREACHABLE).
  • At most ~1 request per second per registered domain; fixed honest User-Agent PdfTextExtractorActor/0.1.3 (+https://apify.com/luxe_tasks/pdf-text-extractor; honours robots.txt); no proxies, logins, cookies or tokens.
  • A 403, 429 or CAPTCHA/challenge page stops the whole registered domain for the rest of the run; later files there are skipped with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.
  • Private, loopback, link-local and cloud-metadata addresses are refused, re-checked after DNS and on every redirect. A URL that returns a web page instead of a file is refused (no crawling).

Acceptable use

By running this Actor you confirm that:

  1. You submit only files you own or are licensed to process, and you will use the output lawfully.
  2. You do not submit protected health information or consumer health data. You submit other sensitive data covered by the notice above only with a lawful basis and after assessing the Actor as appropriate.
  3. You do not use file URL mode to get around logins, paywalls, CAPTCHAs, rate limits or other access controls, or to crawl sites.
  4. You comply with applicable law, including copyright and data-protection law (GDPR, CCPA and similar). You are the controller of any personal data in your files and results.
  5. You do not use the Actor to identify, profile or track individuals. The Actor does not detect, extract or match faces and is not designed to.

Privacy

Results are written only to your run's default Apify storage. The developer does not copy, view or retain them. If your results contain personal data, you are the controller and the developer acts only as your processor under Apify's Standard Actor Contract. Apify's retention settings apply.

Third-party software

PDF.js, Tesseract OCR and its tessdata English model (Apache-2.0), @napi-rs/canvas (MIT); details and licence texts in NOTICE and licenses/.

Runtime

Node 24, Dockerfile apify/actor-node:24 + Alpine tesseract-ocr 5.5.2. Memory: default 2048 MB, minimum 1024 MB, maximum 4096 MB (text-only runs work at 1 GB). Files are processed 2 at a time at 2 GB (1 at 1 GB, 4 at 4 GB), and OCR reads one page at a time.

Reporting

To report a problem or ask for your site to be added to the Actor's opt-out list, open an issue on the Actor's Issues tab; to report content on the Apify platform, use the notice process in section 13.2 of Apify's General Terms.