PHPackages                             squareetlabs/laravel-pdf-to-html - 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. squareetlabs/laravel-pdf-to-html

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

squareetlabs/laravel-pdf-to-html
================================

Laravel package to convert PDF to HTML without external dependencies

v1.4(5mo ago)0100[1 issues](https://github.com/squareetlabs/LaravelPDF2HTML/issues)MITPHPPHP &gt;=8.1

Since Jan 8Pushed 5mo agoCompare

[ Source](https://github.com/squareetlabs/LaravelPDF2HTML)[ Packagist](https://packagist.org/packages/squareetlabs/laravel-pdf-to-html)[ RSS](/packages/squareetlabs-laravel-pdf-to-html/feed)WikiDiscussions main Synced today

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

Laravel PDF to HTML Converter
=============================

[](#laravel-pdf-to-html-converter)

A robust and dependency-free Laravel package to convert PDF files to HTML using `poppler-utils` (pdftohtml).

Features
--------

[](#features)

- **Dependency Free**: Does not rely on external PHP packages.
- **Laravel Integration**: Automatic discovery, config publishing, and easy-to-use API.
- **Binary Auto-Discovery**: Automatically finds `pdftohtml` and `pdfinfo` binaries on your system.
- **Customizable**: Extensive options for zooming, image handling, and output formatting.
- **Inline Assets**: Automatically inlines CSS and Images (Base64) for a self-contained HTML output.
- **Strict Types**: Written with modern PHP standards and strict typing.

Requirements
------------

[](#requirements)

- PHP &gt; 8.1
- `poppler-utils` installed on your server (contains `pdftohtml` and `pdfinfo`).

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

[](#installation)

1. **Install via Composer**:

    ```
    composer require squareetlabs/laravel-pdf-to-html
    ```
2. **Install `poppler-utils`**:

    - **Ubuntu/Debian**: ```
        sudo apt-get install poppler-utils
        ```
    - **MacOS**: ```
        brew install poppler
        ```
    - **CentOS/RHEL**: ```
        sudo yum install poppler-utils
        ```
3. **Publish Configuration (Optional)**:

    ```
    php artisan vendor:publish --provider="Squareetlabs\LaravelPdfToHtml\Providers\PdfToHtmlServiceProvider"
    ```

Usage
-----

[](#usage)

### Using Facade (Recommended)

[](#using-facade-recommended)

```
use PdfToHtml;

try {
    // Load a PDF file using the facade
    $pdf = PdfToHtml::load('/path/to/document.pdf');

    // Get HTML content
    $html = $pdf->getHtml();

    // Get all pages content as an array
    $pages = $html->getAllPages();

    // Get specific page
    $page1 = $html->getPage(1);

    echo $page1;

} catch (\Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

### Using Direct Class Instantiation

[](#using-direct-class-instantiation)

```
use Squareetlabs\LaravelPdfToHtml\Support\Pdf;

try {
    // Create a new instance
    $pdf = new Pdf('/path/to/document.pdf');

    // Get HTML content
    $html = $pdf->getHtml();

    // Get all pages content as an array
    $pages = $html->getAllPages();

    // Get specific page
    $page1 = $html->getPage(1);

    echo $page1;

} catch (\Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

### Advanced Options

[](#advanced-options)

You can pass options to customize the behavior:

```
$options = [
    'pdftohtml_path' => '/usr/custom/bin/pdftohtml', // Optional custom path
    'pdfinfo_path' => '/usr/custom/bin/pdfinfo',     // Optional custom path
    'generate' => [
        'singlePage' => false,      // Split pages (default)
        'imageJpeg' => true,        // Convert images to JPEG
        'ignoreImages' => false,    // Keep images
        'zoom' => 1.5,              // Zoom factor
        'noFrames' => true,         // Output without frames
    ],
    'html' => [
        'inlineCss' => true,        // Inline CSS into style attributes
        'inlineImages' => true,     // Convert images to Base64
        'onlyContent' => true,      // Return only body content
    ],
    'clearAfter' => true,           // Clear temp files after processing
];

// Using Facade
$pdf = PdfToHtml::load('/path/to/document.pdf', $options);

// Or using direct instantiation
$pdf = new Pdf('/path/to/document.pdf', $options);
```

### Get PDF Info

[](#get-pdf-info)

```
$info = $pdf->getInfo();
// Returns array: ['pages' => 10, 'size' => '...', ...]

$count = $pdf->countPages();
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance71

Regular maintenance activity

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

Total

5

Last Release

163d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f0312df8043f114ad6f9c945a452d4e451bd14cecae570f9772ce937630bce5?d=identicon)[squareetlabs](/maintainers/squareetlabs)

---

Top Contributors

[![jcancig](https://avatars.githubusercontent.com/u/446610?v=4)](https://github.com/jcancig "jcancig (5 commits)")

---

Tags

laravelpdfexporthtmlconvertertransformpopplerpdftohtmlpdf2html

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[paperdoc-dev/paperdoc-lib

A zero-dependency PHP library for generating, parsing and converting documents (PDF, HTML, CSV, DOCX)

1253.7k](/packages/paperdoc-dev-paperdoc-lib)[danielboendergaard/phantom-pdf

A Package for generating PDF files using PhantomJS

72478.7k](/packages/danielboendergaard-phantom-pdf)[nilgems/laravel-textract

A Laravel package to extract text from files like DOC, XL, Image, Pdf and more. I've developed this package by inspiring "npm textract".

195.8k](/packages/nilgems-laravel-textract)[phpnt/yii2-export

Yii2 It saves data in xls, csv, word, html, pdf files.

158.9k](/packages/phpnt-yii2-export)

PHPackages © 2026

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