Extract PDF using JavaScript

How to extract text and images from PDF using Aspose.PDF for Node.js via C++ library

The most popular action with a Parser

How to parse PDF with Aspose.PDF for Node.js via C++ Library

Do you need to parse PDF? The Aspose.PDF for Node.js via C++ helps extract text or images from PDF documents. To perform the extraction, we’ll use Aspose.PDF for Node.js via C++, which is an easy and secure toolkit used to work with PDF. To install and use Aspose.PDF for Node.js via C++, extract files from the ZIP archive.

Parse PDF using JavaScript


You need Aspose.PDF for Node.js via C++ to try the code in your environment.

  1. Load the PDF with an instance of Document.
  2. Create a TextAbsorber object to extract text.
  3. Accept the absorber for all the pages.
  4. Get the extracted text
  5. Create a writer and open the file, write a line of text to the file

Extract PDF Files - JavaScript

This sample code shows how to extract PDF documents

Input file:

File not added

Output format:

PDF

Output file:

const AsposePdf = require('../AsposePDFforNode.js');
const pdf_file = '../ReadMe.pdf';
AsposePdf().then(AsposePdfModule => {
    /*Extract text from a PDF-file*/
    const json = AsposePdfModule.AsposePdfExtractText(pdf_file);
    console.log("AsposePdfExtractText => %O", json.errorCode == 0 ? json.extractText : json.errorText);
});

About Aspose.PDF for Node.js via C++ API

Aspose.PDF for Node.js via C++ allows developers manipulate them PDF files. This JavaScript Solution is built on the use of WebAssembly technology and is based on Aspose.PDF for C++. You can easily use Aspose.Pdf for Node.js via C++ from and then follow the installation instructions. The Aspose.PDF for Node.js supports a wide variety of functions such as:

  • Optimize PDF document.
  • Add a stamp to PDF file.
  • Merge PDF files.
  • Split PDF to two files.
  • Convert PDF to DOCX, XLSX, JPEG, PNG, TIFF, BMP, SVG, SVG(ZIP), XPS, TXT, and etc.

You can find more information about Aspose.PDF for Node.js via C++ API on our documentation on how to use API.