phppdf/html-converter
Composer 安装命令:
composer require phppdf/html-converter
包简介
Convert HTML and CSS into PDF documents on top of phppdf/phppdf
README 文档
README
Convert HTML and CSS into PDF documents on top of phppdf/phppdf.
Requirements
- PHP 8.4+
ext-domext-libxml
Installation
composer require phppdf/html-converter
Documentation
The documentation can be found here: https://phppdf.github.io/html-converter/
Quick start
use PhpPdf\Html\HtmlConverter; use PhpPdf\Output\PdfMemoryOutput; use PhpPdf\Serialization\PdfDocumentSerializer; $html = '<h1>Hello World</h1><p>Welcome to the PDF.</p>'; $document = HtmlConverter::fromHtml($html)->build(); $output = new PdfMemoryOutput(); (new PdfDocumentSerializer($output))->writeDocument($document); header('Content-Type: application/pdf'); echo $output->getContent();
Because HtmlConverter::fromHtml() returns a plain PdfDocumentBuilder, you can prepend or
append pages, add metadata/encryption/signatures, and apply compression before serialising.
Examples
Working examples live in the examples repository: https://github.com/phppdf/examples
Development
composer install composer phpunit composer phpunit:coverage composer phpcs composer phpstan
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-17