scandoc-ai
v2.0.3
Published
Pure JavaScript package for integrating ScanDoc-AI services.
Downloads
16
Readme
ScanDoc-AI
We offer a pure JavaScript package for integrating ScanDoc-AI services.
To get an access token please contact: [email protected]
HTML integration
run: npm install scandoc-ai
An example HTML page integration:
<!DOCTYPE html>
<html>
<head>
<title>ScanDoc-AI</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="node_modules/scandoc-ai/dist/index.js"></script>
<body>
<style>
:root {
display: flex;
flex: 1;
flex-direction: column;
height: 100vh;
width: 100vw;
}
html, body {
display: flex;
flex: 1;
flex-direction: column;
font-family: "Roboto", impact, condensed, sans-serif;
background-color: #fefefe;
box-sizing: border-box;
font-size: 14px;
align-items: center;
}
</style>
<div id="test" style="width: 50%;height: auto;padding: 20px;"></div>
<script>
const key = ""; // Use the key provided by our team
createScanDocAIConfig(key, "test");
const extractionVideo = getExtractionVideo(function (data) { console.log(data)});
//
const html = extractionVideo.getHTML();
document.getElementById('test').innerHTML = html;
extractionVideo.startVideo();
</script>
</body>
</html>
React integration
run: npm install scandoc-ai
An example React integration:
import { useEffect, useMemo } from "react";
import "scandoc-ai/dist/index"
const key = ""; // Use the key provided by our team
window.createScanDocAIConfig(key, "test");
const extractionVideo = window.getExtractionVideo(data=>console.log(data));
function App() {
const html = useMemo(()=>extractionVideo.getHTML(), []);
useEffect(()=>{
extractionVideo.startVideo();
}, []);
return (
<div dangerouslySetInnerHTML={{__html: html}} />
);
}
export default App;
Note
If you have problems integrating the solution please contact: [email protected]