kikusempai/mpdf
Composer 安装命令:
composer require kikusempai/mpdf
包简介
A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support
README 文档
README
mPDF is a PHP libraray which generates PDF files from UTF-8 encoded HTML.
It is based on FPDF and HTML2FPDF (see CREDITS), with a number of enhancements. mPDF was written by Ian Back and is released under the GNU GPL v2 licence.
Note: If you are viewing this file on mPDF Github repository homepage or on Packagist, please note that the default repository branch is
developmentwhich can differ from the last stable release.
Requirements
mPDF 7.0 requires PHP ^5.6 || ~7.0.0 || ~7.1.0. 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.
Support us
Consider supporting development of mPDF with a donation of any value. Donation button can be found on the main page of the documentation.
Installation
Official installation method is via composer and its packagist package mpdf/mpdf.
$ composer require mpdf/mpdf
Usage
The simplest usage (since version 7.0) of the library would be as follows:
<?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 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).
<?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 in the section on Installation & Setup in the manual.
If you have problems, please read the section on troubleshooting in the manual.
Online manual
Online manual is available at https://mpdf.github.io/.
Contributing
See CONTRIBUTING.md file in the project.
Unit Testing
Unit testing for mPDF is done using PHPUnit.
To get started, run composer install from the command line while in the mPDF root directory
(you'll need composer installed first).
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.
kikusempai/mpdf 适用场景与选型建议
kikusempai/mpdf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.71k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「pdf」 「utf-8」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kikusempai/mpdf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kikusempai/mpdf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kikusempai/mpdf 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
tfpdf
Removes invalid UTF-8 characters from the given text
Country Flag Emoji for PHP
A collection of PHP multi-byte string functions that are not present in the mb_string extension.
Provides TCPDF integration for Symfony
Alfabank REST API integration
统计信息
- 总下载量: 1.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2017-05-08