Superface

Convert document to text

file-conversion/doc-to-text@1.0.0
1 provider

Convert Document to Text

Convert documents in various formats (pdf, doc, rtf) to plain text.

Input
File Name
Content
Result
Text

1.Choose a provider

2.Use ConvertDocumentToText with mock in your code

Below instructions are for our Node.js SDK. Use OneService for other languages.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('file-conversion/doc-to-text@1.0.0');

  // Use the profile
  const result = await profile
    .getUseCase('ConvertDocumentToText')
    .perform({
      fileName: 'big-bang.pdf',
      content: '<BinaryData>'
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

fileName
File name of the document
content
Binary content of the document

Example

{
  "fileName": "big-bang.pdf",
  "content": "<BinaryData>"
}

Result (object)

text
The document contents as plain text.

Example

{
  "text": "The Big Bang event is a physical theory that describes how the universe expanded from an initial state of high density and temperature. Various cosmological models of the Big Bang explain the evolution of the observable universe from the earliest known periods through its subsequent large-scale form."
}

Implementation details

Provider
mock
Use case
ConvertDocumentToText
Author
@superface
Source
Verified