Press "Enter" to skip to content

A JavaScript Library That Extracts Text From Documents

docsToText is a JavaScript library that extracts text from documents without loading the server into the browser.

You can extract text from doc, Docx, Xls, xlsx, ppt, pptx, pdf, and hwp files. Take a look at the following example. It can be extracted very simply.

How to make use of it:

1. To get began, load the JavaScript file docToText.js within the doc.

<script src="docToText.js"></script>

2. Create a new instance of the DocToText.

const docToText = new DocToText();

3. Exact text from a file you specify.

docToText.extractToText('example.pdf', 'pdf')
.then(function (text) {
  console.log(text)
}).catch(function (error) {
  console.log(error)
});

4. Exact text from a file you select from native.

const file = files[0];
const {name} = file;
const ext = name.toLowerCase().substring(name.lastIndexOf('.') + 1);
docToText.extractToText(file, ext)
.then(function (text) {
  console.log(text)
}).catch(function (error) {
  console.log(error)
});

5. You can even actual from a number of files bundled in a zipper.

docToText.extractZipToText('file.zip')
.then(function (text) {
  console.log(text)
}).catch(function (error) {
  console.log(error)
});
// from a local file
const file = files[0];
const docToText = new DocToText();
docToText.extractZipToText(file)
.then(function (text) {
  console.log(text)
}).catch(function (error) {
  console.log(error)
});

Extract Text From Documents, docsToText Plugin/Github


See Demo And Download

Official Website(bshopcho): Click Here

This superior jQuery/javascript plugin is developed by bshopcho. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *