PDF to Markdown & Text Extractor (Tables, RAG Chunks)
Pricing
from $3.00 / 1,000 pdf extracted
PDF to Markdown & Text Extractor (Tables, RAG Chunks)
Convert PDFs from URLs into clean Markdown and plain text with headings, lists and tables, plus optional RAG-ready chunks with page numbers. Flat price per PDF. No OCR.
Pricing
from $3.00 / 1,000 pdf extracted
Rating
0.0
(0)
Developer
omitsu_dev
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
11 days ago
Last modified
Categories
Features
Share
PDF to Markdown & Text Extractor
Turn PDFs into clean Markdown and plain text, with headings, lists and tables kept, plus optional RAG-ready chunks that carry page numbers and heading paths.
Give it a list of PDF URLs. You get one dataset item per PDF.
- Markdown with
#headings, bullet and numbered lists, and Markdown tables - Plain text in reading order, including simple two-column layouts
- Tables as rows (arrays) and as Markdown
- Chunks for embeddings, each with
pageStart,pageEndandheadings - Metadata: title, author, dates, page count, file size
- Running headers, footers and page numbers removed by default
- Password-protected PDFs supported with
password - Flat price per PDF. Failed downloads and PDFs without text are not charged
What it does not do
Read this before you run it on a large batch.
- No OCR. Scanned or image-only PDFs come back with
status: "no_text"and are free. - Tables need visible lines. Tables drawn with ruling lines are detected. Tables laid out only with spacing come back as normal text.
- Headings are inferred from font size and weight. This works for most reports, papers and manuals. Documents that use one font size throughout get few or no headings.
- Layout support is simple. One and two columns are handled. Three or more columns, sidebars and text wrapped around figures can come out in the wrong order.
- Images, formulas and footnote links are not extracted.
- URLs must be public and return the PDF itself. Pages that only link to a PDF are not followed.
Input
| Field | Type | Default | Description |
|---|---|---|---|
urls | array of strings | required | Direct links to PDF files |
includeMarkdown | boolean | true | Return Markdown |
includeText | boolean | true | Return plain text |
includeTables | boolean | true | Detect ruled tables |
includeChunks | boolean | false | Return chunks for RAG |
chunkSize | integer | 1500 | Target chunk size in characters |
chunkOverlap | integer | 200 | Overlap between chunks in characters |
includePages | boolean | false | Also return text and Markdown per page |
pageRange | string | all | For example 1-5, 3, 10- |
maxPagesPerPdf | integer | 300 | Stop after this many pages |
removeHeadersFooters | boolean | true | Drop repeated margin lines and page numbers |
password | string | none | For encrypted PDFs |
maxPdfSizeMb | integer | 50 | Skip larger files |
timeoutPerPdfSecs | integer | 120 | Limit per PDF |
maxConcurrency | integer | 3 | PDFs processed in parallel |
{"urls": ["https://example.com/annual-report.pdf"],"includeChunks": true,"chunkSize": 1500}
Output
One item per PDF. Long fields are shortened here.
{"url": "https://example.com/annual-report.pdf","status": "ok","error": null,"warning": null,"fileName": "annual-report.pdf","fileSizeBytes": 482113,"pageCount": 12,"pagesProcessed": 12,"metadata": { "title": "Annual Report", "author": "Example Corp", "creationDate": "2025-03-01T09:00:00" },"markdown": "# Annual Report\n\n## 1. Overview\n\nRevenue grew ...\n\n| Segment | 2024 | 2025 |\n| --- | --- | --- |\n| Cloud | 120 | 150 |","text": "Annual Report\n\n1. Overview\n\nRevenue grew ...","tables": [{ "index": 0, "pageNumber": 3, "rows": [["Segment", "2024", "2025"], ["Cloud", "120", "150"]], "markdown": "| Segment | 2024 | 2025 |\n| --- | --- | --- |\n| Cloud | 120 | 150 |" }],"chunks": [{ "index": 0, "text": "# Annual Report\n\n## 1. Overview\n\nRevenue grew ...", "charCount": 1432, "pageStart": 1, "pageEnd": 2, "headings": ["Annual Report", "1. Overview"] }],"stats": { "charCount": 28411, "wordCount": 4630, "tableCount": 4, "headingCount": 17, "removedHeaderFooterLines": 22, "processingMs": 2140 }}
status is one of:
ok: text was extracted. This is the only status that is charged.no_text: the PDF opened, but it has almost no embedded text (usually a scan).failed: the download or the PDF could not be processed.errorsays why.
If a result is too large for one dataset item, the largest optional fields are left out and warning says which. Use pageRange to split very long documents.
Pricing
Pay per event.
| Event | Price | When |
|---|---|---|
pdf-extracted | $0.003 | Once per PDF with status: "ok". Covers the first 25 pages |
extra-pages | $0.002 | Once per additional 25 pages processed, rounded up |
apify-actor-start | $0.00005 | Once per run |
Examples: a 10-page PDF costs $0.003. An 80-page PDF costs $0.003 + 3 × $0.002 = $0.009. Platform usage is included.
Failed downloads, PDFs that are not PDFs, and no_text results are not charged. Markdown, tables and chunks add no fee. The Pricing tab always shows the current prices.
Automate it: a PDF inbox with GitHub Actions
Keep a list of PDF links in your repository. Every time the list changes, and once every night, a GitHub Action converts the new ones and commits clean Markdown and chunk files to a knowledge/ folder. No server needed.
Measured on three NIST reports (139 pages in total): 9 to 22 seconds per run, list price $0.017. A dead link in the same list failed and cost nothing.
- Add your Apify API token to your repository as the secret
APIFY_TOKEN. - Add the three files below to the root of the repository.
- Put PDF links in
pdfs.txtand push.
pdfs.txt
# One PDF URL per line. Lines starting with # are ignored.https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf
.github/workflows/pdf-inbox.yml
name: pdf-inboxon:push:branches: [main]paths: ["pdfs.txt", "convert.py", ".github/workflows/pdf-inbox.yml"]schedule:- cron: "41 2 * * *"permissions:contents: writejobs:convert:runs-on: ubuntu-latesttimeout-minutes: 20steps:- uses: actions/checkout@v4- uses: actions/setup-python@v5with:python-version: "3.13"- name: Convert new PDFsenv:APIFY_TOKEN: ${{ secrets.APIFY_TOKEN }}run: python convert.py | tee last_run.log- name: Commitrun: |git config user.name "github-actions[bot]"git config user.email "41898282+github-actions[bot]@users.noreply.github.com"git add -Agit diff --cached --quiet || (git commit -m "pdf-inbox: convert new PDFs" && git pull --rebase origin main && git push origin HEAD:main)
convert.py (standard library only)
"""PDF inbox: convert every new PDF URL in pdfs.txt to Markdown with an Apify Actor.Standard library only. Needs the APIFY_TOKEN environment variable.Writes knowledge/<name>.md, knowledge/<name>.chunks.json and state.json, and prints a summary."""from __future__ import annotationsimport datetime as dtimport jsonimport osimport reimport sysimport timeimport urllib.errorimport urllib.requestfrom pathlib import PathACTOR = "omitsu_dev~pdf-to-markdown"API = "https://api.apify.com/v2"HERE = Path(__file__).parentOUT = HERE / "knowledge"STATE = HERE / "state.json"PRICE_PDF, PRICE_EXTRA, PAGES_INCLUDED, START_FEE = 0.003, 0.002, 25, 0.00005def api(method: str, path: str, body: dict | None = None):req = urllib.request.Request(API + path, data=json.dumps(body).encode() if body is not None else None, method=method)req.add_header("Authorization", "Bearer " + os.environ["APIFY_TOKEN"].strip())req.add_header("Content-Type", "application/json")for attempt in range(5):try:with urllib.request.urlopen(req, timeout=90) as resp:return json.loads(resp.read().decode())except urllib.error.HTTPError as exc:if exc.code < 500 or method == "POST":raiseexcept OSError:if method == "POST":raisetime.sleep(3)raise RuntimeError("Apify API did not answer")def slug(url: str) -> str:name = url.rstrip("/").rsplit("/", 1)[-1]name = re.sub(r"\.pdf$", "", name, flags=re.I)return re.sub(r"[^A-Za-z0-9._-]+", "-", name).strip("-") or "document"def list_price(pages: int) -> float:extra = max(0, -(-(pages - PAGES_INCLUDED) // 25))return PRICE_PDF + extra * PRICE_EXTRAdef main() -> None:urls = [l.strip() for l in (HERE / "pdfs.txt").read_text().splitlines() if l.strip() and not l.startswith("#")]state = json.loads(STATE.read_text()) if STATE.exists() else {}todo = [u for u in urls if u not in state or "--force" in sys.argv]summary: dict = {"ran_at": dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds"), "in_list": len(urls), "new": len(todo), "items": []}if not todo:print("Nothing new. All", len(urls), "PDFs are already converted.")(HERE / "last_run.json").write_text(json.dumps(summary, indent=2) + "\n")returnstarted = time.time()run = api("POST", f"/acts/{ACTOR}/runs", {"urls": todo, "includeChunks": True, "includeText": False})["data"]while run["status"] in ("READY", "RUNNING"):run = api("GET", f"/actor-runs/{run['id']}?waitForFinish=30")["data"]items = api("GET", f"/datasets/{run['defaultDatasetId']}/items?clean=1")OUT.mkdir(exist_ok=True)total_price = START_FEEfor it in items:url, name = it["url"], slug(it["url"])row = {"url": url, "status": it["status"], "pages": it.get("pagesProcessed"), "error": it.get("error")}if it["status"] == "ok":meta = it.get("metadata") or {}front = f"---\nsource: {url}\ntitle: {json.dumps(meta.get('title') or name)}\npages: {it['pagesProcessed']}\nconverted: {summary['ran_at']}\n---\n\n"(OUT / f"{name}.md").write_text(front + it["markdown"] + "\n", encoding="utf-8")(OUT / f"{name}.chunks.json").write_text(json.dumps(it.get("chunks") or [], ensure_ascii=False, indent=1), encoding="utf-8")row.update(file=f"knowledge/{name}.md", chars=len(it["markdown"]), chunks=len(it.get("chunks") or []),tables=(it.get("stats") or {}).get("tableCount"), headings=(it.get("stats") or {}).get("headingCount"),extract_ms=(it.get("stats") or {}).get("processingMs"), list_price_usd=round(list_price(it["pagesProcessed"]), 4))total_price += row["list_price_usd"]else:row["list_price_usd"] = 0.0state[url] = {"status": it["status"], "converted": summary["ran_at"]}summary["items"].append(row)summary.update(run_status=run["status"], wall_seconds=round(time.time() - started, 1),run_seconds=(run.get("stats") or {}).get("runTimeSecs"), list_price_total_usd=round(total_price, 5))STATE.write_text(json.dumps(state, indent=2) + "\n")(HERE / "last_run.json").write_text(json.dumps(summary, indent=2) + "\n")for r in summary["items"]:print(f"{r['status']:8} {str(r.get('pages') or '-'):>4} pages ${r['list_price_usd']:.4f} {r['url']}")print(f"Done in {summary['wall_seconds']} s. List price for this run: ${summary['list_price_total_usd']}")if __name__ == "__main__":main()
Tips
- For RAG, turn on
includeChunksand storepageStartandheadingswith each embedding so answers can cite the page. - For a quick check of a long document, set
pageRangeto1-10. - If a run stops on a very large PDF, give the run more memory or lower
maxPagesPerPdf.
Privacy
PDFs are downloaded into the run's memory, processed, and discarded when the run ends. Only the output you see in the dataset is stored, in your own Apify account. Do not submit confidential documents through public URLs.
About this Actor
This Actor was written and is maintained by an AI agent (Anthropic's Claude) running under the account owner's supervision. Extraction uses the open-source libraries pdfplumber and pdfminer.six. If something comes out wrong, open an issue on the Issues tab with the PDF URL, and it will be looked at.