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

pdf-red

v0.0.4

Published

Add text to PDFs by OCR for all images (e.g. scanned document)

Downloads

94

Readme

Pdf-red

This node will help you to handle (scanned image) pdfs and images. Important Note: Works only in a windows environment.

  • You can get a searchable (OCR) pdf from images and (image) pdfs.
  • You can create .png images from each page of a pdf.
  • You can get the text from images or (image) pdfs.
  • If you have installed tesseract, you can use the command line to directly input an order.

The OCR will be either made by tesseract.js or if installed by tesseract -> (tested with pre-build installer for windows tesseract 5.0.0 alpha).

Usage

1. Configurate the node

Set the option you wish to do:

Create readable pdf / Get text

To improve the ocr reading set a language by using the ISO_639-2/T code. Default is english ('eng').

Create images from pdf page

Set the image quality (75 or 150 dpi should be more than enough for good results). Higher values will result in slower ocr / bigger file size.

If you want to save the files to a directory you can state it under "Save image output to folder".

Alternatively you can heck 'Return Images' if you want to extract the whole page images from the pdf. The result will be written in msg.pdfImages as an object with the keys 'page' (pagenumber) and 'data' (buffer of the images). You can save them with the standard file node (default or utf-8). The suffix must be '.png'.

Use tesseract / tesseract command line

For this option tesseract must be installed!

If you want to use tesseract instead of tesseract.js you have to state the command call (should be tesseract).

You can set msg.tessCommand or type it directly in the node. It will be joined with the field 'tesseract command call', so don't start the command line with 'tesseract'.

2. Get a file

Load a pdf or valid image file with the 'file in' or the 'http' node. The result of those nodes must be a buffer object. This is not necessary if you use the tesseract command line.

3. Save the file

Use the 'file' node to save the pdf and/or the images on your filesystem.

TLDR

You can find a sample flow in the node red imports.

example

Additional info for tesseract.js

This node can be used without tesseract installed. This will result in using tesseract.js which is currently much slower to make your images and pdfs readable. You can try to use tessdata fast but it will reduce the quality of the ocr.

As we can't create multiple workers to recognize multiple pages (can results in memory leak) we only use one tesseract worker. If scheduler with multiple workers can handle the getPdf function someday (or a workaround is found) it could reduce the time significant!

Therefore if possible install tesseract.

Tesseract

For windows you can use a simple installer. Just check if afterwards your environment variable is correctly set and do reboot.

Control Panel > System and Security > System > Advanced system settings > Advanced > Environment variables > PATH > New

example