All Projects → Fdawgs → node-poppler

Fdawgs / node-poppler

Licence: MIT license
Asynchronous node.js wrapper for the Poppler PDF rendering library

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to node-poppler

py midicsv
A Python port and library-fication of the midicsv tool by John Walker. If you need to convert MIDI files to human-readable text files and back, this is the library for you.
Stars: ✭ 55 (-43.3%)
Mutual labels:  converter, text
Mdpdf
Markdown to PDF command line app with support for stylesheets
Stars: ✭ 512 (+427.84%)
Mutual labels:  converter, pdf-converter
Pdf To Text
Extract text from a pdf
Stars: ✭ 462 (+376.29%)
Mutual labels:  text, pdf-converter
txt
📝 Simple text editor/notepad with cloud sync.
Stars: ✭ 35 (-63.92%)
Mutual labels:  text, txt
Hrconvert2
A self-hosted, drag-and-drop, & nosql file conversion server that supports 62x file formats.
Stars: ✭ 132 (+36.08%)
Mutual labels:  converter, pdf-converter
Node Html To Text
Advanced html to text converter
Stars: ✭ 872 (+798.97%)
Mutual labels:  converter, text
FigmaConvertXib
FigmaConvertXib is a tool for exporting design elements from figma.com and generating files to a projects iOS .xib / Android .xml
Stars: ✭ 111 (+14.43%)
Mutual labels:  converter, text
Handwritten.js
Convert typed text to realistic handwriting!
Stars: ✭ 1,806 (+1761.86%)
Mutual labels:  converter, text
Net Core Docx Html To Pdf Converter
.NET Core library to create custom reports based on Word docx or HTML documents and convert to PDF
Stars: ✭ 133 (+37.11%)
Mutual labels:  converter, pdf-converter
Mybox
Easy tools of document, image, file, network, location, color, and media.
Stars: ✭ 45 (-53.61%)
Mutual labels:  converter, text
Doctron
Docker-powered html convert to pdf(html2pdf), html to image(html2image like jpeg,png),which using chrome(golang) kernel, add watermarks to pdf, convert pdf to images etc.
Stars: ✭ 141 (+45.36%)
Mutual labels:  converter, pdf-converter
node-pdftocairo
📃 Node.js wrapper for pdftocairo - PDF to PNG/JPEG/TIFF/PDF/PS/EPS/SVG using cairo
Stars: ✭ 17 (-82.47%)
Mutual labels:  poppler, pdf-to-image
System.Configuration.Abstractions
Injectable, mockable, extensible, configuration for .NET
Stars: ✭ 42 (-56.7%)
Mutual labels:  converter
rounded background text
Text and TextField highlighted with rounded corners
Stars: ✭ 43 (-55.67%)
Mutual labels:  text
ZPL-Printer-Emulator-SDK
Convert, Preview & Render raw ZPL commands to PNG, JPG & PDF from .NET
Stars: ✭ 29 (-70.1%)
Mutual labels:  converter
api2pdf.php
PHP client library for the Api2Pdf.com REST API - Convert HTML to PDF, URL to PDF, Office Docs to PDF, Merge PDFs, HTML to Image, URL to Image, HTML to Docx, HTML to Xlsx, PDF to HTML, Thumbnail preview of office files
Stars: ✭ 42 (-56.7%)
Mutual labels:  pdf-to-html
SoxSharp
.NET wrapper for SoX.
Stars: ✭ 41 (-57.73%)
Mutual labels:  converter
cape
Continuous Augmented Positional Embeddings (CAPE) implementation for PyTorch
Stars: ✭ 29 (-70.1%)
Mutual labels:  text
clifs
Contrastive Language-Image Forensic Search allows free text searching through videos using OpenAI's machine learning model CLIP
Stars: ✭ 271 (+179.38%)
Mutual labels:  text
dnglab
Camera RAW to DNG file format converter
Stars: ✭ 103 (+6.19%)
Mutual labels:  converter

node-poppler

GitHub Release npm version Build Status Coverage Status code style: prettier

Asynchronous node.js wrapper for the Poppler PDF rendering library

Intro

Poppler is a PDF rendering library that also includes a collection of utility binaries, which allows for the manipulation and extraction of data from PDF documents such as converting PDF files to HTML, TXT, or PostScript.

The node-poppler module provides an asynchronous node.js wrapper around said utility binaries for easier use. It was created out of a need for a PDF-to-HTML conversion module at Yeovil District Hospital NHS Foundation Trust to convert clinical documents.

Installation

Install using npm:

npm i node-poppler

Linux and macOS/Darwin Support

Windows binaries are provided with this repository. For Linux users, you will need to download the poppler-data and poppler-utils binaries separately.

An example of downloading the binaries on a Debian system:

sudo apt-get install poppler-data
sudo apt-get install poppler-utils

For macOS users, you can download the latest versions with Homebrew:

brew install poppler

Once they have been installed, you will need to pass the poppler-utils installation directory as a parameter to an instance of the Poppler class:

const { Poppler } = require("node-poppler");
const poppler = new Poppler("/usr/bin");

API

const { Poppler } = require("node-poppler");

API Documentation can be found here

Examples

poppler.pdfToCairo

Example of an async await call to poppler.pdfToCairo(), to convert only the first and second page of a PDF file to PNG:

const { Poppler } = require("node-poppler");

const file = "test_document.pdf";
const poppler = new Poppler();
const options = {
	firstPageToConvert: 1,
	lastPageToConvert: 2,
	pngFile: true,
};
const outputFile = `test_document.png`;

const res = await poppler.pdfToCairo(file, outputFile, options);
console.log(res);

Example of an async await call to poppler.pdfToCairo(), to convert only the first of a PDF file to a new PDF file using stdout:

const fs = require("fs");
const { Poppler } = require("node-poppler");

const file = "test_document.pdf";
const poppler = new Poppler();
const options = {
	lastPageToConvert: 1,
	pdfFile: true,
};

const res = await poppler.pdfToCairo(file, undefined, options);
// pdfToCairo writes to stdout using binary encoding if pdfFile or singleFile options are used
await fs.writeFile("new_file.pdf", res, { encoding: "binary" });

poppler.pdfToHtml

Example of calling poppler.pdfToHtml() with a promise chain:

const { Poppler } = require("node-poppler");

const file = "test_document.pdf";
const poppler = new Poppler();
const options = {
	firstPageToConvert: 1,
	lastPageToConvert: 2,
};

poppler.pdfToHtml(file, undefined, options).then((res) => {
	console.log(res);
});

Example of calling poppler.pdfToHtml() with a promise chain, providing a Buffer as an input:

const fs = require("fs");
const { Poppler } = require("node-poppler");

const file = fs.readFileSync("test_document.pdf");
const poppler = new Poppler();
const options = {
	firstPageToConvert: 1,
	lastPageToConvert: 2,
};

poppler.pdfToHtml(file, "tester.html", options).then((res) => {
	console.log(res);
});

poppler.pdfToText

Example of calling poppler.pdfToText() with a promise chain:

const { Poppler } = require("node-poppler");

const file = "test_document.pdf";
const poppler = new Poppler();
const options = {
	firstPageToConvert: 1,
	lastPageToConvert: 2,
};

poppler.pdfToText(file, options).then((res) => {
	console.log(res);
});

Contributing

Contributions are welcome, and any help is greatly appreciated!

See the contributing guide for details on how to get started. Please adhere to this project's Code of Conduct when contributing.

Acknowledgements

License

node-poppler is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].