You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an easy to use, non-bloated, framework independent, barcode generator in PHP.
3
5
4
6
It creates SVG, PNG, JPG and HTML images, from the most used 1D barcode standards.
5
7
6
-
*The codebase is largely from the [TCPDF barcode generator](https://github.com/tecnickcom/TCPDF) by Nicola Asuni. This code is therefor licensed under LGPLv3. It is still a bit of a mess, bit I will clean it in the future. I do not expect the interface of this class will change during the clean ups.*
8
+
*The codebase is based on the [TCPDF barcode generator](https://github.com/tecnickcom/TCPDF) by Nicola Asuni. This code is therefor licensed under LGPLv3.*
9
+
10
+
## No support for...
11
+
We do not support any 2D barcodes, like QR codes. We also only generate the 'bars' part of a barcode. If you want text of the code below the barcode, you could add it later to the output of this package.
7
12
8
13
## Installation
9
14
Install through [composer](https://getcomposer.org/doc/00-intro.md):
@@ -18,16 +23,33 @@ If you want to generate PNG or JPG images, you need the GD library or Imagick in
18
23
Initiate the barcode generator for the output you want, then call the ->getBarcode() routine as many times as you want.
19
24
20
25
```php
26
+
<?php
27
+
require 'vendor/autoload.php';
28
+
29
+
// This will output the barcode as HTML output to display in the browser
21
30
$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
@@ -37,7 +59,11 @@ $generatorJPG = new Picqer\Barcode\BarcodeGeneratorJPG();
37
59
$generatorHTML = new Picqer\Barcode\BarcodeGeneratorHTML();
38
60
```
39
61
40
-
## Accepted types
62
+
## Accepted barcode types
63
+
These barcode types are supported. All types support different character sets or have mandatory lengths. Please see wikipedia for supported chars and lengths per type.
64
+
65
+
Most used types are TYPE_CODE_128 and TYPE_CODE_39. Because of the best scanner support, variable length and most chars supported.
66
+
41
67
- TYPE_CODE_39
42
68
- TYPE_CODE_39_CHECKSUM
43
69
- TYPE_CODE_39E
@@ -69,10 +95,26 @@ $generatorHTML = new Picqer\Barcode\BarcodeGeneratorHTML();
69
95
- TYPE_PHARMA_CODE
70
96
- TYPE_PHARMA_CODE_TWO_TRACKS
71
97
98
+
[See example images for all supported barcode types](examples.md)
99
+
100
+
## A note about PNG and JPG images
101
+
If you want to use PNG or JPG images, you need to install [Imagick](https://www.php.net/manual/en/intro.imagick.php) or the [GD library](https://www.php.net/manual/en/intro.image.php). This package will use Imagick if that is installed, or fall back to GD. If you have both installed but you want a specific method, you can use `$generator->useGd()` or `$generator->useImagick()` to force your preference.
102
+
72
103
## Examples
73
-
Embedded PNG image in HTML:
74
104
105
+
### Embedded PNG image in HTML
75
106
```php
76
-
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
107
+
$generator = new Picqer\Barcode\BarcodeGeneratorPNG();
0 commit comments