npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

afpp

v2.1.6

Published

another f*cking pdf parser

Readme

afpp

Version GitHub Actions Workflow Status codecov Node npm Downloads Repo Size Last Commit License

Another f*cking PDF parser. Because parsing PDFs in Node.js should be easy. Live long and parse PDFs. 🖖

Why?

There are plenty of PDF-related packages for Node.js. They work… until they don’t.

Afpp was built to solve the headaches I ran into while trying to parse PDFs in Node.js:

  • 📦 Do I need a package with 30+ MB just to read a PDF?
  • 🧵 Why is the event loop blocked?
  • 🐏 Is that a memory leak I smell?
  • 🐌 Should reading a PDF really be this performance-heavy?
  • 🐞 Why is everything so buggy?
  • 🎨 Why does it complain about the lack of a canvas in Node.js?
  • 🧱 Why does canvas require native C++/Python dependencies to build?
  • 🪟 Why does it complain about the missing window object?
  • 🪄 Why do I need ImageMagick for this?!
  • 👻 What the hell is Ghostscript, and why does it keep failing?
  • ❌ Where’s the TypeScript support?
  • 🧓 Why are the dependencies older than my dev career?
  • 🔐 Why does everything work… until I try an encrypted PDF?
  • 🕯️ Why does every OS need its own special setup ritual?

Prerequisites

  • Node.js >= v22.14.0

📦 Installation

You can install afpp via npm, Yarn, or pnpm.

npm

npm install afpp

Yarn

yarn add afpp

pnpm

pnpm add afpp

Getting started

The afpp library makes it simple to extract text or images from PDF files in Node.js. Whether your PDF is stored locally, hosted online, or encrypted, afpp provides an easy-to-use API to handle it all. All functions have common parameters and accepts string path, buffer, or URL object.

Get text from path

import { readFile } from 'fs/promises';
import path from 'path';

import { pdf2string } from 'afpp';

(async function main() {
  const pathToFile = path.join('..', 'test', 'example.pdf');
  const input = await readFile(pathToFile);
  const data = await pdf2string(input);

  console.log('Extracted text:', data); // ['page 1 content', 'page 2 content', ...]
})();

Get image from URL

import { pdf2image } from 'afpp';

(async function main() {
  const url = new URL('https://pdfobject.com/pdf/sample.pdf');
  const arrayOfImages = await pdf2image(url);

  console.log(arrayOfImages); // [imageBuffer, imageBuffer, ...]
})();

Parse pdf buffer

import { parsePdf } from 'afpp';

(async function main() {
  // Download PDF from URL
  const response = await fetch('https://pdfobject.com/pdf/sample.pdf');
  const buffer = Buffer.from(await response.arrayBuffer());

  // Parse the PDF buffer
  const result = await parsePdf(buffer, {}, (content) => content);
  console.log('Parsed PDF:', result);
})();

Interface: AfppParseOptions

Common properties of all afpp functions. Example usage

const result = await parsePdf(buffer, {
  concurrency: 5,
  imageEncoding: 'jpeg',
  password: 'STRONG_PASS',
  scale: 4,
});

Properties

concurrency?

optional concurrency: number

Concurrency level for page processing. Defaults to 1. Higher values may improve performance but increase memory usage.

Default

1;

imageEncoding?

optional imageEncoding: ImageEncoding

Image encoding format when rendering non-text pages. Defaults to 'png'. Supported formats: 'avif', 'jpeg', 'png', 'webp'.

Default

'png';

password?

optional password: string

Password for encrypted pdf files.


scale?

optional scale: number

Scale of a page if content is not text (or pdf2image is used). Defaults to 2.0. Higher values increase image resolution but also memory usage.

Default

2.0;

License

This project is licensed under the terms of the MIT License.