pdf-to-text is a tool to extract text from pdf. for the moment not support ocr scannig to extract text only works for searchable pdf files. This package doesn't have nodejs dependencies.
To install the module.
npm install pdf-to-text
You need install the next tools to use this module
- pdftotext is used to extract text out of searchable pdf documents
- pdfinfo is used to obtain the info of pdf documents
To begin on OSX, first make sure you have the homebrew package manager installed.
pdftotext is included as part on the xpdf utilities library. xpdf can be installed via homebrew
brew install xpdf
pdftotext is included in the poppler-utils library. To installer poppler-utils execute
apt-get install poppler-utils
Obtain info from pdf file
var pdfUtil = ;var pdf_path = "absolute_path/to/pdf_file.pdf";pdfUtil;
It's retrieve an object with the data info from the pdf file
PDF Text extract
You can extract text by a range of pages given an option object with from and to properties, or simply omit this option to extract all text from the pdf file
var pdfUtil = ;var pdf_path = "absolute_path/to/pdf_file.pdf";//option to extract text from page 0 to 10var option = from: 0 to: 10;pdfUtil;//Omit option to extract all text from the pdf filepdfUtil;
======= To test that your system satisfies the needed dependencies and that module is functioning correctly execute the command in the pdf-to-text module folder
cd <project_root>/node_modules/pdf-to-text npm test