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

pdfdata

v0.2.7

Published

node.js client library for PDFDATA.io (PDF data extraction as-a-service)

Downloads

9

Readme

pdfdata-node

A node.js client library for PDFDATA.io, the API for PDF data extraction.

PDFDATA.io is designed to be incredibly easy to use while providing impeccable PDF data extraction quality over a range of configurable extraction targets (text, forms, metadata, images, tables, and more all the time). While PDFDATA.io's API is itself an approachable HTTP+JSON affair, pdfdata-node provides an idiomatic, promise-based JavaScript library that any node.js developer can have up and running in less than a minute.

For detailed documentation and extensive examples, head over to our API docs.

Quick Start

Installation

$ npm install pdfdata

Usage

You will need a PDFDATA.io API key to use this library. (If you don't have one already, you can get one free by registering.)

Credentials

First, you'll need to plug in your PDFDATA.io API key; there are two ways you can do this. Either provide it as a constructor argument to the result of requiring the pdfdata module:

var pdfdata = require("pdfdata")("test_YOUR_API_KEY_HERE");

Or, you can set the PDFDATA_APIKEY environment variable appropriately for your operating system, e.g.:

export PDFDATA_APIKEY=test_YOUR_API_KEY_HERE

and then omit the extra argument when requiring pdfdata:

var pdfdata = require("pdfdata")();

Running a proc (data extraction process)

Assuming you have a PDF document test.pdf in your current directory which contains text you'd like to extract:

pdfdata.procs.configure()
    .operation({op:"text"})
    .withFiles(["test.pdf"])
    .start()
    .then(console.log);

This will yield something like this:

{ type: 'proc',
  id: 'proc_156870e759a',
  created: '2016-08-14T03:18:07Z',
  source_tags: [],
  operations: [ { op: 'text' } ],
  documents: 
   [ { type: 'doc',
       id: 'doc_8e96ec0533ac3e1e988b7d1ca27bfdc096b82ddc',
       filename: 'document.pdf',
       tags: [ 'acquired:2016-08-08', 'acquired:2016-08-14' ],
       created: '2016-08-08T19:35:16Z',
       expires: '2016-09-13T03:18:07Z',
       results: 
        [ { op: 'text',
            data: 
            [ { text: '\n                              Center        for    Bioinformatics                &\n                                     Molecular           Biostatistics\n                                   (University   of California, San  Francisco)\n\n                            Year 2005                                                     Paper dlbcl\n\n\n\n\n\n                          Microarray        Gene     Expression       Data     with\n                            Linked      Survival     Phenotypes:...' } ]
          } ] } ] }

There are many different data extraction operations available; unstructured text as is shown above, as well as access to bitmap image data, metadata, and structured data options like forms, and custom named-region page template extractions.

Learn more

Seriously, please check out our API documentation, which includes a tonne of examples, descriptions of all of the data extraction operations PDFDATA.io offers, and details about important things like data retention policies, usage limits, and so on.

Questions? We're on Twitter @pdfdataio, or you can contact us otherwise.

Testing

(This is only relevant if you are modifying / contributing to pdfdata-node.)

Set your environment, e.g.:

export PDFDATA_APIKEY=<YOUR API KEY>
export PDFDATA_ENDPOINT=https://localhost:8081/v1

PDFDATA_ENDPOINT defaults to https://api.pdfdata.io/v1.

Run the tests via npm test, or node_modules/mocha/bin/mocha --watch if you want to watch for changes while developing.

License

MIT.