PDF to Text and Markdown: Per-Page Text for RAG
Pricing
from $4.00 / 1,000 pdfs
PDF to Text and Markdown: Per-Page Text for RAG
Give it PDF links, or files from Drive, Dropbox or ZIP archives, and get one JSON row per PDF: metadata, full text, Markdown and a per-page list. Scanned pages are flagged, or read with the optional OCR. $4 per 1,000 PDFs; failed files are free.
Pricing
from $4.00 / 1,000 pdfs
Rating
0.0
(0)
Developer
Mohamed Ayman
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
an hour ago
Last modified
Categories
Features
Share
Convert PDF links into clean text, Markdown and metadata, page by page, for developers and analysts building RAG pipelines, search indexes and document workflows. It costs $4 per 1,000 PDFs (up to 20 pages each). Scanned pages are flagged for free, or read by OCR in the same run for $4 per 1,000 pages when you turn that on; failed downloads and every error row are free.
Paste public PDF links, run, and get one JSON row per file with the full text, a Markdown version and a per-page list. No login, no API key, no proxy.
PDF to Text and Markdown: Per-Page Text for RAG
- Text and Markdown for every page. One row per PDF with the full
text, amarkdownversion, and apageslist so you can chunk by page. - Document metadata. Title, author, subject, keywords, creator, producer, creation and modification dates, page count and file size.
- Any way of giving files. Links, Google Drive and Dropbox share links, base64 text, Apify key-value store records, a dataset with a link field, a CSV or TXT list of links, ZIP archives, and web pages that link to PDFs. Every link goes through the same safe downloader.
- Scans are flagged, not guessed. Pages with no text layer come back with
needsOcr: true, so you know which files are scans before you spend anything on them. - OCR in the same run, if you want it. Set
ocrScannedPagesto true and the pages with no text layer are read by OCR (the same engine as our Image OCR actor) and merged into the same row, in page order. No second run, no second actor. It is off by default, so nothing changes for text PDFs and scans stay free.
By default it reads only the text layer that is already inside the PDF, so it is fast and cheap.
Quick start
Paste this input as it is. An empty input runs the same default example (a public IRS form).
{"urls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"],"includeMarkdown": true,"includePages": true}
Example output
One row per PDF, from a real run on that IRS form (text shortened, only page 1 of 6 shown):
{"rowType": "document","url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf","finalUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf","origin": "url","fileName": null,"parentUrl": null,"status": "ok","error": null,"errorCode": null,"note": null,"title": "Form W-9 (Rev. March 2024)","author": "SE:W:CAR:MP","subject": "Request for Taxpayer Identification Number and Certification","keywords": "Fillable","creator": "Designer 6.5","producer": "Designer 6.5","creationDate": "2024-03-06T08:18:13","modificationDate": "2024-03-06T08:18:13","pageCount": 6,"pagesProcessed": 6,"truncated": false,"needsOcr": false,"needsOcrPages": [],"ocrPages": [],"charCount": 38049,"fileSizeBytes": 140815,"text": "Form W-9\n\n(Rev. March 2024)\nDepartment of the Treasury\nInternal Revenue Service\nBefore you begin. …","markdown": "Form W-9\n\n(Rev. March 2024) Department of the Treasury Internal Revenue Service Before you begin. …","pages": [{"page": 1,"text": "Form W-9\n\n(Rev. March 2024)\nDepartment of the Treasury …","markdown": "Form W-9\n\n(Rev. March 2024) Department of the Treasury …","charCount": 5778,"needsOcr": false,"ocr": false,"ocrConfidence": null,"width": 612,"height": 792}],"charges": { "pdf": 1 },"extractedAt": "2026-11-18T17:21:45Z"}
A file that fails gives a row with rowType: "error", an errorCode (http_error, too_large, not_supported_file, corrupt_pdf, encrypted or blocked_address) and a plain-language error.
Use cases
- Turn PDF reports, manuals and contracts into text for a RAG or vector-search pipeline.
- Extract text from a folder of PDF links for full-text search.
- Convert PDF documents to Markdown before sending them to an LLM.
- Pull titles, authors and dates from PDF metadata to build a document catalogue.
- Check which PDFs in a batch are scans, or read text PDFs and scans together in one run.
- Archive the text of public PDF filings, papers or price lists on a schedule.
Input
| Field | Default | What it does |
|---|---|---|
urls | one IRS form, only if you give no file at all | Public http or https links to PDF files or ZIPs of PDFs. Google Drive and Dropbox share links work |
base64Files | none | Files as base64 text (or a data: URI), or {"name": "a.pdf", "data": "..."} objects |
keyValueStoreId, keyValueStoreKeys | none | Records of an Apify key-value store, stored with their own content type (for example application/pdf). No store ID means this run's own default store |
datasetId, datasetField, datasetLimit | none, none, 1000 | A dataset of yours and the field that holds each link (a link, a list of links, or {"url": ...}; a.b goes one level deeper) |
urlListUrls, urlListColumn | none | Links to a TXT (one link per line) or CSV file that lists links; the CSV column is found by header or content, or named |
followPdfLinks, maxLinksPerPage | false, 20 | A link that returns a web page is read for links to PDFs, one level deep, at most this many per page |
maxFilesPerZip, maxZipUncompressedMb | 200, 500 | Limits for ZIP archives, which are expanded in memory |
includeMarkdown | true | Markdown of every page and of the whole document |
includePages | true | A pages list with text, Markdown, needsOcr, ocr and size per page |
ocrScannedPages | false | Read pages with no text layer by OCR, in the same run. Needs 1024 MB of memory |
ocrLanguage | en | Which recogniser reads those pages: en (English and other Latin-script languages), ch, korean, arabic (Arabic, Persian, Urdu, returned in reading order), cyrillic, devanagari, th, el, ta, te. Japanese is in Image OCR |
ocrMaxPagesPerPdf | 20 | At most this many scanned pages of one PDF are read by OCR; the rest stay in needsOcrPages. It caps what one file can cost |
maxPagesPerPdf | 500 | Pages past this are not read; the row says truncated: true |
maxFileSizeMb | 50 | Bigger files give a free error row |
How much does it cost?
- $4 per 1,000 PDFs (one
pdfevent per PDF with text, covering up to 20 pages). - $0.30 per 1,000 extra pages for each page past 20 in the same PDF.
- Free: PDFs with no text layer at all (unless OCR is on), failed downloads, files that are not PDFs, and every error row. A mixed PDF (some scanned pages) is charged, and its scanned pages are listed in
needsOcrPages. - OCR, only if you turn it on: $4 per 1,000 scanned pages where OCR finds text (
ocr-page). A page where OCR finds nothing, or fails, is free. A PDF made only of scans is charged for its OCR pages and not forpdfon top, so a 5-page scan costs $0.020, the same as in Image OCR. In a mixed PDF the text pages are charged as above and each OCR page on top. Very dense pages add $0.004 per extra block of lines (dense-page): above 150 lines forenandch, one per 100 lines; above 40 lines for the other recognisers, one per 40. Each row shows what it was charged incharges, for example{"pdf": 1, "ocr-page": 2}. - Pages read by OCR do not count toward the 20 pages of the
pdfevent, andextra-pageapplies only to the text pages past 20. - Apify adds a very small run-start charge, shown on the Pricing tab.
Worked example with the free $5 monthly credit. Apify's free plan includes $5 of credit each month. That reads about 1,250 PDFs of up to 20 pages. A 200-page report costs $0.004 + 180 x $0.0003 = $0.058, so $5 covers about 86 of those. With OCR on, a 10-page scanned contract costs $0.040, so $5 covers 125 of them.
To cap spending, set a maximum cost per run in the run options. The actor stops cleanly when it is reached.
Limits
- Scans need OCR turned on. Without
ocrScannedPages, scanned pages giveneedsOcr: trueand an empty text. With it on, OCR is imperfect: low resolution, handwriting, heavy skew and dense small print cause errors, and each page'socrConfidencetells you how sure the engine was. OCR pages carry plain text inmarkdown(no headings or lists; Arabic-script pages are in reading order, right to left), and tables on scanned pages are not rebuilt. For word boxes, lines with positions, accurate mode, Japanese or very long scans, use Image OCR. - OCR needs memory. The actor's default is 1024 MB, enough for dense pages. A run with
ocrScannedPagesand less than 1024 MB stops at the start with a clear message instead of running out of memory half way. Memory is billed by use, and a text-only run uses far less than that. - Markdown is a best effort. Headings come from font size, lists from bullet characters, paragraphs from line joins. Tables come back as lines of text, not Markdown tables, and multi-column pages are read in the order the PDF library finds them.
- Password-protected PDFs are not opened (
errorCode: encrypted). - One row can be large: a 500-page book is a few MB of text. Apify limits one dataset item to 9 MB, so turn off
includePagesfor very long documents. - Downloads use http and https only, with a 50 MB and 60 second default limit. Links to private or internal addresses are refused. There is no proxy, so a site that blocks Apify's servers gives a free error row.
- The documents you send belong to you. Nothing is stored after the run except the output dataset. OCR works in memory too: pages are rendered, read and dropped.
- Sources. Google Drive and Dropbox links must be public ("anyone with the link"). A Drive file link and a Docs, Slides or Sheets link (exported as PDF) work; a Drive folder does not (
folder_not_supported), and Drive may show a virus-scan page instead of a very large file, which gives a free error. A Dropbox folder link is downloaded as a ZIP. OneDrive and SharePoint links are not converted. Key-value store records must be files stored with their own content type, not JSON or text. - ZIP archives are unpacked in memory, never written to disk, one file at a time. Limits: at most
maxFilesPerZipreadable files (200), at mostmaxZipUncompressedMbwhen unpacked (500 MB), a member unpacking to more than 100 times its compressed size is refused, a member bigger thanmaxFileSizeMbis skipped, password-protected members are skipped, and a ZIP inside a ZIP is not opened. The ZIP file itself counts againstmaxFileSizeMb, and an archive is held in memory while it is read, so raise the memory for very large archives. Each readable file is charged like a file you gave directly. - Web pages are read for PDF links only when
followPdfLinksis on, one level deep: links found on the page are read as PDFs, and a PDF link that returns another web page or a ZIP is refused. Only links ending in.pdf,citation_pdf_urlmeta tags and alternate-PDF link tags are found; links built by JavaScript are not seen. - Error codes for sources:
bad_base64,bad_key,record_not_found,store_unavailable,missing_field,bad_list,empty_list,no_pdf_links,folder_not_supported,corrupt_archive,archive_too_large,suspicious_archive,encrypted,no_supported_files. All are free.
FAQ
Does it do OCR for scanned PDFs? Yes, if you ask for it. By default it reads only the text layer already inside the PDF, which is why it is fast and cheap: pages without one come back flagged with needsOcr set to true, and a PDF with no text at all is not charged. Set ocrScannedPages to true and those pages are read by OCR in the same run and merged into the same row, at $0.004 per page where text is found. OCR is capped by ocrMaxPagesPerPdf (20 by default), so one huge scan cannot surprise you, and you can read the rest with a second run or with Image OCR.
What do I pay for scanned pages? Nothing when OCR is off. With OCR on, $0.004 for each scanned page where OCR finds text, plus $0.004 for each extra block of lines on very dense pages. Blank pages and pages where OCR fails are free. A PDF with only scanned pages is charged for its OCR pages only; a mixed PDF is charged the usual PDF price for its text pages plus its OCR pages. The charges field on each row says exactly what it cost.
Should I use this or Image OCR for scans? Use this one when most of your files are text PDFs and a few are scans: one run, one row per PDF. Use Image OCR when the files are mostly scans or photos, or when you need word boxes, lines with positions, accurate mode or Japanese.
Do I need an API key or a login? No. You need only an Apify account to run it, and no key for any other service. The actor downloads each public http or https link itself. It cannot open password-protected files or links that need a login, and those come back as free error rows with a clear errorCode.
What happens to PDFs that fail? Each failed file gets its own row with rowType error, an errorCode such as http_error, too_large, corrupt_pdf or encrypted, and a plain-language message. Error rows are never charged, and one bad link does not stop the other files in your list from being read.
How good is the Markdown? It is a heuristic. Headings come from font size, lists from bullet characters and paragraphs from line joins. Tables come back as lines of text, not Markdown tables, and multi-column pages are read in the order the PDF library finds them. Test a few of your own files first.
How do I schedule it or use it in n8n or Make? Use Apify's Schedules to run it on a timer, or call it through the Apify API. n8n, Make and Zapier all have Apify integrations, and any HTTP client works. Pass the same JSON input shown above, then read the rows from the run's default dataset as JSON, CSV or Excel.
Are my documents stored anywhere? No. Files are downloaded for the run and nothing is stored afterwards except the output dataset, which sits in your own Apify account. The documents you send belong to you. The actor refuses links to private or internal addresses, so it cannot be pointed at your own network.
How large a PDF can it handle? By default 50 MB and 500 pages per file, and you can change both limits in the input. One output row for a 500-page book can reach several MB, and Apify caps a dataset item at 9 MB. For very long documents, switch off the per-page output to keep rows small.
Can I send files instead of links? Yes. Pass base64 text in base64Files, or put the files in a key-value store and list their keys in keyValueStoreKeys, or point the actor at a dataset of links with datasetId and datasetField. Rows say where each file came from in origin, fileName and parentUrl; the base64 data itself is never copied into the output.
Do Google Drive and Dropbox links work? Public share links do. The actor turns them into direct-download links before fetching, so you can paste the link from the Share button. Docs, Slides and Sheets links are exported as PDF. Folders are not supported on Drive, and links that need a login give a free error row.
Can I give it a ZIP? Yes, from any source. The readable files inside are processed one by one and each is charged like a direct file. The unpacking is limited (file count, total size, compression ratio) so a hostile archive cannot exhaust memory, and nothing is written to disk.
Can it find the PDFs on a web page? Turn on followPdfLinks and give the page's link. The actor reads the page for links to PDFs (up to maxLinksPerPage), one level deep, and reads each one. It does not follow links from those files or click through further pages.
Can I give it a list of links as a spreadsheet? Yes. Put the links in a TXT file (one per line) or a CSV file, host it anywhere public (a Google Drive or Dropbox share link works), and pass its link in urlListUrls. Name the CSV column in urlListColumn if it is not called url or link.
Use from code or an AI agent
The actor runs under limited permissions. Python example:
from apify_client import ApifyClientclient = ApifyClient("<YOUR_APIFY_TOKEN>")run = client.actor("cyrus_1/pdf-to-text-markdown").call(run_input={"urls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"]})for row in client.dataset(run["defaultDatasetId"]).iterate_items():print(row["title"], row["pageCount"], row["needsOcr"])
The same input works with the JavaScript client, the REST API, n8n, Make and Zapier. AI agents can find and run the actor through Apify's MCP server (the search-actors, fetch-actor-details and call-actor tools).
Licences
Built on pdfminer.six (MIT licence). The opt-in OCR uses RapidOCR (Apache 2.0) with PaddleOCR models on onnxruntime (MIT), pypdfium2 and PDFium (Apache 2.0 and BSD-3) to render pages, and Pillow (HPND). python-bidi (LGPL-3) is installed as an ordinary, unmodified dependency for Arabic-script text. The English, Latin and Chinese models ship inside the RapidOCR package (Apache 2.0); the models for the other scripts are downloaded when the actor is built, and RapidOCR does not state a licence for those files, so we do not claim one. No Tesseract, no PyMuPDF and no AGPL-licensed code.
More from this publisher
- Image OCR: text from images and scanned PDFs is the full OCR actor: images, TIFFs, word boxes, accurate mode and Japanese.