Search by

adachsoft / pdf-lib

Arkadiusz Adach

Implementation of PDF conversion and text extraction using Dompdf and Smalot PdfParser.

Package info

gitlab.com/a.adach/pdf-lib

Issues

pkg:composer/adachsoft/pdf-lib

Statistics

Installs: 7

Dependents: 1

Suggesters: 0

Stars: 0

v0.1.0 2026-10-08 03:59 UTC

This package is not auto-updated.

Last update: 2026-10-09 09:26:42 UTC


README

adachsoft/pdf-lib provides PDF conversion, text extraction, and page editing services for PHP applications.

Features

  • Convert HTML content or HTML files to PDF with Dompdf.
  • Extract text and page counts from PDF files with Smalot PdfParser.
  • Add, remove, and replace PDF pages with FPDI.
  • Create the library services through a single factory.
  • Use the contracts provided by adachsoft/pdf-contracts for stable service boundaries.

Installation

composer require adachsoft/pdf-lib

The package requires PHP 8.3 or newer.

Usage

Create services with PdfServiceFactory:

use AdachSoft\PdfLib\Factory\PdfServiceFactory;

$converter = PdfServiceFactory::createConverter();
$converter->convert(
    '<h1>Hello PDF</h1>',
    __DIR__ . '/var/hello.pdf',
);

$extractor = PdfServiceFactory::createExtractor();
$result = $extractor->extractText(__DIR__ . '/var/hello.pdf');
$pageCount = $extractor->getPageCount(__DIR__ . '/var/hello.pdf');

The page editor is also available through the factory:

$editor = PdfServiceFactory::createPageEditor($converter);
$pageCount = $editor->getPageCount(__DIR__ . '/var/source.pdf');

See the conversion example, text extraction example, and page editing example for complete usage patterns.

License

This library is released under the MIT License.