PHPackages                             agussaputrapro/ocrmypdf - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. agussaputrapro/ocrmypdf

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

agussaputrapro/ocrmypdf
=======================

A simple PHP wrapper for OCRmyPDF

0.1.3(4y ago)011AGPL-3.0-onlyPHPPHP ^7.1

Since May 31Pushed 4y agoCompare

[ Source](https://github.com/agussaputrasijabat/ocrmypdf-php)[ Packagist](https://packagist.org/packages/agussaputrapro/ocrmypdf)[ RSS](/packages/agussaputrapro-ocrmypdf/feed)WikiDiscussions main Synced 4w ago

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

ocrmypdf-php
============

[](#ocrmypdf-php)

A simple PHP wrapper for OCRmyPDF

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

[](#installation)

Via [Composer](http://getcomposer.org/):

```
$ composer require mishagp/ocrmypdf

```

**This library depends on [OCRmyPDF](https://github.com/jbarlow83/OCRmyPDF).** Please see the GitHub repository for instructions on how to install OCRmyPDF on your platform.

Usage
-----

[](#usage)

### Basic example

[](#basic-example)

```
use mishagp\OCRmyPDF\OCRmyPDF;

//Return file path of outputted, OCRed PDF
echo (new OCRmyPDF('document.pdf'))->run();

//Return file contents of outputted, OCRed PDF
echo (new OCRmyPDF('scannedImage.png'))->setOutputPDFPath(null)->run();
```

API
---

[](#api)

*This section is a work-in-progress.*

### setInputData

[](#setinputdata)

Pass image/PDF data loaded in memory into `ocrmypdf` directly via stdin.

```
use mishagp\OCRmyPDF\OCRmyPDF;

//Using Imagick
$data = $img->getImageBlob();
$size = $img->getImageLength();

//Using GD
ob_start();
imagepng($img, null, 0);
$size = ob_get_length();
$data = ob_get_clean();

echo (new OCRmyPDF())
    ->setInputData($data, $size)
    ->run();
```

### setOutputPDFPath

[](#setoutputpdfpath)

Specify a writable path where `ocrmypdf` should generate output PDF.

```
use mishagp\OCRmyPDF\OCRmyPDF;
echo (new OCRmyPDF('document.pdf'))
    ->setOutputPDFPath('/outputDir/ocr_document.pdf')
    ->run();
```

### setExecutable

[](#setexecutable)

Define a custom location of the `ocrmypdf` executable, if by any reason it is not present in the `$PATH`.

```
use mishagp\OCRmyPDF\OCRmyPDF;
echo (new OCRmyPDF('document.pdf'))
    ->setExecutable('/path/to/ocrmypdf')
    ->run();
```

License
-------

[](#license)

ocrmypdf-php is released under the [AGPL-3.0 License](https://github.com/mishagp/ocrmypdf-php/blob/main/LICENSE).

Credits
-------

[](#credits)

Development of ocrmypdf-php is based on the [tesseract-ocr-for-php](https://github.com/thiagoalessio/tesseract-ocr-for-php) PHP wrapper library for `tesseract`developed by [thiagoalessio](https://github.com/thiagoalessio) and associated contributors.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~126 days

Total

3

Last Release

1552d ago

PHP version history (2 changes)0.1.0PHP ^8.0

0.1.1PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/20fb8a7a101d54fc3d8690116e9f38912d2664602e88c8a67d2143b2b5dbbda0?d=identicon)[agussaputrasijabat](/maintainers/agussaputrasijabat)

---

Top Contributors

[![mishahawthorn](https://avatars.githubusercontent.com/u/6118330?v=4)](https://github.com/mishahawthorn "mishahawthorn (10 commits)")[![agussaputrasijabat](https://avatars.githubusercontent.com/u/29218081?v=4)](https://github.com/agussaputrasijabat "agussaputrasijabat (5 commits)")

---

Tags

phpwrapperOCRocrmypdf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/agussaputrapro-ocrmypdf/health.svg)

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

###  Alternatives

[zoon/rialto

Manage Node resources from PHP

12199.4k3](/packages/zoon-rialto)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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