Last checked

How to extract the text from a batch of PDF links

This guide uses a tool we built and publish ourselves: Lepidata’s PDF Text Extractor (No OCR) Actor on Apify. It’s paid per result, at $0.80 per 1,000 PDFs ($0.0008 each), with no Lepidata start fee and the same price on every Apify plan. Status rows such as no-text-layer and error are free. You can also do this yourself: download each file and run poppler’s free pdftotext command on it, which is what the Actor does under the hood.

Use it only on PDFs you have the right to process. The tool reads text that’s already in the PDF. It does no OCR, so scanned pages come back empty; for those, use our PDF OCR tool.

Who this is for

Analysts, researchers, legal and compliance teams and developers who have a list of links to reports, filings, manuals or papers and need the words, not the files. Typical uses: building a search index, feeding documents to a summariser or an AI pipeline, or counting how often a term appears across a set of annual reports.

Why not open them one by one

Opening fifty PDFs and copying the text is slow, and copy and paste from a PDF mangles columns and line breaks. Running pdftotext yourself works well, but you have to download every file, handle the ones that fail, and notice the ones that come back empty because they’re scans.

The Actor downloads each link once, extracts the text, and gives you one row per PDF with the page count, title and word count next to it. Files that fail or have no text get a free row saying why, so nothing silently goes missing.

In short

  1. Collect direct links to the PDF files.
  2. Put them in pdfUrls, up to 1,000.
  3. Turn on splitPages if you want text per page, and keepLayout if you need columns kept.
  4. Run and export.
  5. Check truncatedAtPages and send any no-text-layer rows to OCR.

Step by step

1. Collect direct PDF links. The link has to return the PDF itself, not a web page that shows it. The tool doesn’t crawl or follow links, apart from up to 5 HTTP redirects.

2. Run it. Open the Actor on Apify and switch the input to JSON. The Actor’s prefilled example.com links are placeholders: each returns a free example row and nothing is fetched. Replace them with your own:

{
  "pdfUrls": ["https://www.irs.gov/pub/irs-pdf/p17.pdf"]
}

When we ran this on 28 October 2026, IRS Publication 17 came back as one row with all 142 pages of text.

3. Choose the text shape. By default each row has one text field in reading order, which suits search and AI tools. Turn on splitPages to get pageTexts, one string per page, if you need to cite page numbers. Turn on keepLayout to keep columns and table spacing; the output is bigger, but tables stay readable.

{
  "pdfUrls": [
    "https://www.irs.gov/pub/irs-pdf/p17.pdf",
    "https://example.org/reports/annual-report-2025.pdf"
  ],
  "splitPages": true,
  "keepLayout": false
}

4. Export. Download the dataset as JSON for a pipeline, or CSV if you want a quick look in a spreadsheet. maxResults stops the run after that many extracted PDFs.

5. Check the flags. Look at truncatedAtPages (see the limits below), and collect any no-text-layer rows: those are most likely scans and need OCR.

What you get back

One row per PDF:

url, finalUrl, fileBytes, pages, pagesRead, truncatedAtPages, title, pdfVersion, charCount, wordCount, truncated, extractedTextBytes, and text or pageTexts

pages is the file’s full page count. pagesRead is how many were actually read.

Free rows, never charged:

  • protected: the PDF is encrypted or password-protected. It’s skipped, never decrypted.
  • no-text-layer: no text found, probably a scanned PDF. Try the PDF OCR tool.
  • error: the link failed. Reasons include robots.txt disallowing it, HTTP 401, 403 or 404, a login, cookie or paywall page instead of a PDF, a file over 50 MB, or an unreadable PDF. Failed links are not retried.
  • invalid-input, free-plan-limit and charge-limit-reached.

Limits worth knowing

  • Only the first 200 pages of each PDF are read. A longer file still returns one row, with the text of pages 1 to 200, pagesRead: 200 and truncatedAtPages: 200. Pages after 200 are not extracted. When we ran the 940-page Census Statistical Abstract, we got pages 1 to 200 and the flag.
  • Text longer than 1,000,000 characters is cut off and flagged truncated. That’s separate from the page cap.
  • robots.txt is respected. The tool checks each site’s robots.txt first. If robots.txt disallows the file, or can’t be read, the file is not fetched.
  • No logins. No cookies, no passwords and no paywall access. A 401, 403 or paywall page is a free error row and is never retried. Encrypted PDFs are skipped, with no decryption and no DRM bypass.
  • No OCR. Scanned PDFs return a free no-text-layer row; use the PDF OCR tool for those.
  • Files up to 50 MB, and up to 5 minutes of extraction per file. A file that hits the time limit is a free error row. Runs default to 1 GB of memory.
  • Each file is held only while its text is extracted, then deleted.
  • Apify Free-plan accounts get up to 100 results per run.

FAQ

Why is the text empty for some files? They’re most likely scans: the pages are pictures of text, not text. You get a free no-text-layer row. Run those links through the PDF OCR tool instead.

Can it read PDFs behind a login? No. The tool never logs in or sends cookies. A login, 403 or paywall page comes back as a free error row.

What happens with a 500-page PDF? You get the text of the first 200 pages in one row, flagged truncatedAtPages: 200, and pages tells you the full count. You pay the normal price for that one PDF.

Why was a link skipped with a robots.txt error? The site’s robots.txt disallows that file, or couldn’t be read. The tool respects that and doesn’t fetch it.

What does a run cost? You pay per extracted PDF, at the price shown above, and nothing for status rows. 500 PDFs is $0.40. Set maxResults or a maximum charge per run to cap it.

Can it find PDFs on a site for me? No. It only fetches the links you supply and doesn’t crawl.

Written with AI assistance and checked by the Lepidata team.