royalty/chrome-pdf
Composer 安装命令:
composer require royalty/chrome-pdf
包简介
Chrome PHP wrapper for generating PDF files easily
README 文档
README
ChromePDF is an very simple Chrome PDF wrapper, written in PHP
This library is inspired by DomPDF, attempting to retain most of the applicable syntax that it uses, while reducing the amount of effort needed in development. It also aims to reduce the external dependency that comes along with using other (excellent) libraries like PuPHPeteer and chrome-php/chrome.
Features
- Works
Requirements
- PHP version 7.1 or higher
- Chrome
Easy Installation
Install with composer
To install with Composer, simply require the latest version of this package.
composer require royalty/chrome-pdf
Make sure that the autoload file from Composer is loaded.
// somewhere early in your project's loading, require the Composer autoloader // see: http://getcomposer.org/doc/00-intro.md require 'vendor/autoload.php';
Install with git
From the command line, switch to the directory where ChromePDF will reside and run the following commands:
git clone https://github.com/runbiscuit/ChromePDF.git
Require ChromePDF and it's dependencies in your PHP.
Quick Start
Just pass your HTML in to ChromePDF and save the output:
// reference the ChromePDF namespace use Royalty\ChromePDF\ChromePDF; // instantiate and use the ChromePDF class $chromepdf = new ChromePDF(); $chromepdf->loadHtml('<h1>Hello world! If you can see this, this library works!</h1>'); // Save the pdf $chromepdf->save('output.pdf');
Setting Options
Set options anytime before running save(string $output_path):
| Method Signature | Description (default is bolded) |
|---|---|
setGPUAcceleration(bool $setting) |
Set GPU Acceleration (on/off) |
setMargins(bool $setting) |
Set Margins (on/off) |
setPDFHeaders(bool $setting) |
Set PDF Headers (on/off) |
setWindowSize($width, $height) |
Set Window Size (default: 800x600) |
setRenderWait($duration = 0) |
Set Render Wait (timeout before loading, default: 0) |
improveRenderingQuality(bool $setting = true) |
Improve Rendering Quality (on/off) |
License
This project is licensed under the The MIT License (MIT).
royalty/chrome-pdf 适用场景与选型建议
royalty/chrome-pdf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 royalty/chrome-pdf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 royalty/chrome-pdf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-14