PHPackages                             grim-reapper/pdf-services-php - 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. grim-reapper/pdf-services-php

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

grim-reapper/pdf-services-php
=============================

grim-reapper PDF Services PHP SDK - Complete integration with Adobe PDF Services API

v1.0.1(5mo ago)017MITPHPPHP &gt;=8.1

Since Sep 28Pushed 5mo agoCompare

[ Source](https://github.com/grim-reapper/pdf-services-php)[ Packagist](https://packagist.org/packages/grim-reapper/pdf-services-php)[ Docs](https://github.com/grim-reapper/pdf-services-php)[ GitHub Sponsors](https://github.com/sponsors/grim-reapper)[ RSS](/packages/grim-reapper-pdf-services-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (3)Used By (0)

GrimReapper PDF Services PHP SDK
================================

[](#grimreapper-pdf-services-php-sdk)

A comprehensive PHP SDK for Adobe PDF Services API that provides easy integration with all PDF manipulation, conversion, and processing features.

Features
--------

[](#features)

- **PDF Creation**: Generate PDFs from HTML, DOCX, images, and other formats
- **PDF Conversion**: Convert between PDF, DOCX, images, and other formats
- **PDF Merging**: Combine multiple PDFs into a single document
- **PDF Splitting**: Extract pages or split PDFs into multiple documents
- **OCR Processing**: Extract text from scanned documents
- **PDF Compression**: Reduce file sizes while maintaining quality
- **Security**: Password protection and permission management
- **Annotations**: Add comments, highlights, and markup to PDFs
- **Form Processing**: Extract and manipulate form data
- **Metadata Management**: Read and modify PDF metadata
- **Digital Signatures**: Add and validate electronic signatures
- **PDF Comparison**: Compare documents and generate diff reports
- **Batch Processing**: Process multiple operations efficiently

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

[](#requirements)

- PHP 8.1 or higher
- Composer for dependency management

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

[](#installation)

Install the package using Composer:

```
composer require grim-reapper/pdf-services-php
```

Quick Start
-----------

[](#quick-start)

### Basic Setup

[](#basic-setup)

```
use GrimReapper\PdfServices\Client;
use GrimReapper\PdfServices\Config\PdfServicesConfig;

// Configure the client
$config = new PdfServicesConfig(
    apiKey: 'your-api-key',
    clientId: 'your-client-id',
    organizationId: 'your-organization-id'
);

// Create the client
$client = new Client($config);
```

### PDF Creation from HTML

[](#pdf-creation-from-html)

```
use GrimReapper\PdfServices\Models\Document;

// Get the PDF creation service
$creationService = $client->createPdf();

// Create PDF from HTML
$result = $creationService->fromHtml(
    html: 'Hello WorldThis is a PDF created with Adobe PDF Services.',
    options: [
        'format' => 'A4',
        'margin' => ['top' => '1in', 'bottom' => '1in', 'left' => '1in', 'right' => '1in']
    ]
);

// Save the result
$result->saveTo('/path/to/output.pdf');
```

### PDF Conversion

[](#pdf-conversion)

```
// Get the conversion service
$conversionService = $client->convert();

// Convert DOCX to PDF
$result = $conversionService->docxToPdf('/path/to/document.docx');
$result->saveTo('/path/to/output.pdf');

// Convert PDF to DOCX
$result = $conversionService->pdfToDocx('/path/to/document.pdf');
$result->saveTo('/path/to/output.docx');

// Convert image to PDF
$result = $conversionService->imageToPdf('/path/to/image.jpg');
$result->saveTo('/path/to/output.pdf');
```

### PDF Merging

[](#pdf-merging)

```
// Get the merge service
$mergeService = $client->merge();

// Merge multiple PDFs
$result = $mergeService->combine([
    '/path/to/document1.pdf',
    '/path/to/document2.pdf',
    '/path/to/document3.pdf'
]);

$result->saveTo('/path/to/merged.pdf');
```

### Digital Signatures

[](#digital-signatures)

```
// Get the signature service
$signatureService = $client->signature();

// Add a signature field
$result = $signatureService->addSignatureField('/path/to/document.pdf', [
    'name' => 'signature_field_1',
    'position' => ['x' => 100, 'y' => 100, 'width' => 200, 'height' => 50],
    'page' => 1
]);

// Add a digital signature
$result = $signatureService->addSignature('/path/to/document.pdf', [
    'certificate_path' => '/path/to/certificate.p12',
    'certificate_password' => 'password',
    'signature_field' => 'signature_field_1',
    'reason' => 'Document approval'
]);

$result->saveTo('/path/to/signed.pdf');
```

### PDF Comparison

[](#pdf-comparison)

```
// Get the comparison service
$comparisonService = $client->compare();

// Compare two PDFs
$result = $comparisonService->comparePdfs(
    '/path/to/document_v1.pdf',
    '/path/to/document_v2.pdf'
);

if (!$result->areIdentical()) {
    echo "Found {$result->getDifferenceCount()} differences\n";

    // Generate a visual diff report
    $diffReport = $comparisonService->generateDiffReport(
        '/path/to/document_v1.pdf',
        '/path/to/document_v2.pdf',
        '/path/to/diff_report.pdf'
    );
}
```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

You can configure the client using environment variables:

```
export GRIM_REAPPER_PDF_SERVICES_API_KEY="your-api-key"
export GRIM_REAPPER_PDF_SERVICES_CLIENT_ID="your-client-id"
export GRIM_REAPPER_PDF_SERVICES_ORGANIZATION_ID="your-organization-id"
export GRIM_REAPPER_PDF_SERVICES_ENVIRONMENT="production"
```

Then create the config from environment:

```
$config = PdfServicesConfig::fromEnvironment();
```

### Custom HTTP Client

[](#custom-http-client)

You can provide your own PSR-18 compatible HTTP client:

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory;

$guzzleClient = new GuzzleClient();
$requestFactory = new HttpFactory();
$streamFactory = new HttpFactory();

$config = new PdfServicesConfig('api-key', 'client-id', 'org-id');
$config->setHttpClient($guzzleClient);
$config->setRequestFactory($requestFactory);
$config->setStreamFactory($streamFactory);
```

Error Handling
--------------

[](#error-handling)

The SDK provides specific exception types for different error conditions:

```
use GrimReapper\PdfServices\Exceptions\AuthenticationException;
use GrimReapper\PdfServices\Exceptions\ApiException;
use GrimReapper\PdfServices\Exceptions\ValidationException;

try {
    $result = $client->convert()->docxToPdf('/path/to/document.docx');
} catch (AuthenticationException $e) {
    // Handle authentication errors
    echo "Authentication failed: " . $e->getMessage();
} catch (ValidationException $e) {
    // Handle validation errors
    echo "Validation error: " . $e->getMessage();
} catch (ApiException $e) {
    // Handle API errors
    echo "API error: " . $e->getMessage();
    echo "Request ID: " . $e->getRequestId();
}
```

Logging
-------

[](#logging)

Add logging to your application for debugging and monitoring:

```
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$logger = new Logger('pdf-services');
$logger->pushHandler(new StreamHandler('logs/pdf-services.log', Logger::DEBUG));

// Set logger on services
$client->convert()->setLogger($logger);
$client->merge()->setLogger($logger);
```

Advanced Usage
--------------

[](#advanced-usage)

### Asynchronous Operations

[](#asynchronous-operations)

Some operations support asynchronous processing for large files:

```
// Start an asynchronous job
$job = $conversionService->docxToPdfAsync('/path/to/large-document.docx');

// Check job status
while (!$job->isCompleted()) {
    sleep(5); // Wait 5 seconds
    $job = $conversionService->getJobStatus($job->getJobId());
}

// Get the result when complete
if ($job->isCompleted()) {
    $result = $conversionService->getJobResult($job->getJobId());
    $result->saveTo('/path/to/output.pdf');
}
```

### Batch Processing

[](#batch-processing)

Process multiple operations efficiently in batches:

```
// Get the batch processor service
$batchService = $client->batch();

// Define batch operations
$operationDefs = [
    [
        'type' => 'convert',
        'input' => 'input/document1.docx',
        'output' => 'output/document1.pdf'
    ],
    [
        'type' => 'convert',
        'input' => 'input/document2.docx',
        'output' => 'output/document2.pdf'
    ],
    [
        'type' => 'merge',
        'inputs' => ['output/document1.pdf', 'output/document2.pdf'],
        'output' => 'output/merged.pdf'
    ]
];

// Create and execute batch
$batch = $batchService->createBatchFromDefinitions($operationDefs);
$completedBatch = $batchService->executeBatch($batch);

// Get results
$results = $batchService->getBatchResults($completedBatch);
foreach ($results as $operationId => $document) {
    echo "Operation {$operationId} completed: {$document->getFilename()}\n";
}
```

### Advanced Batch Operations

[](#advanced-batch-operations)

Use BatchOperation objects for more control:

```
use GrimReapper\PdfServices\Models\BatchOperation;

$operations = [
    BatchOperation::createConversion(
        'conv-1',
        'input/report.docx',
        'output/report.pdf',
        'docx',
        'pdf'
    ),
    BatchOperation::createMerge(
        'merge-1',
        ['output/file1.pdf', 'output/file2.pdf'],
        'output/combined.pdf'
    ),
    BatchOperation::createOcr(
        'ocr-1',
        'input/scanned.pdf',
        'output/searchable.pdf'
    )
];

$batch = $batchService->createBatch($operations);
```

API Reference
-------------

[](#api-reference)

For detailed API documentation, see the [API Reference](docs/api-reference.md).

Examples
--------

[](#examples)

See the [examples](examples/) directory for complete working examples of all features.

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

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

For support and questions:

- [Adobe PDF Services Documentation](https://developer.adobe.com/document-services/docs/overview/)
- [GitHub Issues](https://github.com/grim-reapper/pdf-services-php/issues)
- [Adobe Developer Forums](https://community.adobe.com/t5/document-services-apis/bd-p/DocumentServices-APIs)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance72

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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

Total

2

Last Release

157d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7252105628ffa6f064585370161626c7c72e68dd2e74ee66aa50d5894543c183?d=identicon)[webz2feel](/maintainers/webz2feel)

---

Top Contributors

[![grim-reapper](https://avatars.githubusercontent.com/u/7957389?v=4)](https://github.com/grim-reapper "grim-reapper (2 commits)")

---

Tags

phppdfsdksignatureconversionmergesplitOCRadobepdf-services

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/grim-reapper-pdf-services-php/health.svg)

```
[![Health](https://phpackages.com/badges/grim-reapper-pdf-services-php/health.svg)](https://phpackages.com/packages/grim-reapper-pdf-services-php)
```

###  Alternatives

[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M493](/packages/mpdf-mpdf)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3685.2M19](/packages/gotenberg-gotenberg-php)

PHPackages © 2026

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