PHPackages                             hanaddi/pena - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. hanaddi/pena

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

hanaddi/pena
============

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

1.0.7(2y ago)012MITPHPPHP &gt;=7.4.0

Since Jun 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hanaddi/pena)[ Packagist](https://packagist.org/packages/hanaddi/pena)[ RSS](/packages/hanaddi-pena/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (2)Versions (14)Used By (0)

hanaddi/pena
============

[](#hanaddipena)

[![GitHub Release](https://camo.githubusercontent.com/3747ceddee08a5501bbc24e23ca0425cb9a3469422f904ef93afc0df05f3e0be/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f68616e616464692f70656e613f696e636c7564655f70726572656c656173657326646973706c61795f6e616d653d746167)](https://packagist.org/packages/hanaddi/pena)[![GitHub License](https://camo.githubusercontent.com/82bcab37b2d6331a930bd2634ddaca7a99cc4a54aa958e021f01ffa6aab55e5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f68616e616464692f70656e61)](https://camo.githubusercontent.com/82bcab37b2d6331a930bd2634ddaca7a99cc4a54aa958e021f01ffa6aab55e5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f68616e616464692f70656e61)[![PHP Version](https://camo.githubusercontent.com/9721eea112f48e95517a7883fb958e49e75187096bb3db0dfe54f77f700532e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f68616e616464692f70656e612f706870)](https://camo.githubusercontent.com/9721eea112f48e95517a7883fb958e49e75187096bb3db0dfe54f77f700532e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f68616e616464692f70656e612f706870)[![CI](https://github.com/hanaddi/pena/actions/workflows/ci.yml/badge.svg)](https://github.com/hanaddi/pena/actions/workflows/ci.yml)[![Coverage](https://raw.githubusercontent.com/hanaddi/pena/gh-pages/coverage.svg)](https://raw.githubusercontent.com/hanaddi/pena/gh-pages/coverage.svg)

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

Installation
------------

[](#installation)

You can add this library to your project using [Composer](https://getcomposer.org/):

```
composer require hanaddi/pena
```

Example
-------

[](#example)

### Writing simple paragraphs:

[](#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](https://raw.githubusercontent.com/hanaddi/pena/main/examples/images/paragraph-sample.png)](https://raw.githubusercontent.com/hanaddi/pena/main/examples/images/paragraph-sample.png)

### Make a 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](https://raw.githubusercontent.com/hanaddi/pena/main/examples/images/table-simple.png)](https://raw.githubusercontent.com/hanaddi/pena/main/examples/images/table-simple.png)

Created with Pena
-----------------

[](#created-with-pena)

[![Coverage](https://raw.githubusercontent.com/hanaddi/pena/gh-pages/coverage.png)](https://raw.githubusercontent.com/hanaddi/pena/gh-pages/coverage.png)

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

12

Last Release

747d ago

PHP version history (2 changes)1.0.2-alpha.1PHP &gt;=5.3.0

1.0.6.1PHP &gt;=7.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15964033?v=4)[Fat Han Nuraddin](/maintainers/hanaddi)[@hanaddi](https://github.com/hanaddi)

---

Top Contributors

[![hanaddi](https://avatars.githubusercontent.com/u/15964033?v=4)](https://github.com/hanaddi "hanaddi (56 commits)")

---

Tags

phpgdtextdocument

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hanaddi-pena/health.svg)

```
[![Health](https://phpackages.com/badges/hanaddi-pena/health.svg)](https://phpackages.com/packages/hanaddi-pena)
```

###  Alternatives

[daandesmedt/phpheadlesschrome

A PHP wrapper for using Google Chrome Headless mode. Convert URL or HTML to a PDF / screenshot. Easy to use and OOP interfaced.

92255.6k](/packages/daandesmedt-phpheadlesschrome)[kiwilan/php-ebook

PHP package to read metadata and extract covers from eBooks, comics and audiobooks.

3918.3k3](/packages/kiwilan-php-ebook)[irebega/docx-replacer

PHP extension that allow you replace text to text or text to image in DOCX file

1435.9k](/packages/irebega-docx-replacer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
