OSDN Git Service

Добавлена возможность создавать новую запись предмета оборудования на основании уже...
[invent/invent.git] / vendor / mpdf / mpdf / README.md
1 mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML.
2
3 It is based on [FPDF](http://www.fpdf.org/) and [HTML2FPDF](http://html2fpdf.sourceforge.net/)
4 (see [CREDITS](CREDITS.txt)), with a number of enhancements. mPDF was written by Ian Back and is released
5 under the [GNU GPL v2 licence](LICENSE.txt).
6
7 [![Latest Stable Version](https://poser.pugx.org/mpdf/mpdf/v/stable)](https://packagist.org/packages/mpdf/mpdf)
8 [![Total Downloads](https://poser.pugx.org/mpdf/mpdf/downloads)](https://packagist.org/packages/mpdf/mpdf)
9 [![License](https://poser.pugx.org/mpdf/mpdf/license)](https://packagist.org/packages/mpdf/mpdf)
10
11
12 > Note: If you are viewing this file on mPDF GitHub repository homepage or on Packagist, please note that
13 > the default repository branch is `development` which can differ from the last stable release.
14
15 Requirements
16 ============
17
18 PHP versions and extensions
19 ---------------------------
20
21 - `mPDF >=7.0` is supported on PHP `^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0`
22 - `PHP 7.3` is supported since `mPDF v7.1.7`
23 - `PHP 7.4` is supported since `mPDF v8.0.4`
24
25
26 PHP `mbstring` and `gd` extensions have to be loaded.
27
28 Additional extensions may be required for some advanced features such as `zlib` for compression of output and
29 embedded resources such as fonts, `bcmath` for generating barcodes or `xml` for character set conversion
30 and SVG handling.
31
32 Known server caveats
33 --------------------
34
35 mPDF has some problems with fetching external HTTP resources with single threaded servers such as `php -S`. A proper
36 server such as nginx (php-fpm) or Apache is recommended.
37
38 Support us
39 ==========
40
41 Consider supporting development of mPDF with a donation of any value. [Donation button][1] can be found on the
42 [main page of the documentation][1].
43
44 Installation
45 ============
46
47 Official installation method is via composer and its packagist package [mpdf/mpdf](https://packagist.org/packages/mpdf/mpdf).
48
49 ```
50 $ composer require mpdf/mpdf
51 ```
52
53 Usage
54 =====
55
56 The simplest usage (since version 7.0) of the library would be as follows:
57
58 ```php
59 <?php
60
61 require_once __DIR__ . '/vendor/autoload.php';
62
63 $mpdf = new \Mpdf\Mpdf();
64 $mpdf->WriteHTML('<h1>Hello world!</h1>');
65 $mpdf->Output();
66
67 ```
68
69 This will output the PDF inline to the browser as `application/pdf` Content-type.
70
71 Setup & Configuration
72 =====================
73
74 All [configuration directives](https://mpdf.github.io/reference/mpdf-variables/overview.html) can
75 be set by the `$config` parameter of the constructor.
76
77 It is recommended to set one's own temporary directory via `tempDir` configuration variable.
78 The directory must have write permissions (mode `775` is recommended) for users using mPDF
79 (typically `cli`, `webserver`, `fpm`).
80
81 **Warning:** mPDF will clean up old temporary files in the temporary directory. Choose a path dedicated to mPDF only.
82
83
84 ```php
85 <?php
86
87 $mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/tmp']);
88
89 ```
90
91 By default, the temporary directory will be inside vendor directory and will have correct permissions from
92 `post_install` composer script.
93
94 For more information about custom temporary directory see the note on
95 [Folder for temporary files](https://mpdf.github.io/installation-setup/folders-for-temporary-files.html)
96 in the section on Installation & Setup in the [manual][1].
97
98 If you have problems, please read the section on
99 [troubleshooting](https://mpdf.github.io/troubleshooting/known-issues.html) in the manual.
100
101 Online manual
102 =============
103
104 Online manual is available at https://mpdf.github.io/.
105
106 For general questions or troubleshooting please use the [mpdf tag](https://stackoverflow.com/questions/tagged/mpdf) at Stack Overflow (and not the project's issue tracker).
107
108 Contributing
109 ============
110
111 Please read before submitting issues and pull requests the [CONTRIBUTING.md](https://github.com/mpdf/mpdf/blob/development/.github/CONTRIBUTING.md) file.
112
113 Unit Testing
114 ============
115
116 Unit testing for mPDF is done using [PHPUnit](https://phpunit.de/).
117
118 To get started, run `composer install` from the command line while in the mPDF root directory
119 (you'll need [composer installed first](https://getcomposer.org/download/)).
120
121 To execute tests, run `vendor/bin/phpunit` from the command line while in the mPDF root directory.
122
123 Any assistance writing unit tests for mPDF is greatly appreciated. If you'd like to help, please
124 note that any PHP file located in the `/tests/` directory will be autoloaded when unit testing.
125
126 [1]: https://mpdf.github.io