Free plan

Document Text

Get the plain text out of a document
POST
/v1/documents/text

About this tool

This tool pulls the words out of a document, such as PDF, Word, Excel or PowerPoint, and gives you only the text. You can get plain text, Markdown (text with simple marks for headings and lists) or a structured view. If your Office file is locked, type its password. A scanned PDF with no real text will give little or nothing.
For example, you copy the words of a Word report into an e-mail or another program.

How to use it

  1. Choose this tool.
  2. Add your document with Upload or drag and drop.
  3. Choose plain text, Markdown or structured.
  4. Press Generate.
  5. Copy the text or download it.

What you get back

You get the text on screen to copy, or as a file to download.
GOOD TO KNOW
Scanned PDFs have no text layer: use /v1/pdfs/ocr first. With output=url the text comes back as a file (txt, md or json), and response, filename and filename_template deliver and name it like any other file; with output=inline (the default) there is no file, so those three parameters are accepted and change nothing.
TEST IT LIVE

Try Document Text in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/text
Tool ID
documents.text
Authentication
API key
Accepts
PDF, DOCX, XLSX, PPTX, ODT, ODS +25 more
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/text" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'format=txt' \
  -F 'output=inline' \
  -F 'response=url'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.text({
    "file": 'document.pdf',
    "format": "txt",
    "output": "inline",
    "response": "url"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->text([
    'file' => 'document.pdf',
    'format' => 'txt',
    'output' => 'inline',
    'response' => 'url',
]);
echo $result->requestId;
FAQ

Frequently asked questions

The text of any supported document as plain text, Markdown or a structured JSON view (headings, paragraphs, lists, tables; pages for PDFs and presentations).

Document Text accepts PDF, DOCX, XLSX, PPTX, ODT, ODS, ODP, RTF, EPUB, TXT, MD, HTML and 19 more. You can send several files in one request.

Document Text is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/text with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.