npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pdf-to-raw

v0.0.1

Published

Fork from https://github.com/zetahernandez/pdf-to-raw changing from layout to raw

Downloads

4

Readme

PDF-TO-RAW

pdf-to-raw 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.

Installation

======= To install the module. npm install pdf-to-raw

You need install the next tools to use this module

  • pdftotext
    • pdftotext is used to extract text out of searchable pdf documents
  • pdfinfo
    • pdfinfo is used to obtain the info of pdf documents

OSX

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

Ubuntu

pdftotext is included in the poppler-utils library. To installer poppler-utils execute

apt-get install poppler-utils

Usage

=======

PDF Info

Obtain info from pdf file

var pdfUtil = require('pdf-to-raw');
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 
  }

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 = require('pdf-to-raw');
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.pdfToRaw(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.pdfToRaw(upload.path, function(err, data) {
  if (err) throw(err);
  console.log(data); //print all text    
});

Tests

======= To test that your system satisfies the needed dependencies and that module is functioning correctly execute the command in the pdf-to-raw module folder

cd <project_root>/node_modules/pdf-to-raw
npm test