PHPackages                             codeinc/pdf2txt-client - 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. codeinc/pdf2txt-client

Abandoned → [codeinc/document-cloud-client](/?search=codeinc%2Fdocument-cloud-client)ArchivedLibrary[PDF &amp; Document Generation](/categories/documents)

codeinc/pdf2txt-client
======================

A PHP client for the pdf2txt service

v1.13(1y ago)026MITPHPPHP &gt;=8.3

Since Feb 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/codeinchq/pdf2txt-php-client)[ Packagist](https://packagist.org/packages/codeinc/pdf2txt-client)[ Docs](https://github.com/codeinchq/pdf2txt-php-client)[ RSS](/packages/codeinc-pdf2txt-client/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (6)Versions (15)Used By (0)

Pdf2Txt PHP client
==================

[](#pdf2txt-php-client)

[![Code Inc.](https://camo.githubusercontent.com/bcdf9871ddda865b22fda872fa4c8ea0df96bdc95f20f26cba90ead355a2010e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6465253230496e632e2d506466325478742d626c7565)](https://github.com/codeinchq/pdf2txt)[![Tests](https://github.com/codeinchq/pdf2txt-php-client/actions/workflows/phpunit.yml/badge.svg)](https://github.com/codeinchq/pdf2txt-php-client/actions/workflows/phpunit.yml/badge.svg)

Important

This client is deprecated and is replaced by the [Document Cloud PHP Client](https://github.com/codeinchq/document-cloud-php-client)

This repository contains a PHP 8.2+ library for converting PDF files to text using the [pdf2txt](https://github.com/codeinchq/pdf2txt) service.

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

[](#installation)

The library is available on [Packagist](https://packagist.org/packages/codeinc/pdf2txt-client). The recommended way to install it is via Composer:

```
composer require codeinc/pdf2txt-client
```

Usage
-----

[](#usage)

This client requires a running instance of the [pdf2txt](https://github.com/codeinchq/pdf2txt) service. The service can be run locally [using Docker](https://hub.docker.com/r/codeinchq/pdf2txt) or deployed to a server.

### Examples

[](#examples)

#### Extracting text from a local file:

[](#extracting-text-from-a-local-file)

```
use CodeInc\Pdf2TxtClient\Pdf2TxtClient;
use CodeInc\Pdf2TxtClient\Exception;

$apiBaseUri = 'http://localhost:3000/';
$localPdfPath = '/path/to/local/file.pdf';

try {
    // convert
    $client = new Pdf2TxtClient($apiBaseUri);
    $stream = $client->extract(
        $client->createStreamFromFile($localPdfPath)
    );

    // display the text
    echo (string)$stream;
}
catch (Exception $e) {
    // handle exception
}
```

#### With additional options:

[](#with-additional-options)

```
use CodeInc\Pdf2TxtClient\Pdf2TxtClient;
use CodeInc\Pdf2TxtClient\ConvertOptions;
use CodeInc\Pdf2TxtClient\Format;

$apiBaseUri = 'http://localhost:3000/';
$localPdfPath = '/path/to/local/file.pdf';
$convertOption = new ConvertOptions(
    firstPage: 2,
    lastPage: 3,
    format: Format::json
);

try {
    $client = new Pdf2TxtClient($apiBaseUri);

    // convert
    $jsonResponse = $client->extract(
        $client->createStreamFromFile($localPdfPath),
        $convertOption
    );

   // display the text in a JSON format
   $decodedJson = $client->processJsonResponse($jsonResponse);
   var_dump($decodedJson);
}
catch (Exception $e) {
    // handle exception
}
```

#### Saving the extracted text to a file:

[](#saving-the-extracted-text-to-a-file)

```
use CodeInc\Pdf2TxtClient\Pdf2TxtClient;
use CodeInc\Pdf2TxtClient\ConvertOptions;
use CodeInc\Pdf2TxtClient\Format;

$apiBaseUri = 'http://localhost:3000/';
$localPdfPath = '/path/to/local/file.pdf';
destinationTextPath = '/path/to/local/file.txt';

try {
    $client = new Pdf2TxtClient($apiBaseUri);

    // convert
    $stream = $client->extract(
        $client->createStreamFromFile($localPdfPath)
    );

    // save the text to a file
    $client->saveStreamToFile($stream, $destinationTextPath);
}
catch (Exception $e) {
    // handle exception
}
```

License
-------

[](#license)

The library is published under the MIT license (see [`LICENSE`](LICENSE) file).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~22 days

Recently: every ~1 days

Total

14

Last Release

569d ago

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/8f72f949d7f70e400c02c225685f1934dec6219689f25edec38b4037df166d58?d=identicon)[codeinc](/maintainers/codeinc)

---

Top Contributors

[![joanfabregat](https://avatars.githubusercontent.com/u/4227907?v=4)](https://github.com/joanfabregat "joanfabregat (40 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codeinc-pdf2txt-client/health.svg)

```
[![Health](https://phpackages.com/badges/codeinc-pdf2txt-client/health.svg)](https://phpackages.com/packages/codeinc-pdf2txt-client)
```

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k28.0M315](/packages/openai-php-client)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[mailgun/mailgun-php

The Mailgun SDK provides methods for all API functions.

1.1k30.8M181](/packages/mailgun-mailgun-php)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3856.2M31](/packages/gotenberg-gotenberg-php)[deeplcom/deepl-php

Official DeepL API Client Library

2607.3M111](/packages/deeplcom-deepl-php)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M735](/packages/sylius-sylius)

PHPackages © 2026

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