hanaddi/pena 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hanaddi/pena

最新稳定版本:1.0.7

Composer 安装命令:

composer require hanaddi/pena

包简介

Simplify the process of writing document as an image using PHP GD.

README 文档

README

GitHub Release GitHub License PHP Version CI Coverage

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:

Example table

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:

Example table

Created with Pena

Coverage

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-16