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
$renderer = new Picqer\Barcode\Renderers\SvgRenderer(); // Vector based SVG
64
65
$renderer = new Picqer\Barcode\Renderers\PngRenderer(); // Pixel based PNG
@@ -67,6 +68,51 @@ $renderer = new Picqer\Barcode\Renderers\HtmlRenderer(); // Pixel based HTML
67
68
$renderer = new Picqer\Barcode\Renderers\DynamicHtmlRenderer(); // Vector based HTML (full 'page' width and height)
68
69
```
69
70
71
+
Each renderer has their own options. Only the barcode is required, the rest is optional. Here are all the options for each renderers:
72
+
73
+
### SVG
74
+
```php
75
+
$renderer = new Picqer\Barcode\Renderers\SvgRenderer();
76
+
$renderer->setForegroundColor('red'); // Give a color for the bars, the background is always white
77
+
$renderer->setSvgType($renderer::TYPE_SVG_INLINE); // Changes the output to be used inline inside HTML documents, instead of a standalone SVG image (default)
78
+
$renderer->setSvgType($renderer::TYPE_SVG_STANDALONE); // If you want to force the default, create a stand alone SVG image
79
+
80
+
$renderer->render($barcode, 450.20, 75); // Width and height support floats
81
+
````
82
+
83
+
### PNG + JPG
84
+
All options for PNG and JPG are the same.
85
+
```php
86
+
$renderer = new Picqer\Barcode\Renderers\PngRenderer();
87
+
$renderer->setForegroundColor([255, 0, 0]); // Give a color for the bars, the background is always white. Give it as 3 times 0-255 values for red, green and blue.
88
+
$renderer->useGd(); // If you have Imagick and GD installed, but want to use GD
89
+
$renderer->useImagick(); // If you have Imagick and GD installed, but want to use Imagick
90
+
$renderer->render($barcode, 5, 40); // Width factor (how many pixel wide every bar is), and the height in pixels
91
+
````
92
+
93
+
### HTML
94
+
Gives HTML to use inline in a full HTML document.
95
+
```php
96
+
$renderer = new Picqer\Barcode\Renderers\HtmlRenderer();
97
+
$renderer->setForegroundColor('red'); // Give a color for the bars, the background is always white
98
+
99
+
$renderer->render($barcode, 450.20, 75); // Width and height support floats
100
+
````
101
+
102
+
### Dynamic HTML
103
+
Give HTML here the barcode is using the full width and height, to put inside a container/div that has a fixed size.
104
+
```php
105
+
$renderer = new Picqer\Barcode\Renderers\DynamicHtmlRenderer();
106
+
$renderer->setForegroundColor('red'); // Give a color for the bars, the background is always white
107
+
108
+
$renderer->render($barcode);
109
+
````
110
+
111
+
You can put the rendered HTML inside a div like this:
These barcode types are supported. All types support different character sets and some have mandatory lengths. Please see wikipedia for supported chars and lengths per type.
0 commit comments