Docs/Skills/PDF to Text

PDF to Text

Extract the text from a PDF

OperationalCredits 10 per callp50 1074msDocuments

Overview

Extraction runs on unpdf, a serverless build of Mozilla's pdf.js. For each page the text items are joined in the order pdf.js reports them: an item that ends a line adds a line break, and otherwise a space is added unless the item already ends in whitespace. Runs of spaces are collapsed, spaces before a line break are removed and the page text is trimmed. This is the content order stored in the file, which for most documents is reading order but can interleave columns in some layouts.

Send the file as a multipart upload or base64 in `pdf`, or a public URL in `pdf` or `url`. The file must carry a `%PDF-` header in its first kilobyte. Files over 10 MB return 413, a password-protected PDF returns 400 asking for the password to be removed, and a file pdf.js cannot open returns 400.

Only the first 100 pages are read. `pageCount` is the full count from the file, `pagesExtracted` the number read, and `truncated` is true when they differ. `text` joins the pages with a blank line and is trimmed; `characterCount` is its length and `wordCount` sums each page's count of whitespace-separated tokens. `hasText` is false when the joined text is empty, which is what a scanned PDF with no text layer produces.

On paid plans `pages` holds `{page, text, wordCount}` for each page read, and `metadata` comes from the PDF's information dictionary, with null for any missing entry. PDF dates such as `D:20240115103000+01'00'` are converted to ISO 8601 in UTC, and `pdfVersion` is the format version, such as 1.7. On the Free plan `pages` and `metadata` are null.

Live Test PDF to Text Skill →

The tool

Once your client is connected to the VerveKit server, this appears in its tool list as PDFtoText. It is read-only and open-world — it fetches and never mutates anything on your side — so most clients call it without asking you to confirm.

Tool call
{
  "name": "PDFtoText",
  "arguments": {}
}

Connecting

One server URL covers every skill in the catalog, including this one. Authorization is OAuth: the client opens a browser once, and there is no key to paste into a config file.

{
  "mcpServers": {
    "vervekit": {
      "url": "https://api.vervekit.com/v1/mcp"
    }
  }
}

Per-client setup — Claude, Cursor, VS Code, ChatGPT — is on the MCP setup page.

Arguments

These are the properties on the tool's inputSchema, so a well-behaved client validates them before the call is made. Premium arguments are accepted on every plan but only take effect on plans that include them.

ArgumentTypeDescription
pdfOptionalstringThe PDF file to read (up to 10 MB), or a public PDF URL

What the model gets back

The result carries a structuredContent object matching the tool's declared outputSchema, so a client reads fields without parsing prose. status is "ok" and error is null on success; a null field means the value was not available for that input, not that the call failed.

Result
{
  "status": "ok",
  "error": null,
  "data": {
    "text": "Table Of Content\nChapter 1 .......................................................... 2\nParagraph 1.1 ...................................................... 3\npage 1 / 3\n\nChapter 1\npage 2 / 3\n\nParagraph 1.1\nPowered by TCPDF (www.tcpdf.org)\npage 3 / 3",
    "pageCount": 3,
    "pagesExtracted": 3,
    "truncated": false,
    "hasText": true,
    "wordCount": 31,
    "characterCount": 250,
    "pages": [
      {
        "page": 1,
        "text": "Table Of Content\nChapter 1 .......................................................... 2\nParagraph 1.1 ...................................................... 3\npage 1 / 3",
        "wordCount": 15
      },
      {
        "page": 2,
        "text": "Chapter 1\npage 2 / 3",
        "wordCount": 6
      },
      {
        "page": 3,
        "text": "Paragraph 1.1\nPowered by TCPDF (www.tcpdf.org)\npage 3 / 3",
        "wordCount": 10
      }
    ],
    "metadata": {
      "title": "Basic API Test",
      "author": "Brendan Dahl",
      "subject": null,
      "creator": "pdf.js",
      "producer": "TCPDF 5.9.133 (http://www.tcpdf.org)",
      "creationDate": "2012-04-10T21:30:26.000Z",
      "modificationDate": "2012-04-10T21:30:26.000Z",
      "pdfVersion": "1.7"
    }
  }
}

Response fields

Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.

FieldTypeExampleDescription
textstringTable Of Content Chapter 1 .......................................................... 2 Paragraph 1.…The extracted text, pages separated by a blank line
pageCountnumber3Total pages in the PDF
pagesExtractednumber3Pages read (at most 100)
truncatedbooleanfalseTrue when the PDF has more pages than were read
hasTextbooleantrueFalse when no text layer was found, as in a scanned PDF
wordCountnumber31Words in the extracted text
characterCountnumber250Characters in the extracted text
pagesPremiumarray[3]The text of each page read
pages.0.pagePremiumnumber1Page number
pages.0.textPremiumstringTable Of Content Chapter 1 .......................................................... 2 Paragraph 1.…Text of the page
pages.0.wordCountPremiumnumber15Words on the page
metadataPremiumobject{…}Document information from the PDF
metadata.titlePremiumstringBasic API TestDocument title, or null
metadata.authorPremiumstringBrendan DahlAuthor, or null
metadata.subjectPremiumobjectnullSubject, or null
metadata.creatorPremiumstringpdf.jsApplication that created the original document, or null
metadata.producerPremiumstringTCPDF 5.9.133 (http://www.tcpdf.org)Application that produced the PDF, or null
metadata.creationDatePremiumstring2012-04-10T21:30:26.000ZCreation date (ISO 8601), or null
metadata.modificationDatePremiumstring2012-04-10T21:30:26.000ZLast modification date (ISO 8601), or null
metadata.pdfVersionPremiumstring1.7PDF format version, such as 1.7

Failure modes

Errors come back as tool errors carrying a sentence the model can act on, not a bare status code. Error handling covers the full list.

StatusWhat it means
400 / 422The arguments did not validate. The message names the offending one.
401The OAuth session is invalid or expired — reconnect the server.
403Blocked by a key restriction or an IP allow-list. Never a bad identity.
404This skill is not part of VerveKit. Check the catalog.
429Out of credits, or a brief rate limit. The message tells them apart.

A call costs 10 credits each time the tool actually runs; a model that reasons about the tool without calling it costs nothing.

Use cases

Search Indexing
Index the text of uploaded PDFs so users can search inside documents, not just their titles.
AI and RAG Pipelines
Feed PDF text, page by page, into embeddings or a language model for question answering over documents.
Document Intake
Read invoices, statements and forms as text for downstream parsing and validation.
Content Moderation
Check the text of uploaded PDFs against your policies before they are published.

Other ways to use PDF to Text

Set up PDF to Text on VerveKit, or reach the same source a different way. Your VerveKit account and credits work on all of them — one key, one balance.

Call it as a REST APIOne HTTPS endpoint and an x-api-key header, with SDKs for Node, Python and .NET.APIVerve →Reference →

More in Documents:

Was this page helpful?