GithubHelp home page GithubHelp logo

nodejs-pdftables-api's Introduction

node.js PDFTables.com API example

This uses the request module to simplify HTTP access.

It uploads a file called example.pdf and saves the output as a single Excel spreadsheet called output.xlsx.

Replace YOUR_API_KEY in the URL variable of the source with an API key that you've obtained from the PDFTables.com API page.

nodejs-pdftables-api's People

Contributors

stevenmaude avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

vantyse vevedh

nodejs-pdftables-api's Issues

Error: ENOENT: no such file or directory

I am aware that this error means "Cannot find file," howevever, I have this code copy and pasted, with an almost identical file scheme, and it works in one project and not the other.
The code I have is as follows...

var req = request.post({encoding: null, url: 'https://pdftables.com/api?key=770oukvvx1wl&format=xlsx-single'}, function (err, resp, body) {
 if (!err && resp.statusCode == 200) {
   fs.writeFile("output.xlsx", body, function(err) {
     if (err) {
       console.log('error writing file');
     }
   });
 } else {
   console.log('error retrieving URL');
   console.log(err)
   console.log(resp.statusCode)
 };
});

var form = req.form();
form.append('file', fs.createReadStream('./TOM_Sample_ScoreCard.pdf'));

Given that this is being run from a file in the same directory as the pdf, TOM_Sample_ScoreCard.pdf I don't see why I am getting this error.

UPDATE:
I moved both this file as well as the pdf further towards the outside of the directory tree, and it sent back the appropriate response... I am unsure how exactly the file organization effected this but hopefully this helps someone else

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.