scandoc-ai-components

0.0.99 • Public • Published

ScanDoc-AI

We offer a pure JavaScript package for integrating ScanDoc-AI services.

To get an access token please contact: info@scandoc.ai

HTML integration

run: npm install scandoc-ai-components

An example HTML page integration:

<!DOCTYPE html>
<html>
<head>
  <title>ScanDoc-AI Demo</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <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>
</head>
<body>
  <div id="test">Loading video...</div>

  <script src="scandoc.js"></script>
  <script>
    const key = '';  // Use the key provided by our team
    createScanDocAIConfig(key, "test");

    setScanDocAIConfig({
      SHOULD_RETURN_DOCUMENT_IMAGE: true,
      SHOULD_RETURN_FACE_IF_DETECTED: true,
      SHOULD_RETURN_SIGNATURE_IF_DETECTED: true,
      SKIP_DOCUMENT_SIZE_CHECK: true,
      MAX_SCAN_DURATION_MS: 15000,
      MAX_UNSUPPORTED_ATTEMPTS: 5,
    });

    const extractionVideo = getExtractionVideo(function (result) {
        console.log("Extraction Result:", result);
        if (result.success) {
            extractionVideo.reset();
            extractionVideo.startVideo();
        } else {
            extractionVideo.reset();
            extractionVideo.startVideo();
        }
    });

    const html = extractionVideo.getHTML();
    document.getElementById("test").innerHTML = html;
    extractionVideo.startVideo();
  </script>
</body>
</html>

React integration

run: npm install scandoc-ai-components

An example React integration:

import { useEffect, useMemo } from "react";
import "scandoc-ai-components/dist/index"

const key = "";  // Use the key provided by our team
window.createScanDocAIConfig(key, "test");
window.setScanDocAIConfig({
  SHOULD_RETURN_DOCUMENT_IMAGE: true,
  SHOULD_RETURN_FACE_IF_DETECTED: true,
  SHOULD_RETURN_SIGNATURE_IF_DETECTED: true,
  SKIP_DOCUMENT_SIZE_CHECK: true,
  MAX_SCAN_DURATION_MS: 15000,
  MAX_UNSUPPORTED_ATTEMPTS: 4,
});

const extractionVideo = window.getExtractionVideo(result => {
	console.log("Extraction Result:", result);
  if (result.success) {
      extractionVideo.reset();
      extractionVideo.startVideo();
    } else {
      extractionVideo.reset();
      extractionVideo.startVideo();
    }
});

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: support@scandoc.ai

Package Sidebar

Install

npm i scandoc-ai-components

Weekly Downloads

1,081

Version

0.0.99

License

ISC

Unpacked Size

23 MB

Total Files

7

Last publish

Collaborators

  • helena-datablast