PHPackages                             kristos80/piima - 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. kristos80/piima

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

kristos80/piima
===============

A, really, simple utility for working with PDF files

1.0.2(5y ago)05MITPHP

Since May 12Pushed 5y ago1 watchersCompare

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

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

[![Maintainability Rating](https://camo.githubusercontent.com/6389e5a40a170a9eef1c62f0fa6068db5824b37ad56bdeb2daff80a10e28d8f6/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6b726973746f7338305f7069696d61266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/dashboard?id=kristos80_piima)[![Reliability Rating](https://camo.githubusercontent.com/955344de2792ce53654875a7ac37f5175c47bc27f3773fae939fafe839b03c42/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6b726973746f7338305f7069696d61266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/dashboard?id=kristos80_piima)[![Security Rating](https://camo.githubusercontent.com/ffdd6eab55c0b40f6e7c3c8ce386b6cea12644b9b438acc4619923651b24e267/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6b726973746f7338305f7069696d61266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/dashboard?id=kristos80_piima)[![Vulnerabilities](https://camo.githubusercontent.com/ee62256d8f254fae064796cce6b35831d026180ed542690fe2916c586299c861/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6b726973746f7338305f7069696d61266d65747269633d76756c6e65726162696c6974696573)](https://sonarcloud.io/dashboard?id=kristos80_piima)[![Bugs](https://camo.githubusercontent.com/7c612b1a88151fca83a9b236336c574afc5a7700189e6851a7916bacb9faeac0/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6b726973746f7338305f7069696d61266d65747269633d62756773)](https://sonarcloud.io/dashboard?id=kristos80_piima)[![CodeScene Code Health](https://camo.githubusercontent.com/bda1c6d301afde3aa13e245ed19995fb78deb92c27950b70ea7412193b5465e4/68747470733a2f2f636f64657363656e652e696f2f70726f6a656374732f31353630352f7374617475732d6261646765732f636f64652d6865616c7468)](https://codescene.io/projects/15605)[![CodeScene System Mastery](https://camo.githubusercontent.com/05cb1bfc21cec32904a349def181860873fb9c9ba5e9f51ec8cf4cb7841da149/68747470733a2f2f636f64657363656e652e696f2f70726f6a656374732f31353630352f7374617475732d6261646765732f73797374656d2d6d617374657279)](https://codescene.io/projects/15605)[![Codacy Badge](https://camo.githubusercontent.com/1acac14d39805a95a30760ba787d6e0342ff36cb3c032e6516e9f2b747fe76ef/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6261343331383662373863643433373239363932663233333834376137643464)](https://app.codacy.com/gh/kristos80/piima?utm_source=github.com&utm_medium=referral&utm_content=kristos80/piima&utm_campaign=Badge_Grade_Settings)

Piima
=====

[](#piima)

A, really, simple utility for working with PDF files.

For now it can do 2 distinct things (see public methods):

1. Convert any page of a PDF file to an image
2. Calculate the total pages of a PDF file

Dependencies
------------

[](#dependencies)

The package is dependent on `ghostscript`

Public methods
--------------

[](#public-methods)

#### public static extractImage(string $pdf, string $image, int $page = 1, bool $silent = FALSE) : bool

[](#public-static-extractimagestring-pdf-string-image-int-page--1-bool-silent--false--bool)

```
// Creates an image from the first page of the pdf file
// and returns `TRUE` or FALSE or throws an exception
$thumbnailCreated = Piima::extractImage($pdf, $image);

// Creates an image from the 5th page of the pdf file
// and returns `TRUE` or FALSE or throws an exception
$thumbnailCreated = Piima::extractImage($pdf, $image, 5);

// Creates an image from the 5th page of the pdf file
// and returns `TRUE` or `FALSE` without throwing an exception
$thumbnailCreated = Piima::extractImage($pdf, $image, 5, TRUE);
```

#### public static calculateTotalPages(string $pdf, bool $silent = FALSE): int

[](#public-static-calculatetotalpagesstring-pdf-bool-silent--false-int)

```
// Calculates total page of PDF file as an integer
// and returns it or throws an exception
Piima::calculateTotalPages($pdf);

// Calculates total page of PDF file as an integer
// and returns it without throwing an exception
Piima::calculateTotalPages($pdf, TRUE);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% 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 ~0 days

Total

2

Last Release

1828d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/afb9f588fc03038aadb7d1b9509832b16d165e3b34310337efbcb702a37a8657?d=identicon)[kristos80](/maintainers/kristos80)

---

Top Contributors

[![kristos80](https://avatars.githubusercontent.com/u/13762144?v=4)](https://github.com/kristos80 "kristos80 (16 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")

### Embed Badge

![Health badge](/badges/kristos80-piima/health.svg)

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

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[mikehaertl/phpwkhtmltopdf

A slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface

1.6k20.0M44](/packages/mikehaertl-phpwkhtmltopdf)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[mikehaertl/php-pdftk

A PDF conversion and form utility based on pdftk.

1.0k10.9M11](/packages/mikehaertl-php-pdftk)

PHPackages © 2026

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