Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
PdfParser Class Reference

A PDF parser class. More...

Public Member Functions

 __construct (StreamReader $streamReader)
 PdfParser constructor.
 
 cleanUp ()
 Removes cycled references.
 
 getCatalog ()
 Get the catalog dictionary.
 
 getCrossReference ()
 Get the cross-reference instance.
 
 getIndirectObject ($objectNumber, $cache=false)
 Get an indirect object by its object number.
 
 getPdfVersion ()
 Get the PDF version.
 
 getStreamReader ()
 Get the stream reader instance.
 
 getTokenizer ()
 Get the tokenizer instance.
 
 readValue ($token=null, $expectedType=null)
 Read a PDF value.
 

Protected Member Functions

 ensureExpectedType ($token, $expectedType)
 Ensures that the token will evaluate to an expected object type (or not).
 
 parsePdfArray ()
 
 parsePdfDictionary ()
 
 parsePdfHexString ()
 
 parsePdfIndirectObject ($objectNumber, $generationNumber)
 
 parsePdfName ()
 
 parsePdfString ()
 
 resolveFileHeader ()
 Resolves the file header.
 

Protected Attributes

string $fileHeader
 The file header.
 
int $fileHeaderOffset
 The offset to the file header.
 
array $objects = []
 All read objects.
 
StreamReader $streamReader
 
Tokenizer $tokenizer
 
CrossReference null $xref
 

Detailed Description

A PDF parser class.

Constructor & Destructor Documentation

◆ __construct()

PdfParser::__construct ( StreamReader $streamReader)

PdfParser constructor.

Parameters
StreamReader$streamReader

Member Function Documentation

◆ ensureExpectedType()

PdfParser::ensureExpectedType ( $token,
$expectedType )
protected

Ensures that the token will evaluate to an expected object type (or not).

Parameters
string$token
string | null$expectedType
Return values
bool
Exceptions
Type\PdfTypeException

◆ getCatalog()

PdfParser::getCatalog ( )

Get the catalog dictionary.

Return values
PdfDictionary
Exceptions
Type\PdfTypeException
CrossReferenceException
PdfParserException

◆ getCrossReference()

PdfParser::getCrossReference ( )

Get the cross-reference instance.

Return values
CrossReference
Exceptions
CrossReferenceException
PdfParserException

◆ getIndirectObject()

PdfParser::getIndirectObject ( $objectNumber,
$cache = false )

Get an indirect object by its object number.

Parameters
int$objectNumber
bool$cache
Return values
PdfIndirectObject
Exceptions
CrossReferenceException
PdfParserException

◆ getPdfVersion()

PdfParser::getPdfVersion ( )

Get the PDF version.

Return values
int[]An array of major and minor version.
Exceptions
PdfParserException

◆ getStreamReader()

PdfParser::getStreamReader ( )

Get the stream reader instance.

Return values
StreamReader

◆ getTokenizer()

PdfParser::getTokenizer ( )

Get the tokenizer instance.

Return values
Tokenizer

◆ parsePdfArray()

PdfParser::parsePdfArray ( )
protected
Return values
false|PdfArray
Exceptions
PdfTypeException

◆ parsePdfDictionary()

PdfParser::parsePdfDictionary ( )
protected
Return values
bool|PdfDictionary
Exceptions
PdfTypeException

◆ parsePdfHexString()

PdfParser::parsePdfHexString ( )
protected
Return values
false|PdfHexString

◆ parsePdfIndirectObject()

PdfParser::parsePdfIndirectObject ( $objectNumber,
$generationNumber )
protected
Parameters
int$objectNumber
int$generationNumber
Return values
false|PdfIndirectObject
Exceptions
Type\PdfTypeException

◆ parsePdfName()

PdfParser::parsePdfName ( )
protected
Return values
PdfName

◆ parsePdfString()

PdfParser::parsePdfString ( )
protected
Return values
PdfString

◆ readValue()

PdfParser::readValue ( $token = null,
$expectedType = null )

Read a PDF value.

Parameters
null | bool | string$token
null | string$expectedType
Return values
false|PdfArray|PdfBoolean|PdfDictionary|PdfHexString|PdfIndirectObject|PdfIndirectObjectReference|PdfName|PdfNull|PdfNumeric|PdfStream|PdfString|PdfToken
Exceptions
Type\PdfTypeException

◆ resolveFileHeader()

PdfParser::resolveFileHeader ( )
protected

Resolves the file header.

Exceptions
PdfParserException
Return values
int

The documentation for this class was generated from the following file: