PHPackages                             earthlinginteractive/oophpdf - 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. earthlinginteractive/oophpdf

ActiveLibrary

earthlinginteractive/oophpdf
============================

An object-oriented wrapper for writing PDF documents using PHP and TCPDF

v0.0.5(9y ago)16.5k1[3 issues](https://github.com/EarthlingInteractive/OOPHPDF/issues)MITPHP

Since May 13Pushed 9y ago5 watchersCompare

[ Source](https://github.com/EarthlingInteractive/OOPHPDF)[ Packagist](https://packagist.org/packages/earthlinginteractive/oophpdf)[ RSS](/packages/earthlinginteractive-oophpdf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (8)Used By (0)

OOPHPDF
=======

[](#oophpdf)

An object-oriented wrapper for writing PDF documents using PHP and TCPDF

Description
-----------

[](#description)

OOPHPDF is a PHP library that provides an object-oriented interface to common TCPDF drawing methods. Examples of implemented objects include the MultiCell, Image, and a basic Table with Rows that contain cells. Instead of directly calling TCPDF methods to draw items, you create an object that represents the item you want to draw, configure it, query it as needed, then draw it.

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

[](#installation)

OOPHPDF can be installed as a Composer module. If you're using Composer, you can install it with:

```
composer require earthlinginteractive/oophpdf

```

Why?
----

[](#why)

TCPDF is great for writing PDF documents, but its state-based design can be limiting when writing complex documents.

For example, try writing two MultiCell boxes side-by-side with different fonts, but make the height of both match the height of the tallest, so that they are only as tall as needed to fit the text of both. You'd need to set up the context for each box, determine its height, determine the largest height, then draw both boxes (which involves setting up the context for each again).

This library simplifies the problem by treating each item on the PDF as an object.

Using this library, you would create and configure an object for each box, find the height of each, determine the largest height, set that height on both boxes, then draw them. You're no longer responsible for setting up and restoring context; the objects maintain their own contexts.

Example
-------

[](#example)

This example implements the problem described in the "Why" section, where two boxes of text with different font sizes are written next to each other with the same height.

The code below assumes the TCPDF object is already created with units in inches and a blank page in portrait Letter size. It also assumes you will output the PDF document afterwards. See the full example in `example.php`.

```
// create the left box
$leftBox = new OOPHPDF_MultiCell($pdf);
$leftBox
	->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.")
	->setFontSize(24)
	->setFontStyle('B')
	->setFillColorArray(array(255, 200, 200)) // light red
	->setLn(0)
	->setWidth(3.75)
	->setHeightToAuto();

// create the right box
$rightBox = new OOPHPDF_MultiCell($pdf);
$rightBox
	->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
	->setFontSize(16)
	->setFontStyle('I')
	->setFillColorArray(array(200, 200, 255)) // light blue
	->setLn(0)
	->setWidth(3.75)
	->setHeightToAuto();

// find the height of the tallest box
$maxHeight = max($leftBox->getHeight(), $rightBox->getHeight());

// make both boxes use the tallest height
$leftBox->setHeight($maxHeight);
$rightBox->setHeight($maxHeight);

// draw both boxes
$leftBox->drawAtPosition(0.5, 1);
$rightBox->drawAtPosition(4.25, 1);

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~37 days

Total

5

Last Release

3497d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e35cbadf9ea196e4148789f479f1c5569696ace5e5c2ddf6189cb092db62c35?d=identicon)[djolly](/maintainers/djolly)

---

Top Contributors

[![GChildsEi](https://avatars.githubusercontent.com/u/21046155?v=4)](https://github.com/GChildsEi "GChildsEi (8 commits)")[![mhiley](https://avatars.githubusercontent.com/u/1490630?v=4)](https://github.com/mhiley "mhiley (3 commits)")[![djolly](https://avatars.githubusercontent.com/u/4581037?v=4)](https://github.com/djolly "djolly (1 commits)")

### Embed Badge

![Health badge](/badges/earthlinginteractive-oophpdf/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[spipu/html2pdf

Html2Pdf is a HTML to PDF converter written in PHP - It uses TCPDF - OFFICIAL PACKAGE

1.8k10.6M44](/packages/spipu-html2pdf)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[iio/libmergepdf

Library for merging multiple PDFs

40813.6M13](/packages/iio-libmergepdf)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)

PHPackages © 2026

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