Last active
February 28, 2024 22:03
-
-
Save jmas/d1b5123419cdfcd909afb2ce486557f3 to your computer and use it in GitHub Desktop.
barcode javascript print
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
<svg id="code128"></svg> | |
<script src="https://cdn.jsdelivr.net/jsbarcode/3.3.16/barcodes/JsBarcode.code128.min.js"></script> |
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
JsBarcode("#code128", "AD243", { | |
format: "CODE128", | |
displayValue: false | |
}); | |
window.print(); |
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
@media print { | |
@page { | |
size: 30mm 21mm; | |
margin: 0; | |
padding: 0; | |
} | |
html, body { | |
position: relative; | |
width: 100%; | |
height: 100%; | |
max-width: 100%; | |
max-height: 97%; | |
margin: 0; | |
padding: 0; | |
} | |
svg { | |
width: 100%; | |
height: 100%; | |
max-width: 100%; | |
max-height: 100%; | |
} | |
} |
@vineetbillorey Combine together all 3 files + put styles on page and open page in browser then you will see 'Print' popup with barcode.
Thanks.
I already did it some way.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how can i print barcode?