In my job, the manager requested for html page (in php) that will create html barcode(not image, not drawing, without use of TCPDF classes) – and I just can’t understand how it’s work.
I took sample from the interent , tried to run it but there is no barcode shown.
this is my example code:
Here is my code:
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Libre+Barcode+128+Text" rel="stylesheet">
<style>
.ss {
font-family: "Libre Barcode 128 Text";
font-size: 24px;
}
</style>
</head>
<body>
<br /><span id="test" class="ss">Ìqms3NÎ</span><br />
</body>
</html>;
What I’m doing wrong and how can I solve it?
Create php barcode using code-128 in HTML using google fonts , with no image or drawing
2
Answers
This process is 2 stepped.
Step -1
You need to generate proper 128 code encoded text
Step-2
then using the libre fonts as you have done display it.
Easiest way to do it is to use below mentioned open source encoder written by thanks to hbgl
Please find the link to encoder :
php-code-128-encoder
Above mentioned page as all the required instruction..
It should solve your issue.
additional Info:
Documentation from the author of font:
Libre Barcode documentation
I don’t have an example of PHP using Libre Barcode font, but I have PHP using custom font in the form of a WordPress plug-in, and JS using Libre Barcode Code 128.
The key is that if you use the Libre Barcode Code 128 font, some code has to calculate the checksum.