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 🙏

© 2024 – Pkg Stats / Ryan Hefner

libpdf

v0.2.1

Published

LibPdf is a fast and efficient Node.js library for converting PDF files to text. Designed for simplicity and ease of use, LibPdf allows developers to quickly extract text content from PDFs, making it ideal for various applications such as data extraction,

Downloads

12

Readme

LibPdf

LibPdf is a fast and efficient Node.js library for converting PDF files to text. This open-source project aims to simplify the process of extracting text content from PDFs, making it easier for developers to work with PDF data in their applications.

Features

  • Fast PDF to text conversion
  • Easy-to-use API

Installing libpdf

To install libpdf and its dependencies, ensure you have a supported version of Node installed. You can install the project with npm. In the project directory, run:

$ npm install libpdf --save

This command fully installs the project, including installing any dependencies.

Building libpdf

To build libpdf, you need to have Rust installed. If you have already installed the project and only want to run the build, use:

$ npm run build

Exploring libpdf

After building libpdf, you can explore its exports at the Node REPL.

Using Node Shell

  1. Install libpdf:

    $ npm install libpdf --save
  2. Open Node REPL:

    $ node
  3. Execute the following commands:

    > const pdfFile = require("fs").readFileSync("doc.pdf")
    > const doc = require("libpdf").document(pdfFile);
    > console.log(doc);

Using a JavaScript file

  1. Create a file named index.ts with the following content:

    const pdfFile = require('fs').readFileSync("doc.pdf");
    const doc = require('libpdf').document(pdfFile);
    console.log(doc);
  2. Run the file with Node:

    $ node index.ts

This setup ensures you can easily install, build, and explore the capabilities of libpdf.

Benchmark Result

Benchmarking PDF Libraries.png

conclusion

  1. Best for Small and Medium PDFs: libPdf consistently performs the fastest for small and medium PDF files, showing significant speed advantages over pdf-lib and pdf-parse.

  2. Balanced Performance: pdf-parse offers a middle-ground performance across all file sizes but is generally slower than libPdf for smaller files and pdf-lib for medium files.

  3. Inefficiency with Complex PDFs: libPdf shows a notable drop in performance with complex PDFs, taking significantly longer compared to pdf-parse and pdf-lib.

  4. Library Efficiency: pdf-lib excels with small and medium PDFs but struggles significantly with large and complex documents, making it less suitable for those cases.

Future Steps (TODO)

  • [x] Run Benchmark
  • [ ] Add support for extracting text from specific pages
  • [ ] Improve text extraction accuracy for complex PDFs
  • [ ] Implement batch processing for multiple PDFs
  • [ ] Add CLI support for direct command-line usage
  • [ ] Create detailed documentation and examples

Known issues

  • Not supported for Identity-H encoding

Contributing

We welcome contributions to improve LibPdf! Feel free to submit issues and pull requests on our GitHub repository.

License

This project is licensed under the Apache-2.0 license.

https://x.com/CeylonAIDev