Created
November 9, 2018 21:05
-
-
Save DavidKuennen/81f0642ea1cc4f5fac0cfc632322fc43 to your computer and use it in GitHub Desktop.
OcrVision in NodeJs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define your HTML/CSS | |
const data = { | |
html: "<div class='box'>Success ✅</div>", | |
css: ".box { border: 4px solid #03B875; padding: 20px; font-family: 'Roboto'; }", | |
font: "Roboto" | |
} | |
// Create an image by sending a POST to the API. | |
const image = await request | |
.post({ url: 'https://api.ocr.vision', form: data}) | |
.auth(process.env.API_ID, process.env.API_KEY) | |
const { url } = JSON.parse(image) | |
console.log(url) // generated URL | |
url + ".jpeg" // show an image preview |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment