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

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

moinul/laravel-pdf-to-html
==========================

A Laravel package to convert PDF files to HTML using poppler-utils

v1.3.1(1y ago)070MITPHPPHP ^8.2

Since Apr 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/moinulict/laravel-pdf-to-html)[ Packagist](https://packagist.org/packages/moinul/laravel-pdf-to-html)[ RSS](/packages/moinul-laravel-pdf-to-html/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (20)Used By (0)

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

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

A Laravel package that converts PDF files to HTML with preserved formatting and styling using poppler-utils.

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

[](#requirements)

- PHP 8.2 or higher
- Laravel 7.x|8.x|9.x|10.x|11.x
- `pdftohtml` command-line tool (poppler-utils)

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

[](#installation)

1. Install the package via Composer:

```
composer require moinul/laravel-pdf-to-html
```

2. Install the required system dependency:

For Ubuntu/Debian:

```
sudo apt-get install poppler-utils
```

For CentOS/RHEL:

```
sudo yum install poppler-utils
```

For macOS:

```
brew install poppler
```

3. The package will automatically register its service provider in Laravel 5.5 and newer.
4. Create the storage symlink if you haven't already:

```
php artisan storage:link
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Moinul\LaravelPdfToHtml\Services\PdfToHtmlConverter;

public function convertPdf(Request $request)
{
    $converter = app(PdfToHtmlConverter::class);
    $html = $converter->convert('path/to/your/file.pdf');

    return $html; // Returns HtmlString
}
```

### Example Route

[](#example-route)

Here's a complete example of a route that converts a PDF file to HTML:

```
use Illuminate\Support\Facades\Route;

Route::get('/pdf-to-html', function () {
    $pdfPath = public_path('example.pdf');

    try {
        $converter = app(PdfToHtmlConverter::class);
        $html = $converter->convert($pdfPath);

        return view('pdf.html-output', ['html' => $html]);
    } catch (\Exception $e) {
        return "Error converting PDF: " . $e->getMessage();
    }
});
```

### Example View

[](#example-view)

Create a view file `resources/views/pdf/html-output.blade.php`:

```
DOCTYPE html>

    PDF to HTML Conversion

    {!! $html !!}

```

Features
--------

[](#features)

- Converts PDF files to responsive HTML
- Preserves text formatting and layout
- Handles images and maintains their positions
- Includes print-friendly styles
- Responsive design for various screen sizes
- Uses the efficient `pdftohtml` command-line tool

How it Works
------------

[](#how-it-works)

The package uses the `pdftohtml` command-line tool from poppler-utils to convert PDF files to HTML. The conversion process:

1. Takes a PDF file as input
2. Converts it to HTML while preserving formatting
3. Processes images and fixes their paths
4. Adds responsive and print-friendly CSS
5. Returns a clean, formatted HTML string

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

Support
-------

[](#support)

If you encounter any issues or have questions, please [create an issue](https://github.com/moinulict/laravel-pdf-to-html/issues) on GitHub.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance48

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Total

19

Last Release

382d ago

PHP version history (3 changes)v1.0.0PHP ^8.0

v1.0.1PHP ^7.3|^8.0

v1.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/74c776203fd25206d8b5239619b2df9f49042aafeba8e205698369455120de8e?d=identicon)[moinulict](/maintainers/moinulict)

---

Top Contributors

[![moinulict](https://avatars.githubusercontent.com/u/20926562?v=4)](https://github.com/moinulict "moinulict (29 commits)")

### Embed Badge

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

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k24.9M47](/packages/rap2hpoutre-fast-excel)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[stevebauman/autodoc-facades

Auto-generate PHP doc annotations for Laravel facades

98186.6k9](/packages/stevebauman-autodoc-facades)

PHPackages © 2026

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