• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 2 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A JavaScript-powered CLI for converting HTML into PDFs

Print Ready

by Nicholas C. Zakas

If you find this useful, please consider supporting my work with a donation.

Description

A JavaScript-powered CLI for converting HTML into PDFs.

EXPERIMENTAL: This project is still in the very early stages and should not be relied upon for production. At this point, I'm just looking for feedback and fixing bugs.

Prerequisites

  • Node.js 12.22+

Usage

Install using [npm][npm] or [yarn][yarn]:

npm install @humanwhocodes/print-ready --save

# or

yarn add @humanwhocodes/print-ready

Then on the command line:

npx print-ready foo.html

This will render foo.html to a file named foo.pdf. You can also override the output filename:

npx print-ready foo.html -o bar.pdf

How It Works

PrintReady uses PagedJS to render your HTML file inside Puppeteer and then exports a PDF from Puppeteer.

Developer Setup

  1. Fork the repository
  2. Clone your fork
  3. Run npm install to setup dependencies
  4. Run npm test to run tests

Acknowledgements

This project is based on PagedJS-CLI, an MIT-licensed project. While not strictly a fork, this project does use some code from PagedJS-CLI.

Frequently Asked Questions

Why don't you just use the PagedJS-CLI?

I tried, but it kept crashing on me and it doesn't appear to be maintained any longer. Rather than giving up, I decided to write my own.

Why haven't you implemented all the features PagedJS-CLI?

For my purposes I don't need all of the features of PagedJS-CLI. However, I'm open to contributions to add those extra features.

More Repositories

1

computer-science-in-javascript

Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript.
JavaScript
9,059
star
2

humanfs

A modern filesystem API for JavaScript
JavaScript
486
star
3

env

A utility for verifying environment variables are present
JavaScript
375
star
4

momoa

A JSON parser, tokenizer, traverser, and printer.
JavaScript
313
star
5

pledge

A custom promise implementation for JavaScript
JavaScript
90
star
6

puppeteer-data-extractor

JavaScript
46
star
7

object-schema

DEPRECATED. Use eslint/object-schema instead.
JavaScript
32
star
8

config-array

DEPRECATED. Use eslint/config-array instead
JavaScript
30
star
9

number-to-words

A JavaScript function to convert a number into words
JavaScript
30
star
10

tweet

A CLI for posting to Twitter
JavaScript
28
star
11

module-importer

Universal importer for CommonJS and ESM in Node.js
JavaScript
26
star
12

eslint-simple-rule

A utility for creating simple ESLint rules
JavaScript
23
star
13

async-event-emitter

Asynchronous version of EventEmitter for JavaScript
JavaScript
20
star
14

retry

A JavaScript utility for retrying async methods that reject errors
JavaScript
19
star
15

gitignore-to-minimatch

Utility to convert gitignore patterns into minimatch patterns
JavaScript
11
star
16

astro-jekyll

Toolkit to make transferring a Jekyll website to Astro simple!
JavaScript
9
star
17

toot

CLI for posting to Mastodon
JavaScript
9
star
18

humanwhocodes.com

HTML
8
star
19

ordered-set

A set data structure that maintains the order of insertion
JavaScript
8
star
20

object-store

JavaScript
8
star
21

array-with-default

An implementation of Array with a default for missing values
JavaScript
7
star
22

github-comment

A simple CLI for posting comments to GitHub issues and pull requests
JavaScript
6
star
23

memory

A JavaScript implementation of dynamic memory.
JavaScript
5
star
24

disqus-export

Disqus comments exporter
JavaScript
2
star
25

hello-nodejs-service

A simple microservice as an example for running Node.js on Google Cloud Run
JavaScript
2
star
26

hello-deno-service

An example Deno service to run on Google Cloud Run
JavaScript
2
star
27

markdown-it-markua-aside

markdown-it plugin for Markua asides and blurbs
JavaScript
1
star