0
点赞
收藏
分享

微信扫一扫

管家婆财贸ERP BB021.Excel复制带入单据

捡历史的小木板 2024-10-17 阅读 5

1、引入资源

 2、示例

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <script src="https://cdn.bootcdn.net/ajax/libs/tesseract.js/5.1.0/tesseract.min.js"></script>
  <body>
    <img src="./en.png" alt="" />
    <button onclick="orcBtn1()">识别英文</button>
    <hr />
    <img src="./zn.png" alt="" />
    <button onclick="orcBtn2()">识别中文</button>
    <hr />
    <img src="./1.png" alt="" />
    <button onclick="orcBtn3()">识别中英文</button>
    <hr />
  </body>
  <script>
    const btn = document.querySelector('button')
    function orcBtn1() {
      Tesseract.recognize('./en.png').then(res => {
        console.log(res.data.text)
      })
    }
    function orcBtn2() {
      Tesseract.recognize('./zn.png', 'chi_sim').then(res => {
        console.log(res.data.text)
      })
    }
    function orcBtn3() {
      Tesseract.recognize('./1.png', 'eng+chi_sim').then(res => {
        console.log(res.data.text)
      })
    }
  </script>
</html>
举报

相关推荐

0 条评论