mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML.
It is based on [FPDF](http://www.fpdf.org/) and [HTML2FPDF](http://html2fpdf.sourceforge.net/)
(see [CREDITS](CREDITS.txt)), with a number of enhancements. mPDF was written by Ian Back and is released
under the [GNU GPL v2 licence](LICENSE.txt).
[![Latest Stable Version](https://poser.pugx.org/mpdf/mpdf/v/stable)](https://packagist.org/packages/mpdf/mpdf)
[![Total Downloads](https://poser.pugx.org/mpdf/mpdf/downloads)](https://packagist.org/packages/mpdf/mpdf)
[![License](https://poser.pugx.org/mpdf/mpdf/license)](https://packagist.org/packages/mpdf/mpdf)
> ⚠ If you are viewing this file on mPDF GitHub repository homepage or on Packagist, please note that
> the default repository branch is `development` which can differ from the last stable release.
Requirements
============
PHP versions and extensions
---------------------------
- `mPDF >=7.0` is supported on PHP `^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0`
- `PHP 7.3` is supported since `mPDF v7.1.7`
- `PHP 7.4` is supported since `mPDF v8.0.4`
- `PHP 8.0` is supported since `mPDF v8.0.10`
PHP `mbstring` and `gd` extensions have to be loaded.
Additional extensions may be required for some advanced features such as `zlib` for compression of output and
embedded resources such as fonts, `bcmath` for generating barcodes or `xml` for character set conversion
and SVG handling.
Known server caveats
--------------------
mPDF has some problems with fetching external HTTP resources with single threaded servers such as `php -S`. A proper
server such as nginx (php-fpm) or Apache is recommended.
Support us
==========
Consider supporting development of mPDF with a donation of any value. [Donation button][1] can be found on the
[main page of the documentation][1].
Installation
============
Official installation method is via composer and its packagist package [mpdf/mpdf](https://packagist.org/packages/mpdf/mpdf).
```
$ composer require mpdf/mpdf
```
Usage
=====
The simplest usage (since version 7.0) of the library would be as follows:
```php
<?php
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output();
```
This will output the PDF inline to the browser as `application/pdf` Content-type.
Setup & Configuration
=====================
All [configuration directives](https://mpdf.github.io/reference/mpdf-variables/overview.html) can
be set by the `$config` parameter of the constructor.
It is recommended to set one's own temporary directory via `tempDir` configuration variable.
The directory must have write permissions (mode `775` is recommended) for users using mPDF
(typically `cli`, `webserver`, `fpm`).
**Warning:** mPDF will clean up old temporary files in the temporary directory. Choose a path dedicated to mPDF only.
```php
<?php
$mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/tmp']);
```
By default, the temporary directory will be inside vendor directory and will have correct permissions from
`post_install` composer script.
For more information about custom temporary directory see the note on
[Folder for temporary files](https://mpdf.github.io/installation-setup/folders-for-temporary-files.html)
in the section on Installation & Setup in the [manual][1].
If you have problems, please read the section on
[troubleshooting](https://mpdf.github.io/troubleshooting/known-issues.html) in the manual.
Online manual
=============
Online manual is available at https://mpdf.github.io/.
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).
Contributing
============
Please read before submitting issues and pull requests the [CONTRIBUTING.md](https://github.com/mpdf/mpdf/blob/development/.github/CONTRIBUTING.md) file.
Unit Testing
============
Unit testing for mPDF is done using [PHPUnit](https://phpunit.de/).
To get started, run `composer install` from the command line while in the mPDF root directory
(you'll need [composer installed first](https://getcomposer.org/download/)).
To execute tests, run `vendor/bin/phpunit` from the command line while in the mPDF root directory.
Any assistance writing unit tests for mPDF is greatly appreciated. If you'd like to help, please
note that any PHP file located in the `/tests/` directory will be autoloaded when unit testing.
[1]: https://mpdf.github.io
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
mPDF是一个PHP库,可以从UTF-8编码HTML生成PDF文件。 它基于和 (请参阅 ),具有许多增强功能。 mPDF由Ian Back编写,并根据。 :warning: 如果您正在mPDF GitHub存储库主页或Packagist上查看此文件,请注意,默认存储库分支是development ,它与上一个稳定版本有所不同。 要求 PHP版本和扩展 PHP ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0支持mPDF >=7.0 PHP ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 自mPDF v7.1.7起支持PHP 7.3 从mPDF v8.0.4支持PHP 7.4 自mPDF v8.0.10起支持PHP 8.0 必须加载PHP mbstring和gd扩展。 一些高级功能可能需要其他扩展,例如zlib用于压缩输出和嵌入式资源,例如字体, bcmath用于生成条形码或xml用于字符集转换和SVG处理。 已知的服务器警告 mPDF在使用单线程服务器(例如php -S获取外部HTTP资源时遇到一些问题。 建议使用适当的服务器,
资源详情
资源评论
资源推荐
收起资源包目录
mpdf:PHP库从UTF-8编码HTML生成PDF文件 (510个子文件)
lang2fonts.css 9KB
mpdf.css 2KB
linebrdictK.dat 1MB
linebrdictT.dat 295KB
linebrdictL.dat 124KB
.gitignore 48B
.gitignore 23B
sRGB_IEC61966-2-1.icc 3KB
no_image.jpg 8KB
composer.json 2KB
CHANGELOG.md 37KB
README.md 4KB
CONTRIBUTING.md 1KB
ISSUE_TEMPLATE.md 600B
Aegyptus.otf 5.57MB
Aegean.otf 1.67MB
Akkadian.otf 1.43MB
Quivira.otf 1.41MB
Uthman.otf 169KB
SyrCOMEdessa.otf 78KB
Mpdf.php 935KB
Otl.php 248KB
TTFontFile.php 169KB
OtlDump.php 163KB
ru.php 146KB
Svg.php 132KB
Ucdn.php 129KB
de.php 88KB
nl.php 82KB
CssManager.php 77KB
Form.php 67KB
Indic.php 67KB
Table.php 55KB
BlockTag.php 51KB
pl.php 48KB
ImageProcessor.php 44KB
sv.php 34KB
Gradient.php 34KB
TableOfContents.php 33KB
es.php 30KB
MetadataWriter.php 28KB
en.php 27KB
ConfigVariables.php 23KB
FontWriter.php 22KB
Td.php 19KB
Meter.php 17KB
fr.php 16KB
BackgroundWriter.php 15KB
Img.php 15KB
DirectWrite.php 15KB
TTFontFileAnalysis.php 14KB
Input.php 14KB
Myanmar.php 14KB
upperCase.php 13KB
FpdiTrait.php 12KB
LanguageToFont.php 12KB
FontVariables.php 10KB
Imb.php 10KB
Sea.php 10KB
BarCode.php 9KB
ColorConverter.php 9KB
PageWriter.php 8KB
TextCircle.php 8KB
subs_win-1252.php 8KB
FormFeed.php 8KB
Bmp.php 7KB
Code93.php 7KB
Tag.php 7KB
Code128.php 7KB
Protection.php 7KB
Wmf.php 7KB
InlineTag.php 7KB
EanUpc.php 7KB
Code39.php 7KB
CJKdata.php 6KB
ResourceWriter.php 6KB
BaseWriter.php 6KB
ctimesi.php 6KB
ctimesb.php 6KB
ctimes.php 6KB
ctimesbi.php 6KB
chelvetica.php 6KB
ColorSpaceRestrictor.php 6KB
chelveticab.php 6KB
chelveticabi.php 6KB
chelveticai.php 6KB
subs_core.php 6KB
TextArea.php 5KB
Select.php 5KB
PageFooter.php 5KB
Barcode.php 5KB
Hyphenator.php 5KB
Lzw.php 5KB
ScriptToLanguage.php 5KB
Hr.php 5KB
entity_substitutions.php 4KB
ServiceFactory.php 4KB
Tr.php 4KB
DefaultCss.php 4KB
Rm4Scc.php 4KB
共 510 条
- 1
- 2
- 3
- 4
- 5
- 6
LinSha
- 粉丝: 13
- 资源: 4616
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0