
Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
pdf-to-text-yj
Advanced tools
pdf-to-text-yj 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-yj
You need install the next tools to use this module
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 = require('pdf-to-text');
var pdf_path = "absolute_path/to/pdf_file.pdf";
pdfUtil.info(pdf_path, function(err, info) {
if (err) throw(err);
console.log(info);
});
It's retrieve an object with the data info from the pdf file
{ title: 'some title',
subject: 'TeX output 2003.10.17:1908',
author: 'Fernando Hernandez',
creator: 'creator name',
producer: 'Acrobat Distiller 4.0 for Windows',
creationdate: 1066428670000,
moddate: 1066428687000,
tagged: 'no',
form: 'none',
pages: 8,
encrypted: 'no',
page_size: '612 x 792 pts (letter)',
file_size: '28695 bytes',
optimized: 'yes',
pdf_version: 1.2
}
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 = require('pdf-to-text-yj');
var pdf_path = "absolute_path/to/pdf_file.pdf";
//option to extract text from page 0 to 10
var option = {from: 0, to: 10};
pdfUtil.pdfToText(upload.path, option, function(err, data) {
if (err) throw(err);
console.log(data); //print text
});
//Omit option to extract all text from the pdf file
pdfUtil.pdfToText(upload.path, function(err, data) {
if (err) throw(err);
console.log(data); //print all text
});
======= To test that your system satisfies the needed dependencies and that module is functioning correctly execute the command in the pdf-to-text-yj module folder
cd <project_root>/node_modules/pdf-to-text-yj
npm test
FAQs
Extract the text from pdf files
The npm package pdf-to-text-yj receives a total of 0 weekly downloads. As such, pdf-to-text-yj popularity was classified as not popular.
We found that pdf-to-text-yj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.