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: 326 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

CrossReference:: (10 methods):
  __construct()
  getSize()
  getTrailer()
  getReaders()
  getOffsetFor()
  getIndirectObject()
  readXref()
  initReaderInstance()
  checkForEncryption()
  findStartXref()


Class: CrossReference  - X-Ref

Class CrossReference

This class processes the standard cross reference of a PDF document.
__construct(PdfParser $parser, $fileHeaderOffset = 0)   X-Ref
CrossReference constructor.

param: PdfParser $parser

getSize()   X-Ref
Get the size of the cross reference.

return: integer

getTrailer()   X-Ref
Get the trailer dictionary.

return: PdfDictionary

getReaders()   X-Ref
Get the cross reference readser instances.

return: ReaderInterface[]

getOffsetFor($objectNumber)   X-Ref
Get the offset by an object number.

param: int $objectNumber
return: integer|bool

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

param: int $objectNumber
return: PdfIndirectObject

readXref($offset)   X-Ref
Read the cross-reference table at a given offset.

Internally the method will try to evaluate the best reader for this cross-reference.

param: int $offset
return: ReaderInterface

initReaderInstance($initValue)   X-Ref
Get a cross-reference reader instance.

param: PdfToken|PdfIndirectObject $initValue
return: ReaderInterface|bool

checkForEncryption(PdfDictionary $dictionary)   X-Ref
Check for encryption.

param: PdfDictionary $dictionary

findStartXref()   X-Ref
Find the start position for the first cross-reference.

return: int The byte-offset position of the first cross-reference.