Revisting HTML To PDF Conversion with CSS Paged Media

I’ve looked at CSS Paged Media in the past. IMO it’s an awesome technology that allows you to create stunning end products from your HTML, CSS, and, optionally Javascript. The layouts for the printed material can be very simple, or they can be as complex as the book CSS Secrets by Lea Verou. I’ve worked with a two different CSS Paged Media processors: PrinceXML and Antenna House. They are both good products but they require a license purchase before you can use their full capabilities. The new products I want to review are: PDFreactor Weasyprint When I discuss individual

Creating and Running Your Own Homebrew Tap

I love Homebrew, I really do. But some of the limitations of the system, while understandable from a maintenance point of view, can be really frustrating. In How to Create and Maintain a Tap the Homebrew team shows how to create a tap and how to add formulae and casks to it. At first, I thought it would be easy; just use brew tap-new to create the custom tap, create the corresponding repository, create the formulas that I want to use, and push them to the repo. But it’s not that easy. The post will discuss how to create a

OCR in Node with Tesseract.js

I’ve always wanted to do Optical Character Recognition (OCR) in Node.js but the alternatives always seemed too complicated for simple command line and browser use. Recently I came accross Tesseract.js, a Javascript port of the Tesseract C++ library. Tesseract (any version) will take an image as input and output any text that it finds as part of the image. This post presents an example of how to use Tesseract.js to do OCR. The first step is to install Tesseract.js. npm install tesseract.js Next, we need to import the packages we need. There are packages that are native to Node and

Creating hashes in Node

There are times when we want to create a hash from either a string or an existing file. This has multiple uses. Some that come to mind are: Validate the file has not changed. As long as the file remains the same the hash will remain the same too Use it as a unique identifier for a file by combining the hash with the file name This is different than creating a UUID with Node. The UUID is random and is not tied to the file. The hash is tied to the file and will produce the same hash if

Generating UUIDs with Node

UUIDs (Universally Unique IDentifier) are also known as GUIDs (Globally Unique IDentifier). A UUID is 128 bits long and can guarantee uniqueness across space and time. UUIDs are defined in RFC 4122. This post will work in two ways of generating UUID V4 strings: Using the UUID package and the randomUUID method of the native Node Crypto package. The native way Since Node 15.6.0, Node’s crypto module provides a method for generating v4 UUIDs. We first import the method from the crypto module. import { randomUUID } from ‘crypto’; We then call the method to generate a UUID using the