How to get invoice info from file (node for invoice parser API in JavaScript with PDF.co Web API

Learn to write code get invoice info from file (node for invoice parser API in JavaScript: Simple How To Tutorial

Writing of the code to get invoice info from file (node in JavaScript can be done by developers of any level using PDF.co Web API. PDF.co Web API was designed to assist invoice parser API in JavaScript. PDF.co Web API is the Web API with a set of tools for documents manipulation, data conversion, data extraction, splitting and merging of documents. Includes image recognition, built-in OCR, barcode generation and barcode decoders to decode bar codes from scans, pictures and pdf.

This simple and easy to understand sample source code in JavaScript for PDF.co Web API contains different functions and options you should do calling the API to implement invoice parser API. Open your JavaScript project and simply copy & paste the code and then run your app! You can use these JavaScript sample examples in one or many applications.

Our website provides free trial version of PDF.co Web API that gives source code samples to assist with your JavaScript project.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

GetInvoiceInfoFromFile.js
      
/*jshint esversion: 6 */ var fs = require("fs"); // `request` module is required for file upload. // Use "npm install request" command to install. var request = require("request"); // The authentication key (API Key). // Get your own by registering at https://app.pdf.co/documentation/api const API_KEY = "***********************************"; // Source PDF file to get information const SourceFile = "./sample.pdf"; // Prepare URL for `Invoice Parser` API call var query = `https://api.pdf.co/v1/pdf/invoiceparser?inline=True`; let reqOptions = { uri: query, headers: { "x-api-key": API_KEY }, formData: { file: fs.createReadStream(SourceFile) } }; // Send request request.post(reqOptions, function (error, response, body) { if (error) { return console.error("Error: ", error); } // Parse JSON response let data = JSON.parse(body); if (data.error == false) { // Display PDF document information for (var key in data.body) { console.log(`${key}: ${data.info[key]}`); } } else { // Service reported error console.log("Error: " + data.message); } });

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit PDF.co Web API Home Page

Explore PDF.co Web API Documentation

Explore Samples

Sign Up for PDF.co Web API Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit PDF.co Web API Home Page

Explore PDF.co Web API Documentation

Explore Samples

Sign Up for PDF.co Web API Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Related Samples: