Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

This file is part of FPDI

Copyright: Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
License: http://opensource.org/licenses/mit-license The MIT License
File Size: 381 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

PdfParser:: (11 methods):
  __construct()
  cleanUp()
  getStreamReader()
  getTokenizer()
  resolveFileHeader()
  getCrossReference()
  getPdfVersion()
  getCatalog()
  getIndirectObject()
  readValue()
  ensureExpectedType()


Class: PdfParser  - X-Ref

A PDF parser class

__construct(StreamReader $streamReader)   X-Ref
PdfParser constructor.

param: StreamReader $streamReader

cleanUp()   X-Ref
Removes cycled references.


getStreamReader()   X-Ref
Get the stream reader instance.

return: StreamReader

getTokenizer()   X-Ref
Get the tokenizer instance.

return: Tokenizer

resolveFileHeader()   X-Ref
Resolves the file header.

return: int

getCrossReference()   X-Ref
Get the cross reference instance.

return: CrossReference

getPdfVersion()   X-Ref
Get the PDF version.

return: int[] An array of major and minor version.

getCatalog()   X-Ref
Get the catalog dictionary.

return: PdfDictionary

getIndirectObject($objectNumber, $cache = false)   X-Ref
Get an indirect object by its object number.

param: int $objectNumber
param: bool $cache
return: PdfIndirectObject

readValue($token = null, $expectedType = null)   X-Ref
Read a PDF value.

param: null|bool|string $token
param: null|string $expectedType
return: false|PdfArray|PdfBoolean|PdfDictionary|PdfHexString|PdfIndirectObject|PdfIndirectObjectReference|PdfName|PdfNull|PdfNumeric|PdfStream|PdfString|PdfToken

ensureExpectedType($token, $expectedType)   X-Ref
Ensures that the token will evaluate to an expected object type (or not).

param: string $token
param: string|null $expectedType
return: bool