GithubHelp home page GithubHelp logo

uv3301 / handwritten.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alias-rahil/handwritten.js

0.0 1.0 0.0 23.07 MB

Convert typed text to realistic handwriting!

Home Page: https://alias-rahil.github.io/handwritten.js/

License: MIT License

JavaScript 98.62% Shell 1.38%

handwritten.js's Introduction

✍️ HANDWRITTEN.js

Convert typed text to realistic handwriting

All Contributors

Version

License: MIT

Demo

🌐 handwritten.js

Installation

For browsers:

<script src="https://raw.githubusercontent.com/alias-rahil/handwritten.js/master/docs/handwritten.js"></script>

This will expose the latest version of handwritten.js as a global variable called handwritten which you can start using right away. Check the contents of docs/ folder for a simple implementation. For other versions, install the required version with npm and use browserify to compile it. Optionally, use babel-minify to compress the bundled javascript file.

For nodejs projects:

npm install handwritten.js

or

yarn add handwritten.js

Install globally:

npm install handwritten.js -g

or

yarn global add handwritten.js

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 to PATH.

Usage

For nodejs projects:

const handwritten = require('handwritten.js')
const fs = require('fs')
const rawtext = "Hello, world!"
handwritten(rawtext).then((converted) => {
    converted.pipe(fs.createWriteStream('output.pdf'))
})

CLI usage with npx:

npx handwritten.js -f "path/to/inputfile.txt" -o "path/to/outputfile.pdf"

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.

CLI usage after installing globally:

handwritten.js -f "path/to/inputfile.txt" -o "path/to/outputfile.pdf"

API

Command line

handwritten.js -f path/to/inputfile.txt -o path/to/outputfile.pdf
handwritten.js -f path/to/inputfile.txt -o path/to/outputfile.pdf --ruled
handwritten.js -f path/to/inputfile.txt -o path/to/outputfolder --images png

Check --help or --version option for more details.

In code

handwritten(rawtext)
handwritten(rawtext, { ruled: true })
handwritten(rawtext, { outputtype: "jpeg/buf" })
handwritten(rawtext, { ruled: true, outputtype: "jpeg/b64" })

Default outputtype: "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 provided.

Screenshot

lorem-ipsum.jpeg

Author

👤 Rahil Kabani [email protected]

Show your support

Give a ⭐️ if this project helped you!

🤝 Contributing

Contributions, issues and feature requests are welcome! Feel free to check issues page.

handwritten.js only supports English letters. I am not planning to add support for other languages for now. Please do not any more make issues about this. However, I will merge pull requests if any. See the issue #18 for more details.

Credits

GDGVIT/HandWriter - For the cleaned dataset.

Handwritten.JS

🏠 Homepage

License

MIT

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Rahil Kabani

💻 📖 🚧

Anthony Ng

📖

Ben Junya

💻 📖

Harsh SInghal

💻 🚧

etienne

💻

Ashikka Gupta

💻 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

handwritten.js's People

Contributors

alias-rahil avatar allcontributors[bot] avatar hsrambo07 avatar etnnth avatar ashikka avatar dependabot[bot] avatar newyork-anthonyng avatar mrbenj avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.