PHPackages                             hub-io/laravel-pdf-to - 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. hub-io/laravel-pdf-to

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

hub-io/laravel-pdf-to
=====================

Laravel package for converting pdf to text, html or image

1.1.0(6mo ago)419[1 PRs](https://github.com/hub-io/laravel-pdf-to/pulls)MITPHPPHP ^8.3CI passing

Since Apr 29Pushed 4d ago2 watchersCompare

[ Source](https://github.com/hub-io/laravel-pdf-to)[ Packagist](https://packagist.org/packages/hub-io/laravel-pdf-to)[ Docs](https://github.com/hub-io/laravel-pdf-to)[ GitHub Sponsors](https://github.com/hub-io)[ Fund](https://opencollective.com/unknow-sk)[ RSS](/packages/hub-io-laravel-pdf-to/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (17)Versions (4)Used By (0)

Laravel PDF To
==============

[](#laravel-pdf-to)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)[![Latest Version on Packagist](https://camo.githubusercontent.com/4b1821e5a99ec723af6597990dde008350e4998f02bbb3305607dad9b59101ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6875622d696f2f6c61726176656c2d7064662d746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hub-io/laravel-pdf-to)[![GitHub Tests Action Status](https://camo.githubusercontent.com/233b347ce5d7ae1a5f6b2e0aeba815840a7406e54c4a858f650f1bc7a2e87a01/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6875622d696f2f6c61726176656c2d7064662d746f2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/hub-io/laravel-pdf-to/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/2ff732db034a63d63576d95f396549af5ac8f88ef68a3053d39f73bc001cb9f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6875622d696f2f6c61726176656c2d7064662d746f2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/hub-io/laravel-pdf-to/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/44d22ab7960ec24cb815eca4afab70a9e4be4fb9edd19c8681f6061f349b9321/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6875622d696f2f6c61726176656c2d7064662d746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hub-io/laravel-pdf-to)

Laravel package for extracting Text/Html from a PDF or converting it to images (PNG, JPeG).

Support us
----------

[](#support-us)

We invest a lot of time and give our hearts to work in [Open Source](https://hubio.sk).

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

[](#installation)

You can install the package via composer:

```
composer require hub-io/laravel-pdf-to
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-pdf-to-config"
```

This is the content of the published config file:

```
return [
    /**
     * Set the pdftotext binary path manually
     */
    'pdftotext_bin' => env('PDF_TO_TEXT_PATH'),

    /**
     * Set the pdftohtml binary path manually
     */
    'pdftohtml_bin' => env('PDF_TO_HTML_PATH'),

    /**
     * Set the pdftoppm binary path manually
     */
    'pdftoppm_bin' => env('PDF_TO_PPM_PATH'),

    /**
     * Set the pdftocairo binary path manually
     */
    'pdftocairo_bin' => env('PDF_TO_CAIRO_PATH'),

    /**
     * Set the default output directory
     */
    'output_dir' => env('PDF_TO_OUTPUT_DIR', storage_path('app/pdf-to')),
];
```

### Required Packages

[](#required-packages)

This package relies on the following external tools:

- **pdftotext**: For extracting text from PDFs.
- **pdftohtml**: For converting PDFs to HTML.
- **pdftoppm**: For generating images from PDFs.

Make sure these tools are installed and available in your system's PATH. On macOS, you can install them via Homebrew:

```
brew install poppler
```

### Binary Files Configuration

[](#binary-files-configuration)

By default, the package attempts to locate the required binary files (`pdftotext`, `pdftohtml`, `pdftoppm`, or `pdftocairo`) automatically. If these binaries are not found in your system's PATH, you will need to set their paths manually in the configuration file.

You can update the configuration file `config/pdf-to.php` as follows:

```
return [
    'pdftotext_bin' => env('PDF_TO_TEXT_PATH'),
    'pdftohtml_bin' => env('PDF_TO_HTML_PATH'),
    'pdftoppm_bin' => env('PDF_TO_PPM_PATH'),
    'pdftocairo_bin' => env('PDF_TO_CAIRO_PATH'),
];
```

### Alternative Libraries

[](#alternative-libraries)

For text extraction, this package uses the [Spatie/pdf-to-text](https://github.com/spatie/pdf-to-text). However, if you don't have `pdftoppm` or `pdftocairo` installed, you can also use the [Spatie/pdf-to-image](https://github.com/spatie/pdf-to-image) for image generation. This provides a fallback mechanism to ensure functionality even without the required binaries.

Usage
-----

[](#usage)

### Extract Text from PDF

[](#extract-text-from-pdf)

```
use Hubio\LaravelPdfTo\Facades\LaravelPdfTo;

$text = LaravelPdfTo::setFile('path/to/your/file.pdf')
    ->setTimeout(120) // optionally
    ->result('txt');
echo $text;
```

### Convert PDF to HTML

[](#convert-pdf-to-html)

```
use Hubio\LaravelPdfTo\Facades\LaravelPdfTo;

$html = LaravelPdfTo::setFile('path/to/your/file.pdf')
    ->setConfig(['options' => [...]]) // optionally
    ->saveAs('output-file') // optionally, if you wan to store as file, then result returns path
    ->result('html');
echo $html;
```

### Convert PDF to Images

[](#convert-pdf-to-images)

```
use Hubio\LaravelPdfTo\Facades\LaravelPdfTo;

$image = LaravelPdfTo::setFile('path/to/your/file.pdf')
    ->setTimeout(180) // optionally
    ->result('png');
echo $image; // Path to the generated image
```

Testing
-------

[](#testing)

To run the tests, use the following command:

```
composer test
```

The tests include functionality for extracting text, converting to HTML, and generating images from PDFs. Example test files are located in the `tests/` directory.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Hubio s.r.o.](https://github.com/hub-io)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance85

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.9% 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 ~216 days

Total

2

Last Release

207d ago

PHP version history (2 changes)1.0.0PHP ^8.2

1.1.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/1862f15593473b7d5ebb4f6c77b345c81d85ba32322f5342069bd8e94ad46cee?d=identicon)[hubio](/maintainers/hubio)

---

Top Contributors

[![hamrak](https://avatars.githubusercontent.com/u/5807028?v=4)](https://github.com/hamrak "hamrak (50 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![hamrakp](https://avatars.githubusercontent.com/u/20298517?v=4)](https://github.com/hamrakp "hamrakp (1 commits)")

---

Tags

laravellaravel-pdf-to-htmllaravel-pdf-tolaravel-pdf-to-textlaravel-pdf-to-imagelaravel-pdf-to-pnglaravel-pdf-to-jpgHubio s.r.o.

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/hub-io-laravel-pdf-to/health.svg)

```
[![Health](https://phpackages.com/badges/hub-io-laravel-pdf-to/health.svg)](https://phpackages.com/packages/hub-io-laravel-pdf-to)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M280](/packages/laravel-horizon)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)

PHPackages © 2026

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