Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Asprise / scannerjs.javascript-scanner-web-twain-wia-browsers-scanner.js problema de conexión reactjs

Trato de usar scanner.js pero el mismo error sigue mostrando que tengo un problema con la conexión websocket cuando intento usar scanner.js de Asprise. Instalé scanner.js usando npm i scanner.js y lo importé en mi código de reacción. Incluso agregué el siguiente script en mi página html y no funciona.

importar React desde "react"; importar escáner desde 'scanner-js';

 let scanRequest = { "use_asprise_dialog": true, // Whether to use Asprise Scanning Dialog "show_scanner_ui": true, // Whether scanner UI should be shown "twain_cap_setting" : { "ICAP_PIXELTYPE" : "TWPT_RGB", // Color "ICAP_XRESOLUTION" : "100", // DPI: 100 "ICAP_YRESOLUTION" : "100", "ICAP_SUPPORTEDSIZES" : "TWSS_USLETTER" // Paper size: TWSS_USLETTER, TWSS_A4, ... }, "output_settings": [{ "type": "return-base64", "format": "pdf", "thumbnail_height": 200, }] }; /** Triggers the scan */ const scan = () => { scanner.scan(displayImagesOnPage, scanRequest); } /** Processes the scan result */ const displayImagesOnPage = (successful, mesg, response) => { if (!successful) { // On error console.error('Failed: ' + mesg); return; } if (successful && mesg != null && mesg.toLowerCase().indexOf('user cancel') >= 0) { // User cancelled. console.info('User cancelled'); return; } let scannedImages = scanner.getScannedImages(response, true, false); // returns an array of ScannedImage for (let i = 0; (scannedImages instanceof Array) && i < scannedImages.length; i++) { let scannedImage = scannedImages[i]; let elementImg = scanner.createDomElementFromModel({ 'name': 'img', 'attributes': { 'class': 'scanned', 'src': scannedImage.src } }); (document.getElementById('images') ? document.getElementById('images') : document.body).appendChild(elementImg); } } export const Scanner = () => { return ( <div> <h2>Scanner.js TEST</h2> <button type="button" onClick={()=>scan()}> Scan </button> <div id="images"></div> </div> ); }; export default Scanner;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!