PDF Processing API for Node.js

Create, edit, protect and convert PDF documents to multiple formats within Node.js applications

Overview

Aspose.PDF is a PDF document generation library for Node.js that makes creating complex, multi-page, printable documents easy.

API is designed to be simple, so generating complex documents has been often as simple as a few function calls. As the name suggests, the library is developed based on program code in C++. This allowed us to make it as fast as possible, and compiling it in WebAssembly made it portable to different operating systems.

Aspose.PDF for Node.js via C++ features

How to Manipulate PDF Files on the Backend with Aspose.PDF for Node.js via C++

Aspose.PDF for Node.js via C++ gives the possibility to manipulate PDF files on the backend. Using Aspose.PDF for Node.js via C++ you can optimize PDF, add and extract text and images, encrypt and decrypt it. You can also split and merge PDF.

Convert PDF

Using Aspose.PDF for Node.js via C++ you can convert PDF to JPG and PNG.

Installation

To install and use Aspose.PDF for Node.js via C++ from a ZIP archive, follow the following instructions:

  • Extract the files from the ZIP archive
  • Encrypt your *.lic file using ’encrypt_lic.html'
  • Edit ‘settings.json’ and setup your settings

Toolkit allows adding:

  • Hyperlink shortcuts to other pages within a PDF document
  • Hyperlinks to pages in other PDF documents
  • Hyperlinks to non-PDF files
  • Hyperlinks to web locations.

Along with hyperlink creation, you also get the capability to extract hyperlinks from a PDF document.

PDF Security Features

API offers 40-bit or 128-bit encryption. One can also set user and master passwords for more security. Content manipulation in files like copying content, printing, degraded printing, annotation modification, form field completion as well as PDF file assembly can all be restricted by using this library

Convert PDF to JPG and Other Image Formats

Aspose.PDF for Node.js via C++ allows you to render and transform each page of a PDF file into conventional image formats such as BMP, JPG and PNG, with the highest possible fidelity. Other than images, one can easily save PDF to DOC and DOCX formats.

Save PDF pages as JPEG images in Node.js

Load an existing PDF document. Convert PDF pages to images and save each page in JPG format.

Convert PDF to JPG via JavaScript/Node.js

const AsposePdf = require('./AsposePDFforNode.js');
const fs = require("fs");
const os = require("os");

const pdf_file = '<Enter your filename>';
const resultdir = fs.realpathSync(os.tmpdir()) + '/';

AsposePdf().then(AsposePdfModule => {
    console.log("Convert from PDF:");
    const json = AsposePdfModule.AsposePdfPagesToJpg(pdf_file, resultdir + "ResultPdfToJpg{0:D2}.jpg", 150);
    console.log("AsposePdfPagesToJpg => %O",  json.errorCode == 0 ? json.filesNameResult : json.errorText);
});