forked from zxing-js/library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request zxing-js#2 from Tjieco/ITFBarcodeScanner
Itf barcode scanner
- Loading branch information
Showing
8 changed files
with
470 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="author" content="Adrian Toșcă"> | ||
<meta name="description" content="Scan QR Code from Image with ZXing javascript library"> | ||
<title>ZXing | Scan barcode from Image</title> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css"> | ||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css"> | ||
</head> | ||
<body> | ||
|
||
<main class="wrapper"> | ||
|
||
<section class="container" id="demo-content"> | ||
<h1 class="title">Scan barcode from Image</h1> | ||
|
||
<p>This example shows how to scan a barcode with ZXing javascript library from an image. The example decodes from the <code>src</code> in <code>img</code> tag, however is also possible to decode directly from an url without an <code>img</code> tag.</p> | ||
|
||
<div> | ||
<a class="button" id="decodeButton">Decode</a> | ||
</div> | ||
|
||
<div> | ||
<img id="img" src="../img/2of5-interleaved_806002000537753383.png" style="border: 1px solid gray"></img> | ||
</div> | ||
|
||
<label>Result:</label> | ||
<blockquote> | ||
<p id="result"></p> | ||
</blockquote> | ||
|
||
<p>See the <a href="https://github.com/aleris/zxing-typescript/tree/master/docs/examples/qr-image/">source code</a> for this example.</p> | ||
|
||
</section> | ||
|
||
<footer class="footer"> | ||
<section class="container"> | ||
<p>ZXing TypeScript Demo. Licensed under the <a target="_blank" href="https://github.com/aleris/zxing-typescript#license" title="Apache License, Version 2.0">Apache License, Version 2.0</a>.</p> | ||
</section> | ||
</footer> | ||
|
||
</main> | ||
|
||
<script type="text/javascript" src="../../../bundles/library.min.js"></script> | ||
<script type="text/javascript"> | ||
window.addEventListener('load', function() { | ||
const codeReader = new Library.BrowserBarcodeReader('video') | ||
console.log('ZXing code reader initialized') | ||
|
||
document.getElementById('decodeButton').addEventListener('click', () => { | ||
const img = document.getElementById('img') | ||
codeReader.decodeFromImage(img).then((result) => { | ||
console.log(result) | ||
document.getElementById('result').textContent = result.text | ||
}).catch((err) => { | ||
console.error(err) | ||
document.getElementById('result').textContent = err | ||
}) | ||
console.log(`Started decode for image from ${img.src}`) | ||
}) | ||
|
||
}) | ||
</script> | ||
|
||
</body> | ||
</html> |
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
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
Oops, something went wrong.