An open API service indexing awesome lists of open source software.

https://github.com/fasatrix/pdf-to-text

A PDF to Text Extractor
https://github.com/fasatrix/pdf-to-text

Last synced: over 1 year ago
JSON representation

A PDF to Text Extractor

Awesome Lists containing this project

README

          

# PDF-TO-TEXT
A pdf to text wrapper to extract text from a pdf. It works with searchable and non-searchable(images) PDFs

![PDF CI](https://github.com/fasatrix/pdf-to-text/actions/workflows/pdfToText.yaml/badge.svg)

### Installation
`npm install text-from-pdf`

### Mac Users
`brew install poppler`

### Linux Users
`sudo apt-get update && sudo apt-get install poppler-utils`

### Windows Users
`No installation required`

### Usage
1) Standard Input PDF with horizontally aligned text:
```js
const text = await pdfToText('');
console.log(text)
```
2) Input PDF's with vertically aligned text:
```js
const options = {
rotationDegree: -90,
};
$ const text = await pdfToText('', options);
$ console.log(text)
```
3) Text from first and second page:
```js
const options = {
firstPageToConvert: 1,
lastPageToConvert: 2,
};
$ const text = await pdfToText('', options);
$ console.log(text)
```
4) Text from third to fifth page:
```js
const options = {
firstPageToConvert: 3,
lastPageToConvert: 5,
};
$ const text = await pdfToText('', options);
$ console.log(text)
```
4) Enable Progressbar logging:
```js
const options = {
firstPageToConvert: 1,
lastPageToConvert: 1,
enableProgressBarLogging: true
};
$ const text = await pdfToText('', options);
$ console.log(text)
```

## Features request
Fork, add your changes and create a pull request