PHPackages                             r0adrunn3r/easy-pnp - 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. r0adrunn3r/easy-pnp

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

r0adrunn3r/easy-pnp
===================

EasyPnP is a PHP class which allows to generate easily a PDF for PnP (Print and Play) Games from images.

0.6.2(6y ago)63AGPL-3.0PHP

Since Jul 18Pushed 6y ago2 watchersCompare

[ Source](https://github.com/R0adRunn3r/easy-pnp)[ Packagist](https://packagist.org/packages/r0adrunn3r/easy-pnp)[ Docs](https://github.com/R0adRunn3r/easy-pnp)[ RSS](/packages/r0adrunn3r-easy-pnp/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

EasyPnP
=======

[](#easypnp)

EasyPnP is a PHP class which allows to generate easily a PDF for PnP (Print and Play) Games. I made it for helping me generate precise pdf from a set of card and tokens images for some of my projects becouse I'd like to have more control, so i decided to share it, maybe someone will find it useful.

Obviously this class is far from perfect but gets the job done for me :) the only dependency is [fpdf](http://www.fpdf.org/)

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

[](#installation)

### Download from github

[](#download-from-github)

You can just download the class from github and use it in your project, the only dependency is [fpdf](http://www.fpdf.org/) so make sure to require it!

### Composer

[](#composer)

If you're using Composer to manage dependencies, you can use

`$ composer require r0adrunn3r/easy-pnp`

or you can include the following in your composer.json:

```
{
    "require": {
        "r0adrunn3r/easy-pnp": ">=0.6.1"
    }
}
```

How to use
----------

[](#how-to-use)

The unit of measurement is mm (I'm Italian) but the underlying fpdf supports inches too, modify the class to support other units is not too hard, if someone needs it and doesn't know how, just open an issue and I will add it :)

Example use with various configurations:

```
require_once('./fpdf.php');
require_once('./EasyPnP.php');

$card_width = 30; // 30mm
$card_height = 60; //60mm

//Arguments are the padding of the pages and the margins of the images respectively.
$epnp = new  EasyPnP(5,3);

//You can use URLs or Paths
$img_array = array(
    "http://mysite.com/cards/image1.png",
    "http://mysite.com/cards/image2.png",
    "./cards/image3.png"
);

$epnp->WriteImages($card_width, $card_height, $img_array);

//----------------------------------------------------

//Static helper method for generating an array of imgs paths from a folder
$img_array_folder = EasyPnP::FilesArrayFromDir("./cards");

$epnp->WriteImages($card_width, $card_height, $img_array_folder);

//----------------------------------------------------

/*If your images are organized with a sequence number you can use the FilesArrayFromPattern static helper method
This call for exaple is equivalent to:
$array_img_pattern = array(
    "./tokens/token_2.png",
    "./tokens/token_3.png",
    "./tokens/token_4.png",
    "./tokens/token_5.png",
    "./tokens/token_6.png",
);

5 images, counter starts from 2
*/
$array_img_pattern = EasyPnP::FilesArrayFromPattern("./tokens/token_%.png",5, 2);

$epnp->WriteImages(20, 20, $array_img_pattern);

//----------------------------------------------------

//You can also use generated images (with PHP GD for example) but *BEFORE* use them make sure to specify the type of file to EasyPnP
$epnp->SetFileType('png');
$img_array_php = array("http://xyz.com/cards.php?id=45","http://xyz.com/cards.php?id=47");

$epnp->WriteImages($card_width, $card_height, $img_array_php);

//----------------------------------------------------

//You can also create a front & back pdf ready to print, the fourth argument can be a single image path or an array of backs, if so the array of front and the array of backs must have the same size
$epnp->WriteImagesDoubleSide($card_width, $card_height, $img_array, "./back.png");

//----------------------------------------------------

//After all the images are writed out you can output the pdf, the first argument is for forcing the download instead of opend it inside the browser.
$pdf->GeneratePDF(true, "printable.pdf");
```

You can find more examples in the `examples` folder, ready for testing (included a version of fpdf).

All the cards in the example folder are from

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

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

Unknown

Total

1

Last Release

2490d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9199cbfe57a94cb0bf57445776ea5d629c17309cd3ef056d49ab4d129e4714d8?d=identicon)[R0adRunn3r](/maintainers/R0adRunn3r)

---

Top Contributors

[![R0adRunn3r](https://avatars.githubusercontent.com/u/9808279?v=4)](https://github.com/R0adRunn3r "R0adRunn3r (6 commits)")

---

Tags

pdffpdfcardgametabletoppnpcardgame

### Embed Badge

![Health badge](/badges/r0adrunn3r-easy-pnp/health.svg)

```
[![Health](https://phpackages.com/badges/r0adrunn3r-easy-pnp/health.svg)](https://phpackages.com/packages/r0adrunn3r-easy-pnp)
```

###  Alternatives

[setasign/fpdi

FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.

1.2k142.4M231](/packages/setasign-fpdi)[setasign/fpdf

FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

77263.8M227](/packages/setasign-fpdf)[setasign/fpdi-protection

A FPDI compatible version of the FPDF\_Protection script.

324.3M2](/packages/setasign-fpdi-protection)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[tmw/fpdm

PDF form filling using FPDM Class written by FPDF author Olivier

129623.6k3](/packages/tmw-fpdm)[fpdf/fpdf

FPDF Composer Wrapper

512.7M22](/packages/fpdf-fpdf)

PHPackages © 2026

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