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

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

ahmaadkhader/pdf-to-html
========================

Standalone PHP library for extracting semantic HTML from PDF files. Detects headings, lists, tables, links, and inline styles from PDF content.

1.0.0(2mo ago)0797GPL-2.0-or-laterPHPPHP &gt;=8.1

Since May 11Pushed 2mo agoCompare

[ Source](https://github.com/Ahmaadkhader/pdf-to-html)[ Packagist](https://packagist.org/packages/ahmaadkhader/pdf-to-html)[ RSS](/packages/ahmaadkhader-pdf-to-html/feed)WikiDiscussions 1.0.x Synced 1w ago

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

PDF to HTML
===========

[](#pdf-to-html)

Standalone PHP library for extracting semantic HTML from PDF files using [smalot/pdfparser](https://github.com/smalot/pdfparser).

Features
--------

[](#features)

- **Heading detection** — identifies heading levels from font size ratios
- **List detection** — groups bullet and numbered items into ``/`` lists
- **Table detection** — identifies tabular content from X-coordinate column clustering
- **Link extraction** — matches PDF link annotations to text content
- **Inline styles** — preserves font size and color differences as CSS

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

[](#installation)

```
composer require ahmaadkhader/pdf-to-html
```

Usage
-----

[](#usage)

```
use Ahmaadkhader\PdfToHtml\PdfToHtml;
use Ahmaadkhader\PdfToHtml\StyleAnalyzer;
use Ahmaadkhader\PdfToHtml\TableDetector;
use Ahmaadkhader\PdfToHtml\LinkExtractor;
use Ahmaadkhader\PdfToHtml\HtmlRenderer;

$styleAnalyzer = new StyleAnalyzer();
$tableDetector = new TableDetector();
$linkExtractor = new LinkExtractor($styleAnalyzer);
$htmlRenderer = new HtmlRenderer($styleAnalyzer);

$converter = new PdfToHtml($styleAnalyzer, $tableDetector, $linkExtractor, $htmlRenderer);

// Extract plain text.
$text = $converter->extractText('/path/to/file.pdf');

// Extract semantic HTML with headings, lists, tables and links.
$html = $converter->extractHtml('/path/to/file.pdf');

// Use native heading tags (h1-h6) instead of class-based.
$html = $converter->extractHtml('/path/to/file.pdf', ['native_headings' => true]);
```

Architecture
------------

[](#architecture)

ClassResponsibility`PdfToHtml`Core orchestration — parses PDF, coordinates sub-components`StyleAnalyzer`Font size, color, heading level, and inline style detection`TableDetector`Table region detection from DataTm positioning data`LinkExtractor`PDF link annotation extraction and text matching`HtmlRenderer`Renders classified content lines into semantic HTMLRequirements
------------

[](#requirements)

- PHP 8.1+
- `smalot/pdfparser` ^2.12

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance86

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

2

Last Release

74d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/111915313?v=4)[Ahmad Khader](/maintainers/Ahmaadkhader)[@Ahmaadkhader](https://github.com/Ahmaadkhader)

### Embed Badge

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

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

###  Alternatives

[kiwilan/php-archive

PHP package to handle archives (.zip, .rar, .tar, .7z, .pdf) with unified API and hybrid solution (native/p7zip), designed to works with EPUB and CBA (.cbz, .cbr, .cb7, .cbt).

1135.0k1](/packages/kiwilan-php-archive)[popphp/pop-pdf

PHP PDF library for generating and importing PDF documents. A component of the Pop PHP Framework

208.8k1](/packages/popphp-pop-pdf)

PHPackages © 2026

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