PHPackages                             gruz/gvc-pdf2pdf - 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. gruz/gvc-pdf2pdf

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

gruz/gvc-pdf2pdf
================

Overlay text from Google Vision Cloud (OCR) over the original PDF-as-image

8392PHP

Since Jun 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/gruz/gcv-pdf2pdf)[ Packagist](https://packagist.org/packages/gruz/gvc-pdf2pdf)[ RSS](/packages/gruz-gvc-pdf2pdf/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Overlay text from Google Vision Cloud (OCR) over the original PDF-as-image to create a searchable pdf
=====================================================================================================

[](#overlay-text-from-google-vision-cloud-ocr-over-the-original-pdf-as-image-to-create-a-searchable-pdf)

When needed
-----------

[](#when-needed)

You have a PDF as image. You have recognized the text by Google vision cloud (gvc) OCR service. And now want to apply the text to the pdf to make it searchable.

> Note! This too makes sense only for PDFs recognized with GVC. For images recognized by GVC you can use better toosls like \[\]. You may also try to use \[\]. I failed to learn Japaneese.

Problems
--------

[](#problems)

It's not possible to use the same font and the same size of text so the text is added approximately to the same place, where it's on image. Do not expect 100% good resut.

Quick Examples
--------------

[](#quick-examples)

In `exmaples` folder you can find in pair of files (PDF-as-image and generater by Google vision cloud JSON) and a couple of out files (for production with hidden text and for debug with visible text).

To get the idea see a video demonstrating results \[\]

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

[](#installation)

> Surely you need PHP.

To use in your project:

```
composer require gruz/gvc-pdf2pdf
```

OR

```
git clone git@github.com:gruz/gcv-pdf2pdf.git
cd gcv-pdf2pdf
composer install
```

Usage
-----

[](#usage)

Check the code, usage is obvious. For quick start:

```
use GvcPdf2Pdf\PdfTextApply;

$jsonFile = __DIR__ .'/01-in-google-vision-cloud.json';
$pdfSourceFile = __DIR__ .'/01-in-pdf-as-image.pdf';

$pdfOutFile1 = __DIR__ .'/01-out-pdf-with-text-hidden.pdf';
$pdf = new PdfTextApply($jsonFile, $pdfSourceFile, $pdfOutFile1);
$pdf->watermark->text = 'gruz.ml';
$pdf->run();
```

Running example
---------------

[](#running-example)

### Singe file

[](#singe-file)

Go to the project folder if not there and run

```
php example/example.php
```

This will (renerate) `example/01-out-pdf-with-text-hidden.pdf` and `example/01-out-pdf-with-text-visible-for-debug.pdf` files.

### Folder

[](#folder)

Go to the project folder if not there and run

```
php example/example-folder.php
```

It uses files pairs placed in `example/in/` and generates output to `example/out/`

As a result you get regenerated out pdfs.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![gruz](https://avatars.githubusercontent.com/u/422942?v=4)](https://github.com/gruz "gruz (19 commits)")

### Embed Badge

![Health badge](/badges/gruz-gvc-pdf2pdf/health.svg)

```
[![Health](https://phpackages.com/badges/gruz-gvc-pdf2pdf/health.svg)](https://phpackages.com/packages/gruz-gvc-pdf2pdf)
```

###  Alternatives

[tarfin-labs/easy-pdf

Makes pdf processing easy.

1719.9k](/packages/tarfin-labs-easy-pdf)

PHPackages © 2026

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