Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
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

 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

◆ 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

◆ 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: