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

1.2.0(1mo ago)028MITPHPPHP &gt;=8.1

Since Sep 28Pushed 1mo 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 today

READMEChangelogDependencies (18)Versions (5)Used By (0)

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

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

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

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Available Services](#available-services)
    - [PDF Creation](#pdf-creation)
    - [PDF Conversion](#pdf-conversion)
    - [PDF Merging &amp; Splitting](#pdf-merging--splitting)
    - [Page Manipulation](#page-manipulation)
    - [OCR Processing](#ocr-processing)
    - [PDF Compression](#pdf-compression)
    - [Security](#security)
    - [Linearize (Web Optimize)](#linearize-web-optimize)
    - [Form Processing](#form-processing)
    - [PDF Extraction](#pdf-extraction)
    - [PDF to Markdown](#pdf-to-markdown)
    - [PDF to Images](#pdf-to-images)
    - [Accessibility](#accessibility)
    - [Document Generation](#document-generation)
    - [Watermarking](#watermarking)
    - [Metadata](#metadata)
    - [Digital Signatures](#digital-signatures)
    - [Document Comparison](#document-comparison)
    - [Annotations](#annotations)
- [Advanced Usage](#advanced-usage)
    - [Batch Processing](#batch-processing)
    - [Webhooks (Notifiers)](#webhooks-notifiers)
- [Error Handling](#error-handling)

Features
--------

[](#features)

- **Full API v2 Support**: Uses the latest Adobe PDF Services asynchronous workflow.
- **All PDF Operations**: Create, convert, merge, split, compress, protect, extract, OCR, and more.
- **Lazy Loading**: Services are instantiated only when needed for better performance.
- **Robust Error Handling**: Standardized exceptions for API, authentication, and validation errors.
- **Regional Endpoints**: Support for US and EU Adobe regions.
- **Batch Processing**: Execute multiple operations sequentially with a single call.

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

[](#requirements)

- PHP 8.1 or higher
- Composer
- ext-zip (for ZIP output support)
- ext-curl (for HTTP requests)

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

[](#installation)

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

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

[](#quick-start)

### Basic Setup

[](#basic-setup)

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

$config = new PdfServicesConfig(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    organizationId: 'your-organization-id',
    region: 'us' // 'us' (default) or 'eu'
);

$client = new Client($config);
```

---

Available Services
------------------

[](#available-services)

### PDF Creation

[](#pdf-creation)

Convert HTML or URLs to PDF.

```
$service = $client->createPdf();

// From HTML string
$pdf = $service->fromHtml('Hello World', [
    'format' => 'A4',
    'includeHeaderFooter' => true
]);
$pdf->saveTo('output.pdf');

// From URL
$pdf = $service->fromUrl('https://example.com');
$pdf->saveTo('website.pdf');
```

### PDF Conversion

[](#pdf-conversion)

Convert between various formats.

```
$service = $client->convert();

// DOCX to PDF
$pdf = $service->docxToPdf('document.docx');

// PDF to DOCX
$docx = $service->pdfToDocx('input.pdf');

// Image to PDF
$pdf = $service->imageToPdf('photo.jpg');
```

### PDF Merging &amp; Splitting

[](#pdf-merging--splitting)

```
// Merging
$client->merge()->combine(['file1.pdf', 'file2.pdf'])->saveTo('merged.pdf');

// Splitting
$docs = $client->split()->split('input.pdf', [
    'pageRanges' => [['start' => 1, 'end' => 2]]
]);
foreach ($docs as $i => $doc) {
    $doc->saveTo("part_$i.pdf");
}
```

### Page Manipulation

[](#page-manipulation)

Delete, rotate, reorder, insert, or replace pages.

```
$service = $client->pageManipulation();
$doc = $client->convert()->docxToPdf('input.docx'); // Get a Document object

// Delete pages
$service->deletePages($doc, [['start' => 1, 'end' => 1]])->saveTo('deleted.pdf');

// Rotate pages (90, 180, 270)
$service->rotatePages($doc, 90)->saveTo('rotated.pdf');

// Insert pages from another doc
$otherDoc = $client->createPdf()->fromHtml('New Page');
$service->insertPages($doc, $otherDoc, atPage: 1)->saveTo('inserted.pdf');
```

### OCR Processing

[](#ocr-processing)

```
$client->ocr()->ocr('scanned.pdf', [
    'ocrType' => 'searchable_image',
    'ocrLang' => 'en-US'
])->saveTo('searchable.pdf');
```

### PDF Compression

[](#pdf-compression)

```
$client->compress()->compress('large.pdf', ['compressionLevel' => 'MEDIUM'])->saveTo('small.pdf');
```

### Security

[](#security)

```
$service = $client->secure();

// Protect with password and permissions
$service->protect('input.pdf', [
    'password' => 'secret123',
    'permissions' => ['PRINT_LOW_RES']
])->saveTo('protected.pdf');

// Unprotect
$service->unprotect('protected.pdf', 'secret123')->saveTo('open.pdf');
```

### Linearize (Web Optimize)

[](#linearize-web-optimize)

Optimize a PDF for fast web viewing (linearized PDF).

```
$client->linearize()->linearize('large.pdf')->saveTo('web-optimized.pdf');
```

### Form Processing

[](#form-processing)

```
$service = $client->forms();

// Fill form
$service->fillForm('template.pdf', ['first_name' => 'John'])->saveTo('filled.pdf');

// Export data (JSON)
$data = $service->exportFormData($doc, 'json');
```

### PDF Extraction

[](#pdf-extraction)

Extract text, tables, and images as structured data (ZIP output).

```
// Extract text and tables
$zip = $client->extract()->extract('document.pdf', ['text', 'tables']);
$zip->saveTo('extracted_data.zip');

// Extract text only
$zip = $client->extract()->extract('document.pdf', ['text']);

// Extract with table images and figures
$zip = $client->extract()->extract('document.pdf', ['text'], [
    'renditionsToExtract' => ['tables', 'figures']
]);

// Extract tables as CSV
$zip = $client->extract()->extract('document.pdf', ['tables'], [
    'tableOutputFormat' => 'csv'
]);
```

### PDF to Markdown

[](#pdf-to-markdown)

Convert PDF to LLM-friendly Markdown (returns ZIP with `markdown.json`).

```
$service = $client->markdown();

// Basic conversion (returns ZIP with markdown.json)
$service->toMarkdown('document.pdf')->saveTo('markdown_output.zip');

// Include base64-encoded figures
$service->toMarkdown('document.pdf', ['getFigures' => true])->saveTo('markdown_with_images.zip');
```

### PDF to Images

[](#pdf-to-images)

Convert PDF pages to image files (JPEG, PNG, TIFF).

```
$service = $client->images();

// Convert to JPEG (default, returns ZIP)
$service->toJpeg('document.pdf')->saveTo('images-jpeg.zip');

// Convert to PNG
$service->toPng('document.pdf')->saveTo('images-png.zip');

// Convert to TIFF
$service->toTiff('document.pdf')->saveTo('images-tiff.zip');

// Or use the general method with custom options
$service->toImages('document.pdf', 'jpeg', 'zipOfPageImages')->saveTo('output.zip');
```

### Accessibility

[](#accessibility)

```
$service = $client->accessibility();

// Auto-tag for accessibility (returns [taggedPdf, report])
[$taggedDoc, $report] = $service->autoTag('input.pdf', ['generateReport' => true]);
$taggedDoc->saveTo('tagged.pdf');

// Check accessibility (returns HTML report)
$reportHtml = $service->check('input.pdf');
$reportHtml->saveTo('accessibility_report.html');
```

### Document Generation

[](#document-generation)

Merge Word templates with dynamic data to create PDF or DOCX.

```
$client->documentGeneration()->generate(
    templatePath: 'invoice_template.docx',
    jsonData: ['invoice_id' => '123', 'amount' => 50.00]
)->saveTo('invoice.pdf');
```

### Watermarking

[](#watermarking)

Add a watermark to PDF pages using a source watermark PDF.

```
$client->watermark()->addWatermark(
    'document.pdf',
    'watermark_source.pdf',
    ['appearance' => ['opacity' => 50]]
)->saveTo('watermarked.pdf');
```

### Metadata

[](#metadata)

Read and update PDF metadata.

```
$service = $client->metadata();

// Get metadata
$metadata = $service->getMetadata('document.pdf');
echo $metadata['title'] ?? 'Unknown';

// Update metadata
$service->updateMetadata('document.pdf', [
    'title' => 'New Title',
    'author' => 'Jane Doe'
])->saveTo('updated.pdf');
```

### Digital Signatures

[](#digital-signatures)

Apply digital signatures to PDF documents.

```
$client->signature()->sign('document.pdf', [
    'signatureFieldName' => 'Signature1',
    'pageNumber' => 1,
    'location' => ['top' => 400, 'left' => 50]
])->saveTo('signed.pdf');
```

### Document Comparison

[](#document-comparison)

Compare two PDF documents and highlight differences.

```
$diff = $client->compare()->compare('original.pdf', 'modified.pdf');
$diff->saveTo('comparison_result.pdf');
```

### Annotations

[](#annotations)

Add and manage annotations on PDF documents.

```
$client->annotate()->addAnnotation('document.pdf', [
    'type' => 'text',
    'content' => 'This is an important note',
    'pageNumber' => 1,
    'position' => ['x' => 100, 'y' => 200]
])->saveTo('annotated.pdf');
```

---

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

[](#advanced-usage)

### Batch Processing

[](#batch-processing)

Execute multiple operations sequentially with a single call. Operations are saved to disk automatically when an `output` path is specified.

```
$batchService = $client->batch();

// Define operations
$operationDefs = [
    ['type' => 'convert', 'input' => 'doc1.docx', 'output' => 'doc1.pdf'],
    ['type' => 'convert', 'input' => 'doc2.docx', 'output' => 'doc2.pdf'],
    ['type' => 'compress', 'input' => 'large.pdf', 'output' => 'small.pdf', 'options' => ['compressionLevel' => 'MEDIUM']],
];

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

// Or use a single method call
$batch = $batchService->createAndExecuteBatch($operationDefs);

// Check results
foreach ($results->getResults() as $operationId => $result) {
    if ($result['status'] === 'completed') {
        echo "{$operationId}: succeeded\n";
    } else {
        echo "{$operationId}: failed - {$result['error']}\n";
    }
}

// Get Document objects for custom saving
$documents = $batchService->getBatchResults($results);
foreach ($documents as $operationId => $doc) {
    $doc->saveTo("custom_{$operationId}.pdf");
}
```

**Supported batch operation types:**

TypeDescriptionRequired Fields`convert`DOCX/XLSX/PPTX/image to PDF`input`, `output``compress`Compress PDF`input`, `output``merge`Combine multiple PDFs`input[]` (array), `output``ocr`OCR a scanned PDF`input`, `output``export`PDF to DOCX/XLSX/PPTX`input`, `output``linearize`Web-optimize a PDF`input`, `output``protect`Add password protection`input`, `output``split`Split PDF into ranges`input`, `output`### Webhooks (Notifiers)

[](#webhooks-notifiers)

You can configure webhooks to be notified when a job is done.

```
$config->setNotifiers([
    [
        'type' => 'CALLBACK',
        'url' => 'https://your-app.com/webhook-handler'
    ]
]);
```

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

[](#error-handling)

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

try {
    $client->convert()->docxToPdf('missing.docx');
} catch (ApiException $e) {
    echo "Error: " . $e->getMessage();
    echo "Status Code: " . $e->getCode();
    echo "Request ID: " . $e->getRequestId();
}
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance81

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~124 days

Total

3

Last Release

30d ago

### Community

Maintainers

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

---

Top Contributors

[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[bot] (28 commits)")[![grim-reapper](https://avatars.githubusercontent.com/u/7957389?v=4)](https://github.com/grim-reapper "grim-reapper (4 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

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[drupal/core-recommended

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

6942.5M421](/packages/drupal-core-recommended)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)

PHPackages © 2026

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