xref: /plugin/dw2pdf/vendor/mpdf/qrcode/README.md (revision 92200750cd9cfc4a9489fe7c04c6e41b5a3de6ee)
1# mPDF QR code library
2
3QR code generating library with HTML/PNG/mPDF output possibilities.
4
5[![Build Status](https://travis-ci.org/mpdf/qrcode.svg?branch=development)](https://travis-ci.org/mpdf/mpdf)
6
7This is based on QrCode library bundled with mPDF until v8.0, made by Laurent Minguet. It is provided under LGPL license.
8
9## Installation
10
11```sh
12$ composer require mpdf/qrcode
13```
14
15## Usage
16
17```php
18<?php
19
20use Mpdf\QrCode\QrCode;
21use Mpdf\QrCode\Output;
22
23$qrCode = new QrCode('Lorem ipsum sit dolor');
24
25// Save black on white PNG image 100 px wide to filename.png. Colors are RGB arrays.
26$output = new Output\Png();
27$data = $output->output($qrCode, 100, [255, 255, 255], [0, 0, 0]);
28file_put_contents('filename.png', $data);
29
30// Echo a SVG file, 100 px wide, black on white.
31// Colors can be specified in SVG-compatible formats
32$output = new Output\Svg();
33echo $output->output($qrCode, 100, 'white', 'black');
34
35// Echo an HTML table
36$output = new Output\Html();
37echo $output->output($qrCode);
38```
39