How to PDF text search API in JavaScript and Web API

The tutorial shows how to PDF text search API in JavaScript

The coding tutorials are designed to help you test the features without need to write your own code. Web API can PDF text search API. It can be used from JavaScript. Web API is the flexible Web API that includes full set of functions from e-signature requests to data extraction, OCR, images recognition, pdf splitting and pdf splitting. Can also generate barcodes and read barcodes from images, scans and pdf.

You will save a lot of time on writing and testing code as you may just take the JavaScript code from Web API for PDF text search API below and use it in your application. This JavaScript sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Further enhancement of the code will make it more vigorous.

Free trial version of Web API is available on our website. Documentation and source code samples are included.

Try Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

// `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 const API_KEY = "***********************************"; // Direct URL of source PDF file. const SourceFileUrl = ""; // Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'. const Pages = ""; // PDF document password. Leave empty for unprotected documents. const Password = ""; // Search string. const SearchString = '[4-9][0-9].[0-9][0-9]'; // Regular expression to find numbers in format dd.dd and between 40.00 to 99.99 // Enable regular expressions (Regex) const RegexSearch = 'True'; // Prepare URL for PDF text search API call. // See documentation: var query = ``; let reqOptions = { uri: query, headers: { "x-api-key": API_KEY }, formData: { password: Password, pages: Pages, url: SourceFileUrl, searchString: SearchString, regexSearch: RegexSearch } }; // Send request request.get(reqOptions, function (error, response, body) { if (error) { return console.error("Error: ", error); } // Parse JSON response let data = JSON.parse(body); for (let index = 0; index < data.body.length; index++) { const element = data.body[index]; console.log("Found text " + element["text"] + " at coordinates " + element["left"] + ", " + element["top"]); } });

Try Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)



Get 60 Day Free Trial or Visit Web API Home Page

Explore Web API Documentation

Get Web API Free Training


Get Your Free API Key

Explore Web API Documentation

Related Samples: