hanaddi/pena
最新稳定版本:1.0.7
Composer 安装命令:
composer require hanaddi/pena
包简介
Simplify the process of writing document as an image using PHP GD.
关键字:
README 文档
README
Simplify the process of writing document as an image using PHP GD.
Installation
You can add this library to your project using Composer:
composer require hanaddi/pena
Example
Writing simple paragraphs:
use Hanaddi\Pena; $doc = new Pena([400, 300], ['margin' => 10]); $text = "eget nulla facilisi etiam dignissim diam quis enim lobortis scelerisque fermentum dui faucibus in ornare " . "quam viverra orci sagittis eu volutpat odio facilisis mauris sit amet massa vitae tortor condimentum"; $doc->write($text, ["align" => "center", "lspace" => 1.5]) ->lineSpace() ->write($text, ["color" => [255, 0, 0], "lspace" => 1.5]) ->lineSpace() ->write($text, ["align" => "justify", "lspace" => 1.5, "bgcolor" => [0, 255, 255]]); // Output as image header('Content-Type: image/png'); imagepng($doc->document); imagedestroy($doc->document);
Result:
Make a table:
use Hanaddi\Pena; $doc = new Pena([300, 150], ['margin' => 10]); $doc->tableNew( [ 'columns' => 2, 'width' => 280, 'cellwidth' => [1, 3], 'padding' => 10, ]) ->tableRow( [['text' => 'No.'], ['text' => 'Name']], ['bgcolor' => [250, 200, 0], 'align' => 'center'] ) ->tableRow([['text' => '1.'], ['text' => 'Alpha']]) ->tableRow([['text' => '2.'], ['text' => 'Beta']]) ->tableRow([['text' => '3.'], ['text' => 'Charlie']]) ->tableDraw(); // Output as image header('Content-Type: image/png'); imagepng($doc->document); imagedestroy($doc->document);
Result:
Created with Pena
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-16


