Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to get 128-JS to work on local filesystem #451

Open
CausticLasagne opened this issue Apr 17, 2024 · 0 comments
Open

Can't seem to get 128-JS to work on local filesystem #451

CausticLasagne opened this issue Apr 17, 2024 · 0 comments

Comments

@CausticLasagne
Copy link

Hi. I am trying to make a barcode generator for my work. I've followed your instructions and it works perfectly.
However, when I download the script from the CDN at https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.code128.min.js
and then try to use it locally from the filesystem on my page it prints an error:

Uncaught SyntaxError: Invalid regular expression: /^[_These characters could not be pasted_]*/: Range out of order in character class (at JsBarcode.code128.min.js:834:28)
    at new RegExp (<anonymous>)
    at a (JsBarcode.code128.min.js:834:28)
    at e.default (JsBarcode.code128.min.js:846:21)
    at new e (JsBarcode.code128.min.js:803:150)
    at o (JsBarcode.code128.min.js:494:17)
    at JsBarcode.code128.min.js:545:25
    at t.value (JsBarcode.code128.min.js:380:35)
    at x.<computed>.x.<computed>.x.<computed> (JsBarcode.code128.min.js:540:36)
    at E (JsBarcode.code128.min.js:532:222)
    at Go (Main.html:21:2)

I have a sinking feeling it is related to the file's encoding. I've tried different encoding to no avail.
If it is related to the file's encoding, could I please request a version of the file or instructions on how to change the characters in the array to standard characters? I only need 0-9, A-Z, a-z. The main keyboard symbols are a bonus but not needed.

I've just designed a simple page that loads whatever text is in a textbox at the click of a button and then displays it as a barcode.

<!DOCTYPE html>
<html>
<script src="JsBarcode.code128.min.js"></script>
<head>

</head>
<body>


<div style="position:absolute; top:20%; left:40%">
<img id="barcd11"/> </br></br></br>
<input type="text" id="testInp1"  value="Nothing Selected"/>
<input type="button" id="btnGo" onclick="Go()"/>
</div>

<script>
//JsBarcode("#barcd11", document.getElementById("testInp1").value);

function Go()
{
	JsBarcode("#barcd11", document.getElementById("testInp1").value);
}

</script>

</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant