phpdftk API Documentation

PdfHydrator
in package

FinalYes

Hydrates raw `PdfDictionary` objects (from the reader) into typed `PdfObject` subclasses (used by the writer).

The hydrator uses a /Type → class registry and maps PDF dictionary keys to PHP property names using a key→property map built from each class's known field mappings.

Values are assigned as-is — PdfReference values stay as references (lazy resolution), and inline dicts/arrays are preserved. Deep hydration (recursively hydrating nested objects) is opt-in via the resolver.

Table of Contents

Methods

hydrate()  : PdfObject|PdfDictionary
Hydrate a raw PdfDictionary into a typed PdfObject.
registerActionType()  : void
Register a PdfObject subclass for an action /S value.
registerDefaults()  : void
Auto-discover and register all PdfObject subclasses that define a PDF_TYPE constant. Call once at bootstrap.
registerSubtype()  : void
Register a PdfObject subclass for a /Type + /Subtype combination.
registerType()  : void
Register a PdfObject subclass for a given /Type value.

Methods

hydrate()

Hydrate a raw PdfDictionary into a typed PdfObject.

public static hydrate(PdfDictionary $dict[, int $objectNumber = 0 ][, int $generationNumber = 0 ]) : PdfObject|PdfDictionary

If the dictionary has a /Type entry that maps to a registered class, that class is instantiated and its properties populated. Otherwise, the raw dictionary is returned unchanged.

Parameters
$dict : PdfDictionary
$objectNumber : int = 0

Object number to assign to the hydrated object

$generationNumber : int = 0

Generation number

Return values
PdfObject|PdfDictionary

registerActionType()

Register a PdfObject subclass for an action /S value.

public static registerActionType(string $actionType, PdfObject> $className) : void
Parameters
$actionType : string
$className : PdfObject>

registerDefaults()

Auto-discover and register all PdfObject subclasses that define a PDF_TYPE constant. Call once at bootstrap.

public static registerDefaults() : void

registerSubtype()

Register a PdfObject subclass for a /Type + /Subtype combination.

public static registerSubtype(string $pdfType, string $subtype, PdfObject> $className) : void
Parameters
$pdfType : string
$subtype : string
$className : PdfObject>

registerType()

Register a PdfObject subclass for a given /Type value.

public static registerType(string $pdfType, PdfObject> $className) : void
Parameters
$pdfType : string
$className : PdfObject>

        
On this page

Search results