Welcome to handwritten.js ?
Convert typed text to realistic handwriting!
In your code:
Installation
npm install --save handwritten.js
Usage
const handwritten = require('handwritten.js')
const fs = require('fs')
handwritten("Hello, world!").then((converted) => {
converted.pipe(fs.createWriteStream('output.pdf'))
})
Command line usage:
Using without installation
npx handwritten.js "relative/path/to/file.txt"
Note: Use this method only if you plan to use handwritten.js for one time, installing handwritten.js globally (see-below) is recommended for multiple time usages.
Installation
npm install handwritten.js -g
Note: DO NOT use sudo to install global packages! The correct way is to tell npm where to install its global packages:
npm config set prefix ~/.local
. Make sure~/.local/bin
is added toPATH
.
Usage after installation
handwritten.js "/absolute/path/to/file.txt"
API
Command line
handwritten.js path/to/input.txt path/to/output.pdf
The second argument is optional. If not specified, the output
pdf will be saved as output.pdf
in the current
directory.
In code
await handwritten(inputText, outputType)
The second argument is optional. If not specified, it will default to "pdf". Supported output types are: "pdf", "jpeg/buf", "jpeg/b64", "png/buf" and "png/b64". If the output type is set to "pdf", it returns a promise that will resolve in a pdfkit document instance. Else it will return a promise that will resolve in an array containing the buffer or base64 value of the images according to the output type you provided.
Screenshot
Author
? Rahil Kabani rahil.kabani.4@gmail.com
Show your support
Give a ⭐️ if this project helped you!
? Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Credits
GDGVIT/HandWriter - For the cleaned dataset.
Handwritten.JS
? Homepage