https://github.com/transitive-bullshit/puppeteer-render-text-cli
CLI for rendering text with headless chrome.
https://github.com/transitive-bullshit/puppeteer-render-text-cli
cli puppeteer puppeteer-screenshot render text text-to-image
Last synced: about 1 month ago
JSON representation
CLI for rendering text with headless chrome.
- Host: GitHub
- URL: https://github.com/transitive-bullshit/puppeteer-render-text-cli
- Owner: transitive-bullshit
- Created: 2018-07-01T12:25:16.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-11T23:11:21.000Z (almost 5 years ago)
- Last Synced: 2025-04-11T18:54:35.920Z (about 2 months ago)
- Topics: cli, puppeteer, puppeteer-screenshot, render, text, text-to-image
- Language: JavaScript
- Size: 50.8 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# puppeteer-render-text-cli
> CLI for rendering text with headless chrome.
[](https://www.npmjs.com/package/puppeteer-render-text-cli) [](https://travis-ci.com/transitive-bullshit/puppeteer-render-text-cli) [](https://standardjs.com)
![]()
This CLI is also available as a [library](https://github.com/transitive-bullshit/puppeteer-render-text).
## Why?
ImageMagick is the traditional unix tool to programatically [render text](http://www.imagemagick.org/Usage/text/), and while it works very well for simple use cases, trying to use it to render rich text or html is very difficult. [Pango](https://www.pango.org/) is another option that's been around for ages, but both suffer from archaic syntax and minimal rich text support.
[Puppeteer](https://github.com/GoogleChrome/puppeteer), on the other hand, allows for robust, headless chrome screenshots with best-in-class support for all modern html / text / font features.
**This CLI makes it easy to use headless chrome to render text + html to images.**
## Features
- built-in [fontfaceobserver](https://fontfaceobserver.com/)
- easily load [google fonts](https://fonts.google.com/)
- optional word-wrap
- main content is just **html**
- styling is done via [**css**](https://www.w3schools.com/jsref/dom_obj_style.asp)
- handles multiple fonts
- thoroughly tested
- includes a [CLI](https://github.com/transitive-bullshit/puppeteer-render-text-cli)## Install
```bash
npm install -g puppeteer-render-text-cli
```## Usage
```bash
Usage: puppeteer-render-text [options]Options:
-V, --version output the version number
-o, --output path of image file to store result (default: out.png)
-w, --width optional max width
-h, --height optional max height
-g, --load-google-font load font families from google
-l, --load-font-family font family to load with fontfaceobserver
-s, --style JSON string of CSS styles (default: { })
--font-family font-family to add to style
--font-size font-size to add to style
--padding padding to add to style
--color color to add to style
-h, --help output usage information
```## Related
- [puppeteer-render-text](https://github.com/transitive-bullshit/puppeteer-render-text) - Library for this CLI.
- [puppeteer](https://github.com/GoogleChrome/puppeteer) - Headless Chrome Node API.
- [awesome-puppeteer](https://github.com/transitive-bullshit/awesome-puppeteer) - Curated list of awesome puppeteer resources.## License
MIT © [Travis Fischer](https://github.com/transitive-bullshit)
Support my OSS work by following me on twitter
![]()